Divide polyline segments for lines over a specific length

I am looking for a way to divide polylines by segment length. The built-in divide command takes the entire polyline into account, however, I only need to subdivide the segments that are over a specified length, because the additional points from the Divide command end up increasing computation times for the graph analysis I am performing.

I have been attempting to subidvide segments in Grasshopper, but I couldn’t manage to make it work (Divide long curve segments by distance - #2 by bbalbastre). Could someone achieve this with python/ Rhinoscript?

So I would like to add these red points to the polyline (as in this example they subdivide segments that are longer than distance X).

Wish
In the future, perhaps there could be an option for the divide command to only subdivide segments by a threshold length?

You can always get the curve segments yourself and divide them how you want.

– Dale

Yeah, that’s what I am trying to do with Grasshopper. :wink: