Example Scripts#
The scripts/ directory contains ready-to-run example scripts demonstrating the
routing library across a range of scenarios, folder by folder. To pick a script from what you
want to do, see Use Cases: Which Script to Start From.
Simple Test Cases (scripts/simple_test_cases/)#
Most of these scripts use the window case, 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: the map cut into several grids at one voxel size. Includes bifurcation point detection. |
|
Multi-scale version ( |
|
Demonstrates the zone rules: an attractive and a repulsive |
|
Multi-grid version of the zones example; two conduits whose cut ports the packs wall in are left unrouted, as the 3D view shows. |
|
Multi-scale (coarse and fine grids) version of the zones example. |
|
The window case forced through three zones, against the same case routed without them: zones order, tunnels taken, length and detour per conduit. |
|
Demonstrates constraint rules: |
|
A custom length rule on a toggled attribute, routed on one grid and on coarse and fine grids of the large room, with a check of what the search counted and charged. |
|
Routing in a large space with multiple obstacles using the multi-scale approach. Useful reference for real-size assemblies. Matches the Tutorial: Routing in Large Spaces with Obstacles tutorial. |
|
Loads pipe types and specifications from Excel ( |
|
Routes a pipe both outside and through the interior of a single cube, contrasting
the default obstacle behavior with |
|
The window case with the outer volume overriding the composed weights up to 0.1 m
from itself ( |
|
Input data module shared by many test scripts: defines multiple pipe types and their port configurations. Import as a module rather than running directly. |
|
Helpers |
For pathfinding without a CAD file, see the examples of Tutorial: 3D Pathfinding with routing.pathfinding and Tutorial: Smoother Paths with Theta*.
Tees (scripts/route_planning/)#
Conduits tapping other conduits, on the window case. See Tutorial: Tees — Tapping a Routed Conduit.
Script |
Description |
|---|---|
|
Tees in automatic mode: four conduits and seven tees given out of order — one tee at a declared site, one explored every 0.3 m, a tee of a tee — generated, optimized, summarized. Matches the Tutorial: Tees — Tapping a Routed Conduit tutorial. |
|
The same tees with the cycle held by hand: the conduits generated, one picked and optimized; the tees declared on the routed conduits, generated and optimized alone; a tee explored before it is laid, picked near a point, optimized alone. |
|
Inputs shared by the two tee scripts: the window map, the conduits tapped, the tee pipe types and the tees. Import as a module rather than running directly. |
Trays (scripts/parallel_packs/)#
Pipes pooled as trays (parallel=True): side by side on the face they run along, in layers.
See Parallel Packs: Trays.
Script |
Description |
|---|---|
|
A room with a floor, two walls, a ramp up to a mezzanine and obstacles; conduits of
four diameters leaving, crossing and joining it, their ports close together or spread.
|
|
The room and the conduits of |
|
|
|
The large room of |
|
Helpers |
Electrical Harness (scripts/electrical_harness/)#
Routed cables turned into one optimized harness. See User Guide: Harness Generation.
Script |
Description |
|---|---|
|
One |
|
The window inputs with eleven conduits. Import as a module rather than running directly. |
|
Benches for tuning the harness optimizer, not examples. |
Otter Test Cases (scripts/otter_test_cases/)#
More complex test cases based on a multi-part assembly with static and mobile parts, its ports,
pipes and cables read from Excel nomenclatures. Run them from their folder: they open ./data
relative to the working directory.
Script |
Description |
|---|---|
|
Advanced routing with multiple pipe types, clamping set per pipe type, conduits pooled
as trays, and turn penalties. Generates multiple routing solutions and runs simulated
annealing optimization. The first run caches the voxelized CAD in |
|
Multi-grid version of the DAR test case: several grids at one voxel size. |
|
Multi-scale version with hierarchical resolution levels. |
|
Reads the STEP assembly and the Excel nomenclatures into volumes, ports and pipe types. Import as a module rather than running directly. |
Building Test Case (scripts/building_test_case/)#
Routing in a building-scale environment. Run it from its folder: it opens its STEP file relative to the working directory.
Script |
Description |
|---|---|
|
Sets up a 12.5 m room with obstacles and routes two cables across it, inside the room
volume ( |
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 the
harness pipeline ( |
Running the Scripts#
Most scripts find their data from their own folder and run from anywhere, the repository
root included. The industrial cases — otter_test_cases/, building_test_case/ and
grit_test_case/ — open files relative to the working directory: run them from their
folder.
# From the repository root
python scripts/simple_test_cases/window_test_case.py
# The industrial cases, from their folder
cd scripts/otter_test_cases
python DAR_test_case.py
Data files used by the scripts:
data/step/Cas_test_windows_V5.step— the window casedata/step/use_case_labyrinth.stp— the large room with obstaclesdata/json/cubic_volume_model.json— the cube ofcube_case.pyscripts/test_specification_full.xlsx,scripts/test_pipe_types.csv,scripts/test_specifications.csv— the spreadsheets ofspecification_from_spreadsheet.pyscripts/otter_test_cases/data/Maquette_Dessia_1.3.stpand its Excel nomenclatures — the Otter assemblyscripts/building_test_case/routing-room_w_obstacles.step— the building roomscripts/grit_test_case/01 Grit4pi_*.stp— the GRIT product