# Sorts matrix of points along the curve from its starting point

Hello everyone, I am a new member of the forum, first of all I want to thank the developers and all the users for their genius and advice and for the passion you dedicate to your work. I was writing a script with Rhinoscript but I can’t find a method to get an array of points ordered along a polyline from its starting point.
I tried to use SortPoints but selecting all the points I get an order doesn’t seem to make the solution. I appreciate your suggestions in this regard.

You can use the function CurveLength() to get the length along the curve from each point to the curve start point. CurveLength() has an optional argument subdomain - so to that you would supply the interval from the curve domain start point to the parameter that represents the point on the curve in question (using CurveClosestPoint() to get the parameter).

So the procedure is for each point, get the parameter on the curve at the point, then the length from that point(parameter) to the start of the curve. Then you can sort that list according to length.

You might be able to avoid the above by using SortPointList() which

“Sorts an array of 3-D points so they will be connected in “reasonable” polyline order.”

But the first procedure will be guaranteed to work under all conditions, whereas the second might not…

I hadn’t thought the concept was similar to CurveArcLengthPoint. The script was missing the last step and later I will try to extrapolate the order. Thanks for the help Mitch Have a nice day