Home
Advanced multi-layer routing for GDSFactory layouts — single waveguides, multi-wire bundles, fan-in/fan-out, and obstacle-aware A* pathfinding, built on top of the kfactory geometry kernel with a Rust-based pathfinding engine.
When to use it
Reach for DoRoutes when the routing built into gdsfactory hits its limits:
- the bundle router can't fit because of tight pitches, mismatched port spacings, or non-axis-aligned port orientations,
- you need an obstacle-aware route — a wire or bundle that has to navigate around components placed earlier in the layout,
- you're describing a circuit declaratively from a YAML netlist and want pluggable routing strategies registered on your PDK.
Quickstart
import doroutes as dr
from cspdk.si220.cband import PDK
PDK.activate()
c = dr.pcells.field1().dup()
dr.add_route_astar(
c=c,
start=c.insts["in"].ports["o2"],
stop=c.insts["out"].ports["o1"],
straight="straight",
bend={"component": "bend_euler", "settings": {"radius": 5}},
layers=["WG"], # obstacles to avoid
grid_unit=500, # A* grid pitch (dbu)
)
That's a single waveguide routed between two ports, avoiding everything else
on the WG layer. From here the API scales up to multi-wire bundles, custom
fan-in strategies, and YAML-driven circuit construction.
Where to start
The tutorials are organised in four tiers, walking from the simplest single-wire case up to declarative circuit construction:
Single Routing — one waveguide between two ports.
- Corners Routing — explicit
(x, y)corner points. - Steps Routing — relative
dx/dysteps that survive re-placement. - A* Routing — algorithmic, obstacle-aware.
Bundle Routing — N parallel wires between port arrays.
- Fan-In — the building block: how N spread-out ports get compressed onto a single bundle line, with three strategy choices.
- Bundle From Corners — deterministic bundle shapes via corners or relative steps.
- A* Bundle Routing — obstacle-aware bundles.
Patterns & Integration — applied recipes.
- Bundle Routing Comparison — every bundle strategy on the same shared topology, side-by-side.
- Array Routing — wiring grids of arrayed instances (pad rings, probe cards, switch fan-outs).
- Circuit From Netlist — drive routing from a YAML netlist on the active PDK.
Advanced — under-the-hood mechanics.
- Discretization — how A* projects layout geometry
onto its search grid, and what
grid_unitactually controls.
If you're new, start with Corners Routing — the simplest mental model — and follow the "Next steps" links at the bottom of each tutorial.
Reference
The full API surface (function signatures, types, and docstrings) lives in the API and Types pages.