Rhinocommon Sweep1

Hi there,
I’m struggling try to sweep the red curve through the blue one using Rhinocommon

using rhino command “sweep1” is working fine

but when using rhinocommon, the result is this:

        brep = rg.Brep.CreateFromSweep(c.ToNurbsCurve(),arrCrv,

if passing SweepMiter as “Trimmed”, instead of “Untrimmed”, the result for that particular case works fine, but then other problem arises with other curves I need to sweep, wich by the way is the same problematic behaviour I have found in an example share by @dale in other place in the forum.

As shown in the image above, now the corner is neatly solved, but as shown below new problems arises sweeping other curves, that before were solved fine

So basically, for some conditions sweepMiter.Untrimmed is the way to go, while in other conditions sweppMiter.Trimed is the solution, and I definitely don’t understand the logic behind.

import Rhino.Geometry as rg
import Rhino
sweep = rg.SweepOneRail()
sweep.ClosedSweep = rail.IsClosed
sweep.SweepTolerance = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance
sweep.AngleToleranceRadians = Rhino.RhinoDoc.ActiveDoc.ModelAngleToleranceRadians
sweep.MiterType = miter
breps = sweep.PerformSweep(rail, sections)

SweepOneRail.gh (3.7 KB)

Thanks, @Mahdiyar, I was avoiding using SweepOneRail as it is superseded and I’m trying to understand the behaviours of Brep.CreateFromSweep(). By the way, I achieved good results with its “sibling” class Brep.CreateFromSweepSegmented().

It would be nice to have a detailed explanation of those classes, as the output is so sensitive to the input curves and there is a bunch of more or less obscure parameters in play. If anyone could point me on any reference about the usage of this class would be great.


Hi everyone, still having problem with sweep1 “robustness”.

This sweeping thing is a crucial step on large project i’m working on and I would like to be sure that all thousands of sweeps are executed correctly. In other words, it’s important for me to understand the logic behind the sweep algorithm and how to tweak input geometry/sweeping method parameters to obtain an optimal result.

Looking on the forum I’ve found other users having similar problems with self intersections, so i’m starting to think that is not all my fault… I have more simple cases that miserably fails (other than self intersection problems) in case the command developer want to have a look.


Hi @aitorleceta,

Can you provide both sample geometry and sample code that you are struggling with?

– Dale

Hi @dale, attached a gh file, with geometry, code and brief comment.
mcNeelSamples.gh (15.6 KB)

I see your code isn’t using this. Any reason?

— Dale

No particular reason, tried already but without much better results…

Hi @dale , let me clarify, as long as you quote my words from the previous post. At the moment of me saying that “I achieved good results with its “sibling” class Brep.CreateFromSweepSegmented()”, I didn’t realize that the apparently “good” breps resulting from that method, were systematically failing when I tried to solidify/Cap them. They are free of selfintersection, but not “cap-able”. I tried to explain that on the “notes” in the gh file I shared.

I’m still struggling with the problem, it would be great to have some assistance on how to solve those problems that occurs on the example I sent you. I have thousand of lines I need to sweep programatically, and it would be great to have and idea on why sweeps fails “sometime”. That way I could preprocess the geometry to assure a correct sweeping (“correct”, in the sense that resulting breps are “cap-able” and free of self intersections)


Hi @aitorleceta,

The attached seem to works on your rails. Let me know if this helps or not.

test_sweep1_segmented.gh (13.1 KB)

– Dale

1 Like

Thanks @dale
Can this work with custom curve as section?