AddSweep1 seam point

Hi, new to Rhino Script. When I create a sweep using Sweep1 command line, the surface is fine without changing any seam points etc. When I use AddSweep1, the surface twists as if the seam points are not aligned.

Can you please point me to the solution? I have tried searching. I’m probably missing something trivial. Thank you

rmin = 1; rmax = 3;
obj = rs.GetObject(“Select a curve”, rs.filter.curve)
if obj:
spt=rs.CurveStartPoint(obj)
param = rs.CurveClosestPoint(obj, spt)
nrm1 = rs.CurveTangent(obj, param)
pln1 = rs.PlaneFromNormal(spt, nrm1)
cir1= rs.AddCircle(pln1, rmax)

    ept=rs.CurveEndPoint(obj)
    param1 = rs.CurveClosestPoint(obj, ept)
    nrm2 = rs.CurveTangent(obj, param1)
    pln2 = rs.PlaneFromNormal(ept, nrm2)
    cir2 = rs.AddCircle(pln2, rmin)

    rs.AddSweep1(obj, [cir1, cir2], False)

I tried it on a different machine with another Rhino install and it works fine. Both are Version 5 SR14 64-bit (5.14.522.8390, 5/22/2017). Please let me know if it is some setting I need to change.

Hello - see if, in the Rhino command, you use Natural for setting the seam point, it also works as you expect.

-Pascal

Hi, you are correct. Sweep1 command with ‘Natural’ seam point adjustment produces the identical result as the Python script. How do I reproduce Sweep1 command with ‘Automatic’ seam point adjustment in Python script or VB script? I see flags for Freeform/Roadlike and Simplify/Refit/Rebuild in AddSweep1 VB script, but nothing for ‘Automatic’ seam. Thanks

Hello - the command, as opposed to the lower level AddSweep function, has some seam matching stuff… you might be able to cook up something with CurveDirectionsMatch() and CurveSeam and so on, but my guess is it may be hard to make it reliable.

-Pascal

Looks like setting the CurveSeam parameter to either the original start point or 50% of the cross-section curve domain works. I make each sweep and then switch between 0 or 0.5 depending on which one works. A bit cumbersome (have about 100 rails), but it’s certainly easier than command line. Thanks for your help.