Hi,
Is there a way in python to join together a bunch of LINEs that have endpoints touching each other, to form either a ClosedPolyline, or better still a ClosedPolyCurve? (Without having to ‘manually’ iterate through all lines, and search at their endpoints)
Note that this need be done in Batch as having an operator manually select the lines and then have them processed is not an option.
In some cases a LINE will turn out to be an Inner Edge. (LINEs 0 & 9)
eg: 0 through 9 represent individual LINEs
I need to end up with 3 ClosedPolyCurves
If there is a Rhino command that will at least just join together LINEs that have endpoints touching - then I could create code to “sort out” points with >2 lines emanating from them.
Thanks in advance,
Zoltan
FWIW, I’m totally new to Rhino and have no clue about high-level stuff like Grasshopper.
(But GIS data structur programming I’m “OK” with)
Hi @Rhino131
Take a look at CurveBoolean with DeleteInput=All, CombineRegions=No and then select the AllRegions option. In the second step, just press Enter for all available regions - it can be easily be macro’ed if you want to automate it.
HTH, Jakob
Hi Jakob,
Thanks for this pointer.
I will look, but running this in GUI is not an option
I will see if there is a RunCommand option/variation that does not require operator input.
Hi @Rhino131
Sorry - didn’t notice the “Scripting” category My bad! Hopefully you’ll figure something out or get help from one of the begger brains!
-Jakob
Assuming the internal loops are quads, you can implement the RhinoCommon Mesh.CreateFromLines method and draw a PolylineCurve through the vertices of the resulting mesh faces. Here’s a quick GHPython example demonstrating this logic (edit: Added triangulated NGons example):