Can't save UserData with Object.UserData,Only Object.Attributes.UserData

Hi everyone, i can’t save a custom UserData in a RhinoObject.
like this.


only save at Object.Attributes, Does anyone know why?

1 Like

That’s the only reliable way, we’ve found it to work

See my post here

hi bro, I mean, isn’t it easy to get confused?

Custom User data never worked reliably for us, which is why we serialize to json and save as strong to UserDictionary instead.

Oh, maybe that’s a good solution too. Thank you

1 Like

@jstevenson - can you expand on this?

– Dale

1 Like

Sorry I’ve searched the forum but I cannot find my earlier troubles back in 2022. But I only remember that writing data to UserData wasn’t working, or wasn’t saving or loading not sure which.

We changed our process to always write our data onto RhinoObject.Attributes.UserDictionary and now we don’t have any issues losing data.

It may have been related to trying to use Custom UserData objects, but now we only use strings and just serialize to json on our objects.

Was your UserData class in a dll separate to your Rhino Plugin? I recall having issues with that ~ 5 years ago.

1 Like

It likely, since we keep our data models in a common project, and share them with several components of our application and cloud services.

But I can barely remember dinner yesterday these days… :wink:

Hi.
Still not, I have tried, can’t define UserData into a public library, it will not be saved to a.3dm file.
Just UserData, perhaps stored in json into a UserDictionary and serialized, can define a common class library.