Sweep 2 ... why doesn't work?

Hi Guys … I’m aware that the SWEEP2 has a bug that doesn’t allow to keep the same height, which is really annoying and I hope someone will fix soon since is a fundamental component for my workflow.

Anyway searching on internet I found many people having the same problem.
I saw this Python component but it seems not working properly.

does anybody know why he’s not able to keep the second rail of the curve ?

sweep.gh (952 Bytes) sweep2.3dm (360.7 KB)


the uploaded .gh file has some sorta plugin
you said it was python? it was probably compiled into a .ghpy and you’ll have to upload it
otherwise the native Sweep2 component seems to work just fine…

the native sweep isn’t working while the “same height” function that I need … isn’t working
No matter if you put on true or false … it doesn’t change anything.
Wondering why in RHINO 5 and previous versions of GH the sweep was working perfectly and now not anymore. Plus … they aren’t fixing this really annoying problem since forever.

The component was compiled in Ghpy yes … Strange that isn’t working … I’ll upload again when I’m in the office.

You’re right
sweep2bug.gh (6.2 KB)
The API class behaves strangely, as documented in my example.
@piac @DavidRutten

Yes I know … that’s why I’m trying to find another solution,
I Need the Sweep2 working correctly mantaining the height between the profiles.
Any idea?

Hi Bruno,

I looked at out bugtracked items, and found this: RH-45110.

When I open the definition in Rhino 6, I get this:
I probably need the same component that you have found.

Any ghpythonlib.components call uses the component itself. This is why you will get the same results. ghpythonlib places a component in a definition, runs it for you, and gives you the results after the solution completes.

I tried to bump issue RH-45110. As this is something that @DavidRutten already investigated, you’ll have to wait for his response.

I hope they will find out because I cannot do a proper job without a SWEEP2 working properly.
and It seems a Problem that occur since many years … which scares me a lot.

As I said some guys solved this Problem with a Python script SWEEP 2 …. but with me doesn’t work since is not able to Keep one of the 2 rails … or sometimes is just not generatic any sweep

Hi Bruno,

you can disregard the need to wait part of my previous reply; I noticed that the SDK has been improved in between, so this can be fixed in a small scripting component (for last Rhino 6 SR).
Here the Python source:

import Rhino as rh

r2 = rh.Geometry.SweepTwoRail()
r2.MaintainHeight = H
A = r2.PerformSweep(R1, R2, S)

sweep2fix.gh (5.3 KB)

I hope this helps for now, thanks,


Giulio Piacentino
for Robert McNeel & Associates

1 Like

This is precisely what i was referring to. The sweep doesn’t follow the rails with the API call.

left in image is native Sweep2 component and right is Python calling API

You posted a ghpythonlib.componentbase, which is just calling the Grasshopper component. ghpythonlib.componentbase is not an SDK, it’s just a reflection of Grasshopper.

I think I understand the problem of the shape of the second curve now. This has been fixed in Rhino WIP.

1 Like

I have no idea what the difference is. I imported Rhino.Geometry and instantiated a SweepTwoRail. Thought that was an API call.
And yes the WIP does what I expect now. Can it go to a SR so non-WIP can enjoy the benefit as well?

Sorry, I had opened another script from another place and thought it was yours. The script read:

import ghpythonlib as ghl
ghl.components.Sweep2(A, B, S, H)

Your script is fine. It does work as well in Rhino WIP. And the component itself also works fine in Rhino WIP. And also this sniplet works in Rhino WIP. :slight_smile:

I searched more and found RH-31673. I’ll assign one of those devs to this.

1 Like

Hi Giulio

So I tried but it’s not working.
This sweep is a part of a big Project I’m working with …
I attach the files ( I Highlighted the Problem with a RED GROUP and a LABEL " PROBLEM HERE " )
The Problem is that your script works only with one profile ( at least on my Project ) but as soon I connect the other profile there’s no output geometry anymore ( which is the same Problem I had with similar scripts I found already in internet )
On top …. actually I trimmed the curves to work with 2 open curves ( since I read it’s easier to avoid the Problem of the same height ) but in real I would Need a proper sweep 2 with same height between 2 CLOSED curves ( It’s a ring shank )

Hope you can help me because I’m really getting crazy just for a simple sweep and it block all my work since I get a result I don’t want.
Thanks again for your precious help :slight_smile:drop_1ct.3dm (757.6 KB) Drop_1ct.gh (895.0 KB)

Yes that’s exactly what I mean …
If I execute @piac script with my curves … this happen

Hi @bruno.denzinger Yes this is fixed only in Rhino WIP at present.

Means I have to try to download the WIP right?

Hi @bruno.denzinger,

Have you tried using this version of Brep.CreateFromSweep?

– Dale

1 Like

I found on the web this but I’m not a programmer so I have no idea how to fill the C component with this.
Also I’m not able to do a Copy/paste ( paste isn’t highlighted )
Would you be able to help me with this ?

This is what I’ve got using @dale suggestion. Is that what you’re looking for?

import Rhino.Geometry as rg

a= rg.Brep.CreateFromSweep(R1,R2,S,rg.Point3d.Unset,rg.Point3d.Unset,C,0.01,rg.SweepRebuild.None,0,0.0,H)

sweep.gh (6.9 KB)

1 Like