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!
Tags:
Hi, Giulio, thank you very much for the clarification! I guess the GhPython node is different from the native Python Editor in Rhino 5 anyway.
Yes -- it is slightly different (mostly on the user interface and selection part). The rhinoscriptsyntax geometry methods are working in the same way.
- Giulio
_______________
giulio@mcneel.com
Hi Giulio,
I am trying to implement the same as you did in your example, but your GH file doesn't work anymore. I got the same message as Grasshope had at the beginning of this post.
Was there any change with the upgrades?
Thanks
Baptiste
Hi Cochin.
The upper message can differently be interpreted depending on the function used, or the "point" of the code.
Can you attach your .gh (and .3dm if needed) files please?
Hi Cochin
yes, the change is that there is no more user interface (UI) to switch the target document of RhinoScript methods. So you have to do this manually in the script.
The reason behind this is that you should as much as possible not use getObject/picking methods in Grasshopper, but use the normal Grasshopper UI.
I hope this explains it,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hi Giulio,
This is what I need. Thank you.
What is the exact purpose of the last code line :
sc.doc = ghdoc ?
>> to switch the target document of RhinoScript methods.
Most RhinoScript methods have a call looking like AddXXX(), or RemoveZZZ(). This implicitly targets a document. The document can be the one in Rhino, or a replacement without Undo's that is used to speed up things in Grasshopper. You should usually not need to know about this, except in corner cases like with UI, picking, and similar.
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Understood, Thank you for explanations.
Hi Giulio,
If we want to get other geometries like curves how should we change the code?
I have tried to get curves but cannot get it from the output of GhPython. It returns a Null item...
Any suggestion?
Cheers,
Jack
Hi Jack
May I be very frank... why do you want this?
What problem are you trying to solve?
In general, you will have to get the geometry from the document, and copy it in order to have it in Grasshopper. With a point, this works without copying because they are structs and are automatically copied.
Thanks,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hi Ciulio,
I am just wondering the possibility.
I didn't know it can GetObject (for point) before I see this thread.
So I would wonder if it is possible to also get other objects.
Thinking if it works then it would be much easier to move the python script from rhino to the GhPython.
Thanks,
Jack
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by