Combine similar segments in polyline


Just wondering if someone knows of a simple/straightforward way to take a polyline and run through all of its segments, see if any of them are connected to each other and going in the same direction, and then replace those portions with a single segment. By polyline, this would be a collection of degree 1 curves connected together.

I imagine this has to be scripted but if there is a native gh way to do this then that would be even better.


Discontinuity sort of does that.
You can use the discontinuity points to build a new polyline.

The Polyline class also has several methods that might be relevant:

1 Like

Thanks @maje90 @dale and @AndersDeleuran

I ended up using the MergeColinearSegments to achieve what I was looking for. I wasn’t quite sure how to run CleanUp on ‘Polyline Curves.’

1 Like