CreateFromSweep difference in GUI and Rhinocommon

The original curves.

This is the result of Sweep1 from GUI button

And this is the result of rg.Brep.CreateFromSweep()

I’m wondering how to modify so it’s the same as the above one.

From what I can see and based on the overloads in Brep.CreateFromSweep, the order of your curves is wrong for a sweep one rail. It should be:

rail (curve), [profile curves] (in a list), closed (bool), tolerance

Thanks, it works.

Hello, I’m facing another problem, which I think is under the same topic.
I have to uncheck Solution in order to reply here.
Do you have any idea how it can be solved?

The extrusion of CreateFromSweep method seems to deviate away the rail.

Compare to the GUI Sweep1, which goes perfectly along the rail.

Update information.

The brep baked from CreateFromSweep looks different from the one from GUI Sweep1. Maybe they are not the same function after all.

Solved it by using rg.SweepOneRail.PerformSweep() method instead of rg.Brep.CreateFromSweep().