The following code works in Rhino 6. Meaning, after is executes, the object’s “Name” property is updated with the new name in the “Properties” panel.
CRhinoObjectAttributes attribs = obj->Attributes();
bool result = RhinoApp().ActiveDoc()->ModifyObjectAttributes(obj, attribs);
In Rhino 7, the “Name” is not updated until Rhino loses and regains focus. A selection event also updates it. How can I force an update of the “Properties” panel after I change the “Name” attribute?
Where you are running this code from? (a command? a panel? etc…).
Also, after modifying the name attribute, there is no reason to redraw the doc, since to geometry changes were made.
From a panel.
Just confirmed that it works fine from a Command. But I put the above code (minus the unnecessary Redraw) into a CRhinoTabbedDockBarDialog’s ON_BN_CLICKED function and it does not update the name.
Having your button click handler run a test command is actually a very good approach for this.
In Rhino 6 when I rename an object from a panel, the Properties panel updates on its own. Has this capability been removed from the API in Rhino 7? Or is this a bug?
Without a sample that allows me to repeat what you see, I have no idea.
Did scripting a tet command work?
Yes. If I execute the same code from within CRhinoCommand::RunCommand it does not exhibit the problem.