_Curvethroughpt vs Rhino.AddInterpCurve

Ran into an issue with fitting a line to an array of 3D points. I have e.g. an array of 350 points, which form a line that curves with depth. I do not want to fit a straight line between each point, but to fit a line with a tight degree to the entire array. This can be done interactively for the array(_Curvethroughpt) and I get a neat line that fits the points, as well as starting and terminating properly. When I try to use Rhino.AddInterpCurve in Rhinoscript form and specify the array, I get a line that both deviates in degree but also insists on looping back to the start. Yes, the array has a single point at the end which is back near the start coordinates of the array (similar to start point) but I shouldn’t need to have to order the points/sort the array for the method to work. Do I need to use the tangency conditions to limit the start and end of the line to get the same result as _Curvethroughpt? If so, any ideas on how to do this easily?

Yes, you do, I think… Did you try with Rhino.AddInterpCurveEx? Don’t know if it does any better. There is also Rhino.SortPointList, which “Sorts an array of 3-D points so they will be connected in “reasonable” polyline order.”

As a last resort, you can always script Rhino.Command("_CurveThroughPt") I guess.

–Mitch

facepalm should have thought a method like that might exist - Rhino.SortPointList was PERFECT. Everything’s functioning as it should now, using AddInterpCurve, without any tangency conditions etc. Many thanks for the help!