Trim and Join/Blend Together Separate Closed Curves

Hi all,

I want to trim and join separate closed curves that are on the same Z-plane. My current script works if I have two curves, but breaks down when I have three or more curves that I want to trim and blend together. I’m using circles and Trim with Region to trim the curves and then Blend them together using Blend Curve.

Right now, I’m having trouble getting the circles to trim all of the necessary sections, as shown below. First set of curves, middle closed loop trims in one direction but not the other. I assume this has something to do with my poor data tree management.

Additionally, I see I’m going to have another problem down the road once I’m successful in trimming the problematic curve, as I’m using Unflatten Tree to move everything the curves back into their respective branches. (Edit: Figured part of this out. Use Shift Path to move back down one level.)

I’m assuming there are better method than what I’m currently doing, but I’m not 100% sure what else to do for the moment. Any ideas? Attached my GH file as well.

trim and join separate closed curves.gh (51.6 KB)

Update: Figured out a sort of hack, but I’m not super convinced by it. Extrude the circles and then Trim with Brep instead of Trim with Region. Seems very hack-y and I’d rather learn a proper method. (See picture below.)

Also, figured out I can just simply use Shift Paths to move the curves back down one level. Still need to figure out how to select each one in order to blend them properly though.

trim and join separate closed curves - rev2.gh (61.7 KB)

Update 2: So I think I managed to sort myself out, so I now feel kind of dumb for creating a post, but I’d like to see other people’s solutions to my problem for learning purposes.

I stumbled upon this thread and happened upon this deus ex machina component: Curve Nearest Object. Placed points on each curve, sorted them along an arbitrary circle, and then used said component to then sort the list. Just kind of magically worked…

trim and join separate closed curves - rev3.gh (62.5 KB)

1 Like

Don’t feel dumb. This can turn out to be a useful post for others with a similar problem.

// Rolf

Thanks. Just goes to show that I should’ve looked into things a little bit more. But also that I’m actually learning and improving.


Instead of trim regions, seems it would be easy to do region union (I repeated twice to remove internal islands). After that can use extend curve with negative values to trim, and connect curves. Or could fillet sharp corners instead, but I think the region union seems perfect for the task.

1 Like