Create Closed Curve from Segments?

Hi all. I do need to find a way to create closed curves from a bunch of segments that some to overlap, some not. In this example I do need to remove the red ends, so the other remaining segments can close.

Remove_Ends.gh (12.1 KB)

Have you tried region union?

Yes, and I do get: “Solution exception:Object reference not set to an instance of an object.”

There are better ways:

Remove_Ends VR 1.gh (29.9 KB)

If you want to try… you can first pass your curves through line and arc containers, Clean Tree Now you have two streams and you can see how you move from there. Maybe intersect the arcs with the lines to only get the relevant intersections? Or try to sort and correct the direction of the arcs, and then Connect Curves with position set to 0?

I am not fan of the Surface Split above. But it seems to work.

You can get the result with a single component called Geometric Cycles which comes with Heteroptera plugin.

There a number of plug-ins with this functionality. Parakeet for example has Network Regions:

I’m aware of that. Flexibility has similar components as well and probably a few others.

Anyway, my point was that he can achieve the same result in a simpler way using a single component, ofc if using a plugin works for him.

This is one of things I hate about GH1. So many plug-ins covering the same holes in core functionality junking up my panel real estate and confusing my context double-click searches.

I totally agree with this, but also it is a positive in this because for the same operation where one solution fails, other one can solve-it. I do tried over the time all the “Curve Region” components that I can find and I do need to switch continuously between them as in some cases one of them works meantime the other do fail. Same here. This curves are the result of the Make2D operation as I do search for a solution to extract the inside-outside boundaries of the 3D parts. For this operation I do tested whatever solution I was able to find and all of them do fail in some form or shape. Same thing, one solution works in some cases but fails in other cases. I do need to use this in production and the last thing I do need is to debug components when they do fail to work and I do have deadlines to met.

This won’t help you in Grasshopper 1, but the Grasshopper 2 Curve Boolean component handles this even without any seed points.

Good to know for the future when I will upgrade. One component that also I would love to see in Gh2 is a component to extract the inside-outside boundaries of the BREPs as NURBS curves. Like Mesh Shadow but one that can output NURBS curves instead on small segments for arcs and circles. This is very useful for CNC machining parts where I do need to cut the overall in-out shape of the 3D parts. Right now the only solution that works is producing segmented curves but I didn’t found any reliable solution to extract the overall NURBS curves from BREPs.

I’m not 100% clear on this. The Mesh Shadow component operates on silhouettes. Is that what you mean by “boundaries”? I merely ask because the “B” in Brep stands for “boundary” but those would be the trims and edges of the faces that make up the brep.

Yes, I do need the overall shapes both inside and outside like the MShadow does, but as NURBS curves instead of small segments. Like the shadow of the object projected on a surface. In this case I used Make2D which produces a bunch of curves that I do need to sort and eliminate all the curves that are not passing through the parts.

Silhouette exists as a GH2 component, but it may not give as clean an output for breps as it does for meshes. You’ll have to test it and file specific reports. It is also tightly linked to camera views, it doesn’t take a direction and a plane

It may make more sense to improve the Mesh Shadows component to also take surfaces, and output nurbs whenever appropriate.

Another native Grasshopper solution if you were intent on taking the intersection route:


Remove_Ends VR 2.gh (47.1 KB)

Good suggestion, so I worked a bit on that.
Few components needed. Regards, Eef



Remove_EndsEW.gh (17.6 KB)

Fennec components do have also a Silhouette Parallel that produces good results but unfortunately it is also producing additional curves that I don’t need.

This works good it this situation, but I do need a more general solution.

I don’t think there is going to be a generalization without some restrictions like regions (curves in a plane) and only extentions without dirty intersections (like were the fillet curves to intersect adjacent lines twice).

@Cumberland An improvement on my first solution:


Remove_Ends VR 3.gh (17.8 KB)

which can deal with the cirumstance when the outer loop of curves cannot form a clean boundary surface:

This should be a general purpose replacement for Geometric Cylces and the like.

This was brought to my attention before but I dismissed it as myth: under cirumstances Deconstruct Brep will return joined curves instead of individual edge segments?!


Right. So my moron self could have dealt with this more simply:


Remove_Ends VR 4.gh (25.4 KB)