Derive access to Rhino object from GH

Hi! I launch the same snippet of a code in the Rhino Python Editor and in the gh Python script editor component, for Rhino it works well whereas running it in Grasshopper it returns None. What I do wrong with gh

import rhinoscriptsyntax as rs
obj_id = rs.GetObject("Object", 8+16, True, True)
rh_obj = rs.coercerhinoobject(obj_id, True, True)
print rh_obj.Attributes

You need to change the scriptcontext when targeting the Rhino document from a GHPython script. See this post for a quick example:

1 Like