I’m trying to get all the layers and datatype used in a layout (made using nazca or loaded from a gds). I tried (see example below) to use get_layers() but it yields KeyError: “[‘nazca_name’] not in index”.
How can I get a list/dict of all the layers used?
nd.clear_layout()
with nd.Cell() as cell:
r = nd.geometries.box(length=2, width=1)
nd.Polygon(points=r, layer=1).put()
cell.put()
nd.get_layers()
nd.export_plt()
All layers are stored in a Pandas DataFrame in the cfg module. You can access it as df = nd.cfg.layer_table
The method nd.get_layers() simply gets you the same DataFrame with a column filter added, but a column name has been changed into “layer_name”, hence the error. Will fix that and put a test on it.
Alternatively to print the layers to stdout you can use nd.show_layers()