gdsfactory icon indicating copy to clipboard operation
gdsfactory copied to clipboard

LayerMap object and gf.get_layer is kind of confusing

Open mithro opened this issue 10 months ago • 3 comments

The LayerMap object is an aenum._enum.EnumType enum.

This makes things a bit weird because the actual int value of the layers is in no way connected to the GDS number. See the info below;

In [4]: gf180mcu.layers.LAYER.metal1
Out[4]: <LAYER.metal1: 10>

In [5]: gf180mcu.layers.LAYER.metal1[0]
Out[5]: 34

Then there is gf.get_layer which returns either a number or a value from the LAYER enum which I then need to convert to an actual Layer enum.

In [5]: gf.get_layer((0,0))
Out[21]: 131

In [26]: gf180mcu.layers.LAYER(gf.get_layer((0,0)))
Out[26]: <LAYER.pr_bndry: 131>

What is the correct / easy way to convert the two-tuple into a Layer object so I can get it's name?

mithro avatar Jun 01 '25 01:06 mithro