Fix fabrication verification and routing diagnostics follow-up

This commit is contained in:
Jan Petykiewicz 2026-11-29 00:09:54 -08:00
commit cea23ef1b4
2 changed files with 248 additions and 76 deletions

View file

@ -1,4 +1,7 @@
from inire import NetSpec, ObjectiveWeights, Port, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route
from dataclasses import replace
from inire import NetSpec, ObjectiveWeights, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route
from inire.layout import route_profiles, verify_export_grid
from inire.utils.visualization import plot_routing_results
@ -8,30 +11,28 @@ def main() -> None:
bounds = (0, -50, 100, 50)
options = RoutingOptions(
search=SearchOptions(bend_radii=(10.0,)),
# Isolate the lattice detour and use the fixed net only for clearance checks.
# Isolate the lattice detour.
objective=ObjectiveWeights(danger_weight=0.0),
topology=TopologyOptions(mode="off"),
)
print("Routing initial net...")
problem_a = RoutingProblem(
bounds=bounds,
nets=(NetSpec("netA", Port(10, 0, 0), Port(90, 0, 0)),),
)
results_a = route(problem_a, options=options).results_by_net
fixed = results_a["netA"]
fixed_net = NetSpec("netA", Port(10, 0, 0), Port(90, 0, 0))
detour_net = NetSpec("netB", Port(50, -20, 90), Port(50, 20, 90))
problem = RoutingProblem(bounds, (fixed_net, detour_net))
fixed = route(replace(problem, nets=(fixed_net,)), options=options).results_by_net["netA"]
assert fixed.is_valid
print("Routing detour net around locked path...")
problem_b = RoutingProblem(
bounds=bounds,
nets=(NetSpec("netB", Port(50, -20, 90), Port(50, 20, 90)),),
static_obstacles=fixed.locked_geometry,
replay = replace(
options, search=replace(options.search, node_limit=0), refinement=RefinementOptions(enabled=False),
)
results_b = route(problem_b, options=options).results_by_net
assert results_b["netB"].is_valid
problem = replace(problem, initial_paths={"netA": fixed.as_seed()})
results = route_profiles(problem, [(("netA",), replay), (("netB",), options)])
export = verify_export_grid(problem, results, grid=1)
if not export.is_valid:
raise ValueError(export.reports_by_net)
results = {**results_a, **results_b}
fig, _ax = plot_routing_results(results, [], bounds)
fig.savefig("examples/03_locked_paths.png")
print("Saved plot to examples/03_locked_paths.png")

View file

@ -20,7 +20,7 @@ After [installing Inire](../README.md#install), run the example scripts with Pyt
![A second waveguide makes a U-shaped detour around the left end of a fixed straight waveguide.](03_locked_paths.png)
The first call routes a straight waveguide. The second uses its polygons as keepouts, so the new connection passes to the left of the fixed route. Run [`03_locked_paths.py`](03_locked_paths.py) to reproduce the detour. To hold a route fixed in your own design, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route).
The first call routes a straight waveguide. `route_profiles` replays and reserves it, so the new connection passes to the left of the fixed route. The example verifies both routes together on the export grid. Run [`03_locked_paths.py`](03_locked_paths.py) to reproduce the detour. To hold a route fixed in your own design, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route).
<a id="fit-bends-to-available-room"></a>