How to change the object's Name?

I can get the object name, but can’t change it…
image[NameProblem.3dm|attachment]NameProblem.3dm (5.3 MB)


Is this javascript? I presume that this is similar to python - do you have a Rhino namespace?

Rhino.ObjectName(item, "NewName")

Hi @hk11,

Try something like this:

foreach (var objref in objrefs)
  var rhino_object = objref.Object();
  if (null != rhino_object)
    var attributes = rhino_object.Attributes.Duplicate();
    attributes.Name = "NewName";
    doc.Objects.ModifyAttributes(objref, attributes, false);

– Dale

Thanks, Dale, It works :v: