Polyline Healer
Heals nearly closed polylines: extends every segment at both ends by Tolerance, builds boolean regions from the extended lines and returns the largest unioned outline (holes and separate islands are dropped). Non-polylines are returned unchanged.
Overview
Heals polylines by extending segments and creating boolean regions.
Inputs (2)
- Polyline (Curve): Polyline to heal
- Tolerance (Number): Extension factor
Outputs (1)
- Result (Curve): Healed curve
Method, assumptions and simplifications
The same notes appear in the component's Info output.
Method
- Each input curve that is a polyline is split into segments; each segment longer than 0.001 is extended at both ends by Tolerance (an absolute length in model units, default 1.5).
- The extended lines are intersected into closed regions with Rhino Boolean regions in the polyline best-fit plane (World XY if fitting fails), the regions are unioned, and the curve with the largest area is returned as the healed outline.
- If anything fails (not a polyline, no regions), the original curve is returned unchanged.
Assumptions
- Input is a nearly closed planar outline with small gaps or overshoots, smaller than Tolerance.
Simplifications and limits
- Only the outer boundary is kept: holes and separate islands are dropped. Tolerance also lets short neighbouring segments extend past each other, which can add spurious regions if it is too large.
Workflow
- Imported CAD or GIS outlines (plots, building footprints) -> Polyline; healed curves -> region, offset or extrusion components.