Grasshopper

algorithmic modeling for Rhino

I'm trying the GhPython node in Rhino 5 with the following simple code:

import rhinoscriptsyntax as rs
vec1 = rs.GetObject('pick a pt', 0)
vec1 = rs.VectorScale(vec1, 0.5)


However, i got the following error message in the Grasshopper Python Script Editor:

Runtime error (NotImplementedException): The method or operation is not implemented.
Traceback:
  line 287, in GetObjects, "C:\Users\oat\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\selection.py"
  line 3, in script


can anybody kindly advise what's wrong here?


Thanks!

Views: 2654

Replies to This Discussion

You can use scriptcontext to see if you are in Rhino or in Grasshopper. Like this:

import scriptcontext as sc
print("Rhino" if sc.id == 1 else "Grasshopper")

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

It is the GetObject command that doesn't work in a Grasshopper context. Feed the point in as an input of the script component  

best

jacob

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service