algorithmic modeling for Rhino
Hi,
I just updated to the newest 0.5 version of the Python scripting component. The attached script worked in the older Python component, but no longer does. I am trying to get a geometry from Rhino and keep it 'selected'. My code is as follows:
import scriptcontext as sc
if bool_select:
sc.doc.Objects.Select(x,True,True) #x is the input geometry
this results in the runtime error:
1. Solution exception:'CustomTable' object has no attribute 'Select'
I have set type of x to Dynamic (rhinoscript guid)
Thanks!
Tags:
Hi Jason
you are right: this does not work in the new component because we simplified the way RhinoScript works and made it fully controllable with Python.
This is what happened before:
This, on the other hand, is what is happening now:
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
sc.doc = Rhino.RhinoDoc.ActiveDoc
rs.SelectObject("1d2d1b52-d3db-45c9-8a1c-ddb1303bb8ae")
#do all RhinoDoc modifications here
#and then to go back do the Grasshopper document
#you can do the following:
sc.doc = ghdoc
I hope this is helpful,
- Giulio
________________
giulio@mcneel.com
Hi Giulio,
Thanks for clearing this up. This makes sense now.
About changing the doc's target between rhinoDoc and GHdoc, what about Steve Baer says in this post
oh and yes scriptcontext.doc is better to use than Rhino.RhinoDoc.ActiveDoc. The reason is that multiple docs may exist on the Mac and the ActiveDoc may be switched in the middle of an executing script, whereas scriptcontext.doc is always the RhinoDoc that was active when the script started.
is there any way to get sure that the reference of doc is always a concrete document. I mean, how to avoid the possible confusion between two open documents?
or is just an issue that occurs in Mac? Rhino-Win only accepts one document opened each time, but i can have opened varios rhino apps...
hope my cuestion makes sense..
aitor
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by