3.8 KiB
Routing examples
After installing Inire, run the scripts from the repository root. They save PNGs in examples/ by default. Arrows at ports show the direction the route leaves its source or enters its target.
python examples/01_simple_route.py
Start with a connection
| Script | What to look for | Preview |
|---|---|---|
| Simple route | A straight waveguide connects two eastbound ports 80 units apart. | Straight connection |
| Port headings | Two routes connect ports just 20 units apart. The lower route departs east and arrives west. The middle route departs north and arrives south. Both need room to turn. | Two heading reversals and a straight route |
Route around fixed geometry
The first call routes a straight waveguide. The second uses its polygons as keepouts, so the new northbound connection passes to the left of the fixed route. Run 03_locked_paths.py to reproduce the detour. To hold a route fixed in your own design, follow the route reuse workflow.
Fit bends to available room
Run 04_sbends_and_radii.py to compare a 5-unit shift made with an S-bend and an 80-unit shift made with two 90-degree bends. Both routes leave and arrive heading east. The two 90-degree turns use radius 10 from the allowed radii of 10 and 30.
| Script | What to look for | Preview |
|---|---|---|
| Bend proxies | Compare three separate runs. The middle route has round physical bends and uses rectangles to check for collisions during search. The bottom route uses a right-angle polygon for both. | Arc, box proxy, and custom bend |
| Custom bends | Two runs connect the same ports. Compare the standard arc with the custom right-angle bend. The shaded box at the turn shows the custom bend's search proxy. | Two bends at the same corner |
The dashed outlines show the shapes used for collision checks during search. The solid outlines show the physical waveguides.
Diagnose congestion or an incomplete route
| Script | What to look for | Preview |
|---|---|---|
| Congestion resolution | The eastbound route bends around the lower ends of two straight vertical routes. | Detour around vertical routes |
| Best-effort result | At node_limit=3, the route stops after its first turn with outcome partial. At 500 it reaches the target heading west. |
Three versus 500 nodes |
| Fan-out | Ten routes pass through one opening in a wall and spread out to widely spaced targets on the right. | Ten routes through one opening |
The fan-out script includes a callback that can adjust the search weight for later iterations. With these settings, the automatically generated starting paths already pass verification. For a multi-net example built on the public API, try the two-crossing layout.
Route a challenging layout
Compare each board's inputs with its verified routes in the advanced gallery. It covers mixed widths, competing passages, preplaced crossings, and both heading configurations of the nine-net Terminal-Bench board.

