"Iteration over non-sequence of type NurbsCurve" issue

Hi,
I am trying to check the way rhinoscriptsyntax MoveObject() method works. When trying to implement it into the Rhino Python Editor, it works with no problem:

import rhinoscriptsyntax as rs

curve = rs.GetObject("pick up the curve")
rs.MoveObject(curve,[10,0,0])

But when I try to do the same thing in the GH Python component, like this:

import rhinoscriptsyntax as rs

a = rs.MoveObject(curve,[10,0,0])

(“curve” is the GH Python’s input plug)
Here is the error message I get:

Runtime error (TypeErrorException): iteration over non-sequence of type NurbsCurve
Traceback:
line 1076, in TransformObjects, "C:\Documents and Settings\Administrator\Application Data\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
line 392, in MoveObjects, "C:\Documents and Settings\Administrator\Application Data\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
line 378, in MoveObject, "C:\Documents and Settings\Administrator\Application Data\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
line 3, in script

Why is that?

Thank you.

P.S.

I saw this “Iteration over non-sequence of type NurbsCurve” issue has appeared in two more cases by googling. Two separated users posted a question on this at stackoverflow.com, but unfortunately I did not understand the answers.

1 Like

you can look in the code yourself at https://github.com/mcneel/rhinopython/blob/master/scripts/rhinoscript/object.py

It looks like the curve variable is a String or Guid with the unique ID of the curve in the first example, and the actual NurbsCurve in the second example, rather than the ID of the curve.

Thank you for the reply Menno. Not sure I understand you though.
What is the solution to the usage of MoveObject() into the GH Python component?

What is the Type Hint for the input? Try making it “ghDoc object”

1 Like

Thank you Steve! Worked like a charm.
The type for the “curve” input was “Curve”. When I changed it back to “ghDoc object” it worked. Could you tell me when do I need to leave the hint as “ghDoc object” and when do I need to set it to “Curve, Mesh, Surface…”?

If you are using rhinoscriptsyntax, I would stick with the ghDoc type hint. If you start using direct RhinoCommon, you’ll probably want to switch

Ok. And this applies to number sliders (integer, float) plugged to GH Python component too (leaving them with “ghDoc” type)? Or just to geometry objects (curves, points, meshes, surfaces…)?

I would say just geometry types in general

1 Like