Trim curve with another curve

Hello, GH community.
I have a closed curve and two curves ( Those two curves are outside of the curve, see pic, a.).
I want to get the desired result ( see pic, b.-curve in red color). What is the easiest and most convenient way to do this in GH? I tried many ways but have not figured out how to trim the closed curve with those two curves. Thx

Hello,

After ordering the open curves around the closed one, and flipping their end points accordingly, this is a game of projecting the points and extract the correct subcurves. You could skip the first part if your curves are correctly drawn and referenced, but this should work for any amount of curves.

You get three open curves as a result in this example.

TrimClosedCurve.gh (13.2 KB)

Another solution with Trim with Breps that doesn’t require sorting.

TrimClosedCurve2.gh (8.2 KB)

Thank you a lot for your quick reply, Teddy. Both solutions work perfectly. I will examine it in more detail )))

Check this as well

split & join.gh (10.3 KB)

3 Likes

Thank You, Khaled. Another interesting approach indeed. This is the way I was trying to solve this issue but riched only the point “Region Union”, after that I could not figure out how to cull the top parts of the curve )))
An instant question… Is it possible to sweep any profile along the resulting curves? ( actually, I wanted these solutions because of floor molding). Thx again :pray:

Teddy, is it possible to use sweep 1 component or something like that along the resulting curves?

Have a look at this thread.
Hopefully the sharp corners don’t mess up the sweep, it will depend on your section I guess.

Yep, Teddy, it works with any shape (profiles) regardless of the sharp corners… Here the important thing is correctly using the “ORIENT” component ( correctly placing the profile curve, face, or brep onto starting points of the rail, which we can get using the “PERP FRAME” component with parameters 0). :slightly_smiling_face:

1 Like

For the sweep , the one from Heteroptera plugin works better

split & join2.gh (19.2 KB)

Thx, Khaled. I will look into it. :pray:

You were right, Teddy, not in the cases we discussed here, but when I try to use Sweep 1 on a rectangle (the rectangle as rail) the corners are not joined(welded) correctly ((

Hi, Khaled,
Does it work with rectangles? I tried and failed (( Am I doing something wrong?

The section is a rectangle by default

Sorry, Khaled, I didn’t explain it clearly. There is no problem with split&join “issue” we discussed above… I meant a different situation when we have a closed curve with sharp edges

Sweep works only with opened curve, you need to split the curve

Hello Teddy, Khaled,
Finally, I managed to sweep desired shapes on the closed curve with sharp edges using seam adjusting method, but to my surprise, It doesn’t sweep all of the profiles(moldings), although all profiles are the very same(The difference is only in shapes). Pls, see the attached files.
What could be the reason for this, or am I doing something wrong?


sweep1_on_closed_crv.gh (20.9 KB)

I don’t know why the Sweep1 component is failing with some of your profile curves.

I made a one line C# script and it succeeds with all of your curves as inputs.

sweep1_on_closed_crv_re.gh (23.0 KB)

The script uses this RhinoCommon method. You might want to look at the parameters to see if you want to change anything.

I don’t know what version of Rhino you are using but this method was new in V7.0

-Kevin

Hello, Kevin,
I use Rhino 7. I don’t have a good knowledge in scripting on C#. Often, in my working process I have to change many details and technics while modeling different things , it requires constantly change or modify the scrips, so its not convenient to me to work with those scripts in C#. Anyway, thank you very much, appreciate your effort. :pray: I will try to figure it out what the heck is going with my profile curves in GH.

I think your profile curves should work.

I tried your curves 2, 4, and 8 in the Rhino V8 WIP with Grasshopper 2. Using the Sweep From Rail component (Sweep1) they work without problems.

There might be a plug-in with a more robust sweep component that would work for your needs with V7.

-Kevin

1 Like