Join array of lines in RhinoCommon


#1

I have array of lines. want to join them into a polyline or as a curve… which method I should use?

I can remember I had selected many curves, which were connected one after another to the end point and then creating open curve or closed curves. If it is not in RhinoCommon, then I had used my own method or in Grasshopper scripting. I totally forgot.

If it is in RhinoCommon then please let me know how to do it.


#2

Are all the lines connected to each other?
And is it not a polarArray?

Lines should be connected because if it is a LinearArray the lines will not be conected. If it is a polarArray. The lines are ALL connected in the middle. Then its also not possible to join them.


#3

Thanks for the reply ! lines are connected one after another, so they should be joined as closed curve or as an open curve… but I have forgot the method in rhino common.
.

I know polar array will not work


#4

Are they line objects or line curves? If they are line curves, they should be joinable with Curve.JoinCurves([line_list]). If they are line objects then you could convert them to line curves (line.ToNurbsCurve()), then join.

Or you could get their start/end points, remove duplicates, and then create a polyline object from them…

–Mitch


#5

Thanks Mitch ! It solved my problem !
Many thanks!


#6

Great to hear. In the original post it was not clear you were talking about RhinoCommon :slight_smile:
Glad Mitch was able to help.