Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorandyL
    • CommentTimeOct 20th 2017
     
    I'm not able to get the layer and datatype correct out of my layout.
    The values do not match the current situation, some are correct other wrong.


    from pya import *

    lv = pya.Application.instance().main_window().current_view()
    layout = lv.active_cellview().layout()

    sel_layers=[]
    sel_layers = lv.selected_layers()
    if len(sel_layers) == 0:
    print("No Layer selected")


    for l in sel_layers:
    a = l.current()
    li = a.layer_index()
    myLayer = layout.layer(li,0)
    info = layout.get_info(myLayer)
    print(info.name, info.layer, info.datatype)


    BR,
    Andy
    • CommentAuthorMatthias
    • CommentTimeOct 26th 2017
     

    Hi Andy,

    This should be sufficient:

    for l in sel_layers:
      info = layout.get_info(l.current().layer_index())
      print(info.name, info.layer, info.datatype)
    

    BTW: This Forum supports Markdown. So you can format source code using four spaces as indent. For Python this is mandatory - otherwise I can only guess the code structure.

    Matthias