Initial buildout
This commit is contained in:
parent
34615f3aac
commit
84b76d0f6a
1 changed files with 25658 additions and 25 deletions
32
examples/01_simple_route.py
Normal file
32
examples/01_simple_route.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
from inire import NetSpec, Port, RoutingOptions, RoutingProblem, SearchOptions, route
|
||||
from inire.utils.visualization import plot_routing_results
|
||||
|
||||
|
||||
def main() -> None:
|
||||
print("Running Example 01: Simple Route...")
|
||||
|
||||
bounds = (0, 0, 100, 100)
|
||||
netlist = {
|
||||
"net1": (Port(10, 50, 0), Port(90, 50, 0)),
|
||||
}
|
||||
problem = RoutingProblem(
|
||||
bounds=bounds,
|
||||
nets=(NetSpec("net1", *netlist["net1"], width=2.0),),
|
||||
)
|
||||
options = RoutingOptions(search=SearchOptions(bend_radii=(10.0,)))
|
||||
|
||||
run = route(problem, options=options)
|
||||
result = run.results_by_net["net1"]
|
||||
if result.is_valid:
|
||||
print("Success! Route found.")
|
||||
print(f"Path collisions: {result.collisions}")
|
||||
else:
|
||||
print("Failed to find route.")
|
||||
|
||||
fig, _ax = plot_routing_results(run.results_by_net, [], bounds, netlist=netlist)
|
||||
fig.savefig("examples/01_simple_route.png")
|
||||
print("Saved plot to examples/01_simple_route.png")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Reference in a new issue