Keep UserData if ReplayHistory is called

I have attached some UserData to a brep. There also a custom ReplayHistory added to it.

If the History get updated the UserData get deleted.

I have try to get access to the old UserData in my ReplayHistory function:

var attributes = replay.Results[0].ExistingObject.Attributes;
var userdatalist = attributes.UserData;
replay.Results[0].UpdateToBrep(brep, attributes);

but the userdatalist has a size from 0.

How could i copy userdata on updateing a object

Hi @atelierholder,

I am not sure I follow what you are describing. Can you provide sample code, that we can run here, along with instruction on how to repeat what you are seeing?


– Dale

Sure TestCommand.cs (4.7 KB)

if you set a breakpoint at line 98 you will see that the variable “userdata” is empty. To get to the breakpoint you need to execute the command once and than modify the smaller circle in rhino.

In rhino you will see that the brep has userdata attached bevor the history gets updated and lose it by the update.

Hi @atelierholder,

Instead of this:

var userdata = replay.Results[0].ExistingObject.UserData;

Do this:

var userdata = replay.Results[0].ExistingObject.Geometry.UserData;

– Dale