"""Ports and your first route.

A port is a named connection point on a cell. The auto-router can
connect any two ports — it picks Manhattan or curved geometry based on
the port directions, with bend radius drawn from the route layer's
design rules.
"""
import lumicron as lm
import lumicron.pdks.elyon_demo.all as pdk


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

    c.add(lm.PORT(
        "in", position=(0, 0), direction=0,
        width=0.5, layer=pdk.LAYER.SILC,
    ))
    c.add(lm.PORT(
        "out", position=(400, 200), direction=180,
        width=0.5, layer=pdk.LAYER.SILC,
    ))

    c.Route(c.ports["in"], radius=10).to(c.ports["out"])
    return c


if __name__ == "__main__":
    PortsAndRoute().to_gds("ports_and_route.gds")
