Can RhinoCommon set Rhino object names?


#1

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?


#2

Hi,

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"
rh_obj.CommitChanges()

Check the object.py file


(Dale Fugier) #3