Error Python Sweep1 (legitimate UID)

Hi all,

I’m sure this is a simple one, so bear with me on my early python journey.

The following creates a closed polyline and another line, then attempts to sweep1.

If I print both object variables, they appear to be legitimate UID’s, but I get an error message “iteration over non-sequence of type Guid”

Traceback:
line 740, in AddSweep1, “C:\Users\adria\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\surface.py”
line 11, in , “C:\Users\adria\AppData\Local\Temp\TempScript.py”

Thanks in advance

Adrian

import rhinoscriptsyntax as rs
import rhinoscriptsyntax as rs
XSize = 200
YSize = 400
movePt = rs.GetPoint("Pick Pt: ")
arrFrame = [[movePt.X,movePt.Y,movePt.Z],[movePt.X-(XSize/2),movePt.Y,movePt.Z],[movePt.X-(XSize/2),movePt.Y,movePt.Z+YSize],[movePt.X+(XSize/2),movePt.Y,movePt.Z+YSize],[movePt.X+(XSize/2),movePt.Y,movePt.Z],[movePt.X,movePt.Y,movePt.Z]]
objLast = rs.AddPolyline(arrFrame)
newObj = rs.AddLine(movePt,[movePt.X,movePt.Y+25,movePt.Z+25])
SelProf = rs.FirstObject()
print(newObj)
print(SelProf)
rs.AddSweep1(newObj, SelProf)

image

Try changing your code to this:

import rhinoscriptsyntax as rs
XSize = 200
YSize = 400
movePt = rs.GetPoint("Pick Pt: ")
arrFrame = [[movePt.X,movePt.Y,movePt.Z],[movePt.X-(XSize/2),movePt.Y,movePt.Z],[movePt.X-(XSize/2),movePt.Y,movePt.Z+YSize],[movePt.X+(XSize/2),movePt.Y,movePt.Z+YSize],[movePt.X+(XSize/2),movePt.Y,movePt.Z],[movePt.X,movePt.Y,movePt.Z]]
objLast = rs.AddPolyline(arrFrame)
newObj = rs.AddLine(movePt,[movePt.X,movePt.Y+25,movePt.Z+25])
print(objLast)
print(newObj)
rs.AddSweep1(objLast, [newObj])

Note in the last line that the call to rs.AddSweep1(rail, shapes, closed=False) is expecting a list for the second parameter (shapes). This is why you were getting the error message “iteration over non-sequence of type Guid”.

-Kevin

Awesome, thanks @kev.r !
I tried many different combinations and oops got the variables around the wrong way in my posted sample, but that bracketing of the last variable was the biggie. I need to store that one in the brain.
Regards, Adrian