If I have already defined the two rails and cross-sectional curve, what do I need to do to process them so that they can be used as the arguments for the AddSweep2 function? All of the examples in Rhino IronPython assume that its great to manually select objects. I do NOT want to manually select objects.

Here is my current script. How do I make the last line work?

``````#  Initializations:
#   For the inside, short 240 degree spiral...

InsideWrapAngle = 240
InsideApproachAngle = 21.05
InsidePitch = 2*LineLengthInner/(240/360)

#  Add the vertical construction line for the spiral.
#  First, define the top and bottom points...

#  Add a point at the beginning of the base spiral

#  Draw the base spiral for the inside twist.
obj1 = rs.LastCreatedObjects

#  Offset the base spiral for the 2nd rail.
InsideTopRail = rs.CopyObject(InsideBottomRail,(0,0,InsideTwistHeight))

#  Add a point at the beginning of the 2nd rail
pntInsideTopRailStart = rs.CopyObject(pntInsideBottomRailStart,(0,0,InsideTwistHeight))

#add a point a the end of the bottom rail

#add a point a the end of the top rail

#  Add another rail which will pass through the centroid of the twist crosssection.

#  Now move the rail up to the centroid.
rs.MoveObject(InsideCentroidRail, (0,0,InsideTwistHeight/2))

#add points at the ends of the centroid rail

#   Draw a rectangle perpendicular to the rails
InsideTwistStartFrame = rs.PlaneFromFrame(pntInsideBottomRailStart,(1,0,0),(0,0,1))
obj3 = rs.LastCreatedObjects

#  Zoom in on the figure in all four views simultaneously
rs.ZoomExtents(all=True)

#  Sweep the rails to create the inner twist.
``````

the rs.AddSweep2 method is expecting the 2 rails as a list and all the shapes as a list too. To make it work use:

``````rs.AddSweep2([InsideBottomRail,InsideTopRail],[InsideTwistStartRectangle],closed=False)
``````

btw. to format your python code on discourse, enclose the script like this:

````````` Python
print "Hello World"
```
``````

c.

Clement,

Thank you!