Corners Single Route
add_route_manual builds a route that passes through a list of
explicit corner points, given in absolute coordinates in microns.
Reach for it when you want full control over
the route shape — for example, to keep a waveguide inside a routing
channel, match a specific floorplan, or reproduce a hand-drawn path.
This is optical routing: bends are bend_euler at the PDK
minimum radius (5 µm for gdsfactory.gpdk), so the curvature is
continuous at each joint and the mode mismatch stays inside the loss
budget.
Imports
import gdsfactory as gf
from gdsfactory.gpdk import PDK
import gdsfactoryplus as gfp
dr = gfp.routing.doroutes
PDK.activate()
Z-Detour Through Four Corners
We route from field1's o1 port (the routable end of the input
sub-instance, promoted onto the cell's public port API) to o2 (the
output side) through four corners. The detour goes east, then up,
then back west, then down to the destination — the kind of shape
you'd write when the floorplan needs the route to backtrack around
an obstacle or stay inside a defined channel.
Corners are absolute (x, y) points in microns. start / stop
accept a port directly — the router pulls the position out itself.
c = gf.Component()
ref = c << dr.pcells.field1()
start = ref.ports["o1"]
stop = ref.ports["o2"]
# Corners are absolute (x, y) points in microns. Field1 is 50x50 um.
corners = [
(44.0, start.dcenter[1]), # head east at the input y
(44.0, 35.0), # turn north
(1.0, 35.0), # turn west
(1.0, stop.dcenter[1]), # turn south to the output y
]
dr.add_route_manual(
component=c,
start=start,
stop=stop,
corners=corners,
straight="straight",
bend={"component": "bend_euler", "settings": {"radius": 5}},
)
dr.util.show_cell(c)
Next steps
- If you'd rather describe the route as a sequence of relative moves (reusable across placements), see Steps Routing.
- The bundle (N-wire) version of this routing style is
add_bundle_manual(corners=...), demonstrated in Array Routing. - Don't want to spell the corners out yourself? Let A* find them in A* Single Route.