I am running the following method to delete specific user string attributes:
def clear_features(self):
for key in self.geometry_plane[0].Attributes.GetUserStrings():
if "feature" in key:
self.geometry_plane[0].Attributes.DeleteUserString(key)
self.geometry_plane[0].CommitChanges()
It works but I cannot go back and CTRL+Z does not bring the attributes back.
Is there a way to enable “history” for user attributes?
there are snippets and examples (c#) that use doc.Objects.ModifyAttributes instead of commit change…
// Make a copy of the object's attributes
var attributes = rhObject.Attributes.Duplicate();
// Attach our user data
attributes.UserData.Add(userData);
// Modify the object's attributes
doc.Objects.ModifyAttributes(rhObject, attributes, false);
def clear_features(self):
attributes = self.geometry_plane[0].Attributes.Duplicate()
for key in attributes.GetUserStrings():
if "feature" in key:
attributes.DeleteUserString(key)
Rhino.RhinoDoc.ActiveDoc.Objects.ModifyAttributes(self.geometry_plane[0], attributes, False)
self.geometry_plane[0].CommitChanges()