Python script problem with sweep2

Hey, guys! I have problems with the sweep2 command in python script. Pic 1 shows my idea to generate the model with the sweep2 and the command I used is “rs.AddSweep2([arc_guide1, guideline1], shapes, False)”.


U can find that in pic 2 with manual operation it worked very well, the edges were smooth and beautiful.

While when I used the python script, the edges were jagged and not smooth at all.

Please if there be any ideas to solve the problem, as I must use the script because I have to generate hundreds of models with different parameters :frowning:

Can you post a sample set of curves to try? Oh, and that situation looks like it might be better to use Loft with just the cross section curves…

This is the script, thank you! parametric model generator.py (3.3 KB)

OK, I see the result is different, will need to look at how the AddSweep2 function in rhinoscriptsyntax is set up. You might need to go through RhinoCommon in this case.

Just as a test here, using

faces=rs.AddLoftSrf(shapes)

instead of AddSweep2() seems to make a nice clean surface - especially since your curves are all parametrically generated and thus have a similar structure.

Wow! That’s pretty cool! One reason I didn’t choose loft was that at the end of the shape, the face edges might not be vertical to the reference plane. But now I think just add the number of the planes may fix this problem. Thanks a lot, anyway~ :grinning: