Cross-sections and routing · 5 of 6
Routing with paths
Connecting two ports with a waveguide is routing. A path drawn with a cross-section makes a simple route: list the corners, and let bend_radius turn every corner into a bend.
The corners come from the ports. A port is a point, so its coordinates are p.x and p.y, and a list of points can mix ports and computed points:
define p = a.marker.output[0]
define q = b.marker.input[0]
define mid = (p.x + q.x) / 2
shape path with [p, (mid, p.y), (mid, q.y), q], strip, bend_radius = 10um as route
place route at self.originThe path's points are already in the cell's coordinates, so route is placed by its origin at the cell's origin.
A cross-section can set the tightest bend it allows with with min_radius = 10um. Every shape drawn with it is checked: a path whose bend_radius is smaller, or that turns at sharp corners without one, is an error.
Exercise
Route the output of a to the input of b with a strip path: along the x axis to halfway between the two ports, up to the height of b, then on to b, with bends of radius 10 µm. Compute the corners from the ports, so that the route still fits when b moves: Submit also tries other values of dy.