Problem with the Python AddPolyline method

If you attempt to run the example script from the help file you will see this error:

Message: ‘type’ object has no attribute ‘index

Same happens with the AddInterpCurve method.

Both these methods identify the problem in the traceback as:

line 402, in coerce3dpointlist, “C:\Users\dan\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py”

Thanks,

Dan

Hmm, both of the examples seem to run OK here… don’t know what’s happening there. Is rhinoscriptsyntax getting loaded correctly? --Mitch

import rhinoscriptsyntax as rs
points = rs.GetPoints(True)
if points: rs.AddPolyline(points)
import rhinoscriptsyntax as rs
points = (0,0,0), (1,1,0), (2,0,0), (3,1,0), (4,0,0), (5,1,0)
rs.AddInterpCurve(points)

Strange. I had just copied and pasted straight from the help file, because I discovered that the AddPolyline method wasn’t working in something I was writing. I figured I could get away with AddInterpCurve method as a workaround, but that gave me the same error. Again, I copied and pasted from the help file.

Now, after closing Rhino and re-opening, it’s working for me.

Thanks for check on this Mitch. I guess it was just a glitch on my end.

Dan

1 Like

I had the same problem:
-I worked on a file and everything was fine.
-Computer crashed (for computer reason unrelated)
-Back to the file, nothing worked anymore, I had the same problem
-I just closed rhino and grasshopper and tried again: it worked (thanks to this post)!!!

Wonderful computer things