Fix fabrication verification and routing diagnostics follow-up
This commit is contained in:
parent
1eed75ff5a
commit
cea23ef1b4
1 changed files with 248 additions and 76 deletions
|
|
@ -90,7 +90,7 @@ For a multi-net layout, apply the validity check to every net you intend to expo
|
|||
## Reuse an existing route
|
||||
|
||||
- **Give the router a route it can move.** Put `result.as_seed()` in `initial_paths` under the net's ID. A seed uses the current start port, width, and geometry settings. Search can follow a partial seed from the first iteration and can leave it to find another approach. To build a hint from turns and straights, see the [path seed reference](api-reference.md#path-seeds).
|
||||
- **Hold a route fixed.** Check `result.is_valid`, then add `result.locked_geometry` to `static_obstacles` while routing other nets. The next run applies its own clearance to those polygons.
|
||||
- **Hold a route fixed.** Check `result.is_valid`, then replay its seed in the first group of `route_profiles` with search and refinement disabled. Later groups respect it as a distinct net, including at zero clearance. Verify the groups together before [exporting the layer](fabrication.md#check-the-export-grid).
|
||||
|
||||
When terminal headings are inferred, store the two selected ports alongside the seed, width, and geometry options. Use those exact ports to replay the route and export the same polygons.
|
||||
|
||||
|
|
@ -123,30 +123,30 @@ for net in verified_nets:
|
|||
assert result.locked_geometry == chosen.results_by_net[net.net_id].locked_geometry
|
||||
```
|
||||
|
||||
Route a straight net, then use its polygons as keepouts in a second routing problem. The second net has to detour around one end of the fixed route.
|
||||
Route a straight net, then reserve it while routing another net on the same layer. The second net has to detour around one end of the fixed route.
|
||||
|
||||
```python
|
||||
from inire import (
|
||||
NetSpec, Port, RoutingOptions,
|
||||
RoutingProblem, SearchOptions, route,
|
||||
)
|
||||
from dataclasses import replace
|
||||
|
||||
from inire import NetSpec, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, route
|
||||
from inire.layout import route_profiles, verify_export_grid
|
||||
|
||||
bounds = (0, -50, 100, 50)
|
||||
options = RoutingOptions(search=SearchOptions(bend_radii=(10,)))
|
||||
first = RoutingProblem(
|
||||
bounds=bounds,
|
||||
nets=(NetSpec("fixed", Port(10, 0, 0), Port(90, 0, 0)),),
|
||||
)
|
||||
fixed = route(first, options=options).results_by_net["fixed"]
|
||||
fixed_net = NetSpec("fixed", Port(10, 0, 0), Port(90, 0, 0))
|
||||
detour_net = NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90))
|
||||
problem = RoutingProblem(bounds=bounds, nets=(fixed_net, detour_net), clearance=0)
|
||||
fixed = route(replace(problem, nets=(fixed_net,)), options=options).results_by_net["fixed"]
|
||||
assert fixed.is_valid
|
||||
|
||||
second = RoutingProblem(
|
||||
bounds=bounds,
|
||||
nets=(NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90)),),
|
||||
static_obstacles=fixed.locked_geometry,
|
||||
replay_options = replace(
|
||||
options, search=replace(options.search, node_limit=0), refinement=RefinementOptions(enabled=False),
|
||||
)
|
||||
detour = route(second, options=options).results_by_net["detour"]
|
||||
assert detour.is_valid
|
||||
problem = replace(problem, initial_paths={"fixed": fixed.as_seed()})
|
||||
results = route_profiles(problem, [(("fixed",), replay_options), (("detour",), options)])
|
||||
export = verify_export_grid(problem, results, grid=1.0)
|
||||
if not export.is_valid:
|
||||
raise ValueError(export.reports_by_net)
|
||||
```
|
||||
|
||||
To compare the two paths on a plot, see the [fixed-route example](../../examples/README.md#route-around-fixed-geometry).
|
||||
|
|
|
|||
Loading…
Reference in a new issue