Automated MEP (Mechanical, Electrical, Plumbing) system layout and clash detection for Grasshopper/Rhino.
- Multi-system layout generation with configurable parameters
- 3D clash detection with priority-based resolution
- Automatic bend generation to resolve conflicts
- Room-based branch routing with intelligent path finding
- Polygon centerline extraction using skeletonization algorithm for optimal routing paths
src/- Core Python modulesmain.py- Main entry pointclash_detector.py- 3D clash detection logicsystem_item.py- System component definitionsrooms.py- Room and branch routing logicrow_builder.py- Row layout generationsystem_definitions.py- System configurationbbox_utils.py- Bounding box utilitiespolygon_centerline.py- Polygon centerline extraction using skeletonization
gh_python_dev/- Grasshopper integrationgh_loader.py- Loader script for Grasshopper
remote.gh- Grasshopper definition filePOLYGON_CENTERLINE.md- Detailed documentation for centerline function
- Clone the repository
- Update the path in
gh_python_dev/gh_loader.pyto match your local directory - Open
remote.ghin Grasshopper - Run the Python component to execute the clash detection
- Python 3.x
- Rhino 7+ with Grasshopper
- Required Python packages:
numpy- For polygon centerline functionscikit-image- For skeletonization algorithmscipy- For scientific computingmatplotlib- For polygon rasterization
Install dependencies:
pip install numpy scikit-image scipy matplotlibThe repository includes a powerful polygon centerline extraction function that uses morphological skeletonization to find the medial axis of polygons. This is particularly useful for:
- MEP Routing: Finding optimal paths through corridors and rooms
- Path Planning: Generating centerlines for pipe/duct/cable routing
- Spatial Analysis: Understanding room structure and topology
from src.polygon_centerline import polygon_centerline
# Define a corridor polygon
corridor = [(0, 0), (50, 0), (50, 3), (0, 3), (0, 0)]
# Calculate centerline
centerline = polygon_centerline(corridor, resolution=100)
# Result: list of (x, y) points along the centerline
print(f"Generated {len(centerline)} centerline points")For detailed documentation, see POLYGON_CENTERLINE.md
To run examples:
python examples_polygon_centerline.pyTo run tests:
python test_polygon_centerline.py