Sweep 2 ... why doesn't work?

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)


thank you … this is finally working also in Rhino 6.
I’ve tried so many other Python scripts and all had Problems.
This one seams working perfectly :slight_smile:

Any updates on this? Could this be fixed in Rhino 6? It’s nice to have the option to set that MaintainHeight property of SweepTwoRail

sweep2_inconsistency.gh (211.8 KB)
note how the highlighted sweep swerves outside the rail for some sweeps

1 Like

RH-55229 is fixed in the latest WIP

1 Like