Sweep - GH output (improve) & rhinocommon output

I have a simple sweep which produces some self-intesecting geometry (showing GH native output):

I wanted to improve this (recommendations are welcome), so I thought I could try some of the methods in RhinoCommon as I think there are some more options to try. However, the different methods output a bit of a weird result (Brep.CreateFromSweep shown), especially as the shape does not follow the rail!!

I just want to understand what is happening here with the CreateFromSweep method, and why such different results out of the methods. Also, any recommendations to produce a output that does not self intersect.

Using Rhino 8

sweep_test.gh (7.7 KB)

You have a Sweep1 with only one section curve (triangle) placed at the end of the rail curve instead of its start. Flipping the rail curve is part of a solution. Using aligned pFrames helps to overcome the effect of torsion. There are still some issues at tight turns that are common to both methods, but otherwise they look the same.


sweep_test_2025Apr30a.gh (15.1 KB)

In this case, there is only a slight difference in volume (in the fourth decimal place) of the capped sweep between many aligned sections vs. only one section. No visual difference in shape.


sweep_test_2025Apr30b.gh (16.8 KB)

thanks Joseph

:person_facepalming: good point

About the proposed improvement using aligned pFrames, the output brep still self-intersects…

Ok, I got something with good quality by using an offset from the rail curve and making sure it does not have a sharp corner where the offset “collapses” (using fillet curve). The offset is set so it aligns with the shape section. Then using sweep2 with both rails:


1 Like

I would still be interested to see if there is something that can handle a sweep and avoid self-intersections in a more “general” way and not specific to this problem.

There is a way. You need to provide railing curves which are composed out of simple and clean curves which share the same properties as their counterpart (=“offset”). Direction, Amount of control-points, relative spacing etc.. everything should only differ minimal. These curves should be continuous, at least G1, better G2..

Good to see that you can do some things to overcome the self-intersection issue. Did you filet both rail curves for Sweep2? Maybe filet before offset?

I didn’t notice yesterday that your rail curve has many control points.

This purple group goes to extremes to create a filleted polyline rail. That rail could have been created differently (better) in the first place!

It also implements Sweep2. You can examine and compare them, including one section vs. many. Note that ‘Count’ (PFrames ‘N’ input) makes a difference too :bangbang: It is what it is. :roll_eyes:


sweep_test_2025May2a.gh (27.8 KB)

I did not fillet the original curve, as it was already smooth (no sharp corners, g1 continuity).

It may have many control point… I did not check that. The curve is a combination of lines and arcs (mainly).

Thanks for the proposed modifications to the original curve.

However, I would say the modification will not work on what I am trying to do. The rail curve is part of a brep, which will be combined with the output of the sweep (BooleanUnion) to make a single body. The output needs to be whithin tolerance of the original rail curve to work:

Oh well, good luck.

Thanks :sweat_smile: Already seeing that the union brep will tend to fail if I am not including some overlapping, so actually might be able to use a curve that deviates from the original.