Working out the order of a list of lines

python

#1

Hi,

I have an issue with a Dynamo graph I’ve produced and am hoping for advice on the best way of accomplishing something.

The graph which intersects a topography with a line (using the Geometry.Intersect node) and produces a list of NurbsCurves which follow the topography.

This works fine, and the NurbsCurves it produces are contiguous across the topography, but the list resultant list of NurbsCurves are not in order.

For my idea to work, I need them in order from first to last.

So, what’s the best way of working out the order?

I could use Python to examine all of the start and end points of the Curves and compare them to each other to work out the order, but is there a better / easier way to do this?

I’d appreciate some advise.

Thanks


#2

Hi @Kevin.Bell ,
one little trick that I’ve been using to do that is to create a poycurve by joining the curves, then querying the curves of that polycurve. That will sort your curves:


#3

Nice! I’ll give that a try… Thanks.