Example Scripts#
The scripts/ directory contains ready-to-run example scripts demonstrating the
routing library across a range of scenarios. All scripts are self-contained and can be
run directly after installing routing.
Simple Test Cases (scripts/simple_test_cases/)#
These scripts use a small window-frame assembly (data/step/Cas_test_windows_V5.step)
and are the best starting point.
Script |
Description |
|---|---|
|
Start here. Full routing workflow: load STEP file, define pipe types and ports, build a CadMap, run pathfinding (A*), visualize results, run optimization. Matches the Tutorial: Routing Pipes Through a CAD Assembly tutorial. |
|
Multi-grid version of the window test case. Uses
|
|
Multi-scale version ( |
|
Demonstrates all four |
|
Multi-grid version of the shaped zones example. |
|
Multi-scale (3-level hierarchy) version of the shaped zones example. |
|
Demonstrates constraint rules: |
|
Routing in a large space with multiple obstacles using the multi-scale approach. Useful reference for real-size assemblies. |
|
Input data module shared by many test scripts: defines multiple pipe types and their port configurations. Import as a module rather than running directly. |
Pathfinding Examples (scripts/pathfinding/examples/)#
These scripts use the standalone routing.pathfinding module directly — no CAD file
or design rules required.
Script |
Description |
|---|---|
|
Loads a pre-computed numpy map ( |
|
Side-by-side comparison of Theta* and A* on the same 3D obstacle map. Displays path cost, length, and interactive 3D visualization with Plotly. |
Otter Test Cases (scripts/otter_test_cases/)#
More complex test cases based on a multi-part assembly with static and mobile parts.
Script |
Description |
|---|---|
|
Advanced routing with multiple pipe types, pooling rules, and turn penalties. Generates multiple routing solutions and runs simulated annealing optimization. |
|
Multi-grid version of the DAR test case using |
|
Multi-scale version with hierarchical resolution levels. |
Building Test Case (scripts/building_test_case/)#
Routing in a building-scale environment with both pipes and cables.
Script |
Description |
|---|---|
|
Sets up a room with obstacles, configures design rules, and routes both pipes and cables. Demonstrates mixed pipe/cable routing. |
GRIT Test Case (scripts/grit_test_case/)#
Script |
Description |
|---|---|
|
Complex routing scenario with many interconnected cables. Extracts ports from CAD geometry automatically, creates specifications programmatically, and runs multi-iteration optimization. |
Running the Scripts#
All scripts expect to be run from the repository root or the script’s own directory. Most scripts use relative paths to data files:
# From the repository root
python scripts/simple_test_cases/window_test_case.py
# Or from the script's directory
cd scripts/simple_test_cases
python window_test_case.py
Data files used by the scripts:
data/step/Cas_test_windows_V5.step— window frame assembly (simple test cases)data/step/inner_window.step,data/step/outer_window.step— inner/outer window bodiesscripts/grit_test_case/grit_cad.npy— pre-computed occupancy grid for pathfinding examplesscripts/otter_test_cases/data/3DTUYDessia.stp— Otter assembly
Optional dependencies (not installed by default):
open3d— required for03_view_map.pyvisualizationplotly— required for04_theta_star.pyvisualization