Can RhinoCommon set Rhino object names?


Rhino objects have their names exposed via RhinoObject.Name, but this property is read-only. Is there a way to programmatically set the names of existing objects with RhinoCommon?



Seems like it could be done through scriptcontext.doc.Objects.ModifyAttributes:

import rhinoscriptsyntax as rs
import scriptcontext as sc

id = rs.GetObject("pick something")
rh_obj = rs.coercerhinoobject(id)
attrib = rh_obj.Attributes
sc.doc.Objects.ModifyAttributes(rh_obj, attrib, True)
rh_obj.Attributes.Name = "someName"

Check the file

(Dale Fugier) #3