pythongrasshopper

Iteration over non-sequence of type `LineCurve`?


With the following code I get the error message below which I was not able to resolve using the documentation.

Here is the code

import rhinoscriptsyntax as rs
a = []
for i in range(0, x + 1):           
    nl = rs.RotateObject(ln, rs.CurveEndPoint(ln), degrees * i, (0,0,1), True)
    a.append(nl)

I get the following message error:

Runtime error (TypeErrorException): iteration over non-sequence of type LineCurve`

Traceback:

line 1076, in TransformObjects, "C:\Users\**\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
  line 947, in RotateObjects, "C:\Users\**\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
  line 924, in RotateObject, "C:\Users\**\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
  line 7, in script

Solution

  • Type Hint example

    Bibhas is right here. The RotateObject function only accepts a guid. If you change the type hint for the input then it will work as expected. The output