It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, I am new in Klayout world. Trying to achieve something wiht a layout having cells and subcells in the heirarchy. I want to copy a layer (layer1) and put that into a new layer (layer2). I tried the following code. This runs and shows no error but not copying anything..
import pya
layout = pya.Application.instance().main_window().current_view().active_cellview().layout()
src_lay=1
des_lay=2
for c in layout.each_cell():
print(c.name)
topcell=layout.cell(c.name)
topcell.copy(src_lay,des_lay)
Comments
I tried this and now it wokrs.. i wonder what is the difference -
@sheikh_nir The layer numbers you need for "copy" are "layer indexes", not particular design layers. A layer index is an internal number of the layer. A design layer is given by a combination of layer number and datatype number or a name summarized in the "LayerInfo" structure. "layout.layer(LayerInfo)" will give you the index under which a design layer specified by the LayerInfo structure is stored or it will generate a new layer if no such layer exists.
Within this concept you can also generate anonymous layers not begin associated with a design layer.
Matthias
Thanks @Matthias for the explanation. This makes all the sense