Grasshopper - Finding the outer boundary of a collection of curves


I have run into a pickle with a collection of curves. The collection is formed of open and closed curves and ultimately I need to hatch everything that is inside of the outer boundary. Going at it by hand will take loads of time, as there are many similar collections I need to work with.

I’d like to find the outer boundary of several collections of curves. Here’s a picture of a said cluster.

Hard to know from a screen shot alone (no geometry posted) but have your tried Region Union?

Test_Curves.3dm (169.7 KB)
Sorry for not providing geometry. I have added it here.
Region Union gives me Empty Curve parameters.

This is an interesting, I will take a look into it.

There is so much more to learn from the geometry than a screen shot.

  • There are only four polylines.
  • They overlap each other (meaning on top of each other),

If a complete closed outline from multiple curves can be resolved (i.e no gaps) then CurveBoolean will work to get the outline (in normal Rhino). This can also be scripted.

CurveBoolean doesn’t produce the results necessary for this work. The curves in the file are divided so that each curve represents an area. For an area, there is 2 curves - the outer and inner curve. These two curves are connected with another curve, then they’re joined together.
This though creates a problem for working with them, as I have yet to find a way to separate them or find a way to draw the outer curve separately. I have tried hatching them, but as curves intersect itself at times and some even overlap, then the amount of work done by hand increases tenfold.
I’ve even gone to Adobe Illustrator to find a way to fill in the curves and reimport them as Hatches, but there seems to be some information loss during the process. (17.7 KB)

This is great, but it seems to round some edges still. (16.1 KB)

P.S. The lines I created between endpoints to close the four polylines (regions) were very short, only 2/10ths of one percent in the worst case and much less in the other three. Seems like an omission in your data?

1 Like

What you are after is a classic Clustering job (where criterion is Curve Containment).

If you are familiar with C# I could post an Entry Level (i.e. no 2nd order nesting (that’s HAC Clustering and is strictly internal stuff) , no // solution, no classes etc etc) take on that matter using a rather “average for the scope” Method (available in R SDK).

1 Like

Another approach could be to use Mesh.CreatePatch from the Rhino API (implemented with Heron’s MMPatch component in the attached definition). This seems to be a special case where Mesh.CreatePatch can absorb the connecting segments to create a mesh with holes. Once you have this mesh, you can extract the naked edges to get cleaned and separated curves that will give you the boundaries you need for hatching. (39.1 KB)


Thank you all for your contribution, all of it helped quite a lot. As the deadline was approaching rapidly I had to go through another route, while I’ll still keep on researching this. What I found was that the sets of lines, which connect the “boundaries”, are duplicate, so that there’s 2 lines at the same place.
If you have any ideas if there’s a way to select all of the lines, which are duplicates. SelDup does that quite well, but it doesn’t select both of the overlapping lines.

In general is not trivial to identify duplicate objects (NOT the same with, say, points, numbers etc). In other words: Clustering with equality criterion. But what equality means in a “higher order” object (like a Brep/Mesh) … that’s another animal.

The “classic” (kind of chimera, mind) way is to define a Class with suitable Properties (öf “primitives” like points, numbers [Length/Area/Valume/etc]) and then do LINQ grouping queries. Like dividing Curves and testing Pt to Pt for equality. The “higher” the order of the object in question the more ambiguous
the result may be.

Given the opportunity see this as well: Checking and finding the identity of solids/breps

Anyway … with regard Curves (a far easier task) this does that (on purpose Curve dupes are used) - prior the Clustering phase (and what comes next: the outer/inner boundaries result):

But still is a 100% black box for you.