Selected Layer/Datatype wrong from seletec_layer ...

edited October 2017 in Python scripting
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

Comments

  • edited November -1

    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

Sign In or Register to comment.