Hello,
I had the following script utilizing RhinoScriptSyntax to select/unselect objects in the Rhino document based on an input of GUIDs from within a grasshopper scripting component.
All was working well and suddenly the RS methods “stopped” working, returning the following error message:
- Solution exception:‘CustomTable’ object has no attribute ‘GetSelectedObjects’
I’ve tested in the legacy IronPython component, and the new script component in IronPython2 and Python3 to no avail. I’ve also tested in both Rhino 8 WIP and Rhino 7 (both most recent updates)
Could this be because of a recent update/conflict or am I overlooking something in my code?
Here is the code in question:
Inputs:
ID (Type Hint: GUID, List Access, Flattened)
S (Type Hint: Boolean, Item Access)
E (Type Hint: Boolean, Item Access)
import rhinoscriptsyntax as rs
import Rhino
#Select Objects By ID
def Select_Objects(ID, S):
if S and ID:
rs.EnableRedraw(False) # Disable redraw to improve performance
rs.SelectObjects(ID)
rs.EnableRedraw(True) # Enable redraw after selection
else:
return
#Handle Component Info Message
if ID:
if S:
Select_Objects(ID, S)
ghenv.Component.Message = str(len(ID)) + " Selected"
else:
if rs.SelectedObjects():
if E:
rs.UnselectObjects(ID)
else:
rs.UnselectAllObjects()
ghenv.Component.Message = str(len(ID)) + " IDs Listed"
else:
if rs.SelectedObjects():
if E:
rs.UnselectObjects(ID)
else:
rs.UnselectAllObjects()
ghenv.Component.Message = "No IDs"
Select False (error):
Select True (no error, yet no selection in Rhino either):
Thank you for your help!
10 posts - 2 participants