"""Using a PDK's predefined layers and design rules.

Instead of allocating layer numbers by hand, import a PDK module and
read the named layers from its `LAYER` namespace. Each entry is a
`Layer` (subclass of `LayerSpec`) carrying min-width, min-spacing, and
min-radius rules — the router and tapers consult those automatically.
"""
import lumicron as lm
import lumicron.pdks.elyon_demo.all as pdk


@lm.pcell
def PDKLayers():
    c = lm.CELL("PDKLayers")

    # Silicon waveguide-width strip on the SILC layer.
    strip = lm.Rectangle(x_dim=200, y_dim=0.5, layer=pdk.LAYER.SILC)
    c.add(strip)
    c.Place(strip).at((0, 0))

    # Silicon nitride strip, twice as wide, sitting above.
    siln = lm.Rectangle(x_dim=200, y_dim=1.0, layer=pdk.LAYER.SILN)
    c.add(siln)
    c.Place(siln).at((0, 20))

    # Metal-1 pad.
    pad = lm.Rectangle(x_dim=80, y_dim=80, layer=pdk.LAYER.MTL1)
    c.add(pad)
    c.Place(pad).at((250, 0))
    return c


if __name__ == "__main__":
    PDKLayers().to_gds("pdk_layers.gds")
