UserDictionary and undo record

Hi @software_comas ,
As far as I know, undo does not support changes to user dictionary as mentioned in this post RhinoCommon - Removing User Data - #18 by dale

You could make a copy of your geometry, and then change UserDictionary, after use ObjectTable.Replace()

For example if your RhinoObject is a BrepObject,

UInt32 recordSerialNumber = RhinoDoc.ActiveDoc.BeginUndoRecord(“UpdateUserDictionary”);
Brep geometryCopy = myRhinoObject.BrepGeometry.DuplicateBrep();
geometryCopy.UserDictionary.AddContentsFrom(myUserDictionary);
doc.Objects.Replace(myRhinoObject.Id, geometryCopy);
RhinoDoc.ActiveDoc.EndUndoRecord(recordSerialNumber);