Sort points along a line from a given point

Hello everyone! I’ve been struggling for several days with the task of sorting points along a combined line, starting from a defined point. I tried several sorting methods from the forum, but they didn’t work for me. Can someone tell how to solve this problem?

SpeakTrain_D_16send.dyn (157.7 KB)
Speaktrain_1.wire (35.6 KB)

Try a Curve.ParameterAtPoint And then a List.SortByKey node, using the points and a Polycurve built from all of the curves. If they go in the wrong order try using a ‘Curve.Reverse’ node first to turn things around.

Yes, I did, but Curve.ParameterAtPoint for some reason did not work.

SpeakTrain_D_19send.dyn (163.1 KB)

What is the error message you get on the Curve.ParameterAtPoint node?

Warning:Curve.ParameterAtPoint operation failed. Could not find parameter at Point.

You’ll need to identify why that happened.

@Igor.Matyukhin I had a quick look. When I change your Curve.ParameterAtPoint node to work on @L1 for the point input (instead of @L2, which doesn’t make any sense to me anyway?), then it seems to work?
Please let me know if this solves the issue.

This does not show an error, but it does not work correctly. The numbering is still not uniform. The points on the middle and lower sections of the polyline are still numbered reverse. I continue to look for how to reset the numbering and to start a new one …

I tried to reverse sections of the polyline, but the numbering did not change, because it is tied to a set of points.

@Igor.Matyukhin Seems straightforward once you get the sequence of the curves right

alias.dyn (11.3 KB)


@Igor.Matyukhin I found the issue in your original script (the post from Vikram might still be valid, though): it’s a tolerance issue. The distance of those points causing the null results to the polycurve is not 0, but something like 0.00000123. Therefore Curve.ParameterAtPoint fails for those inputs. When changing “Settings - Geometry Scaling” to large, it seems to work fine for me.

Thank you, Vikram_Subbaiah and Michael-GG, I tried both of your methods, both work!