Hello Dale,
So there are only two UserData to differentiate between RhinoObject.Geometry.UserData and RhinoObject.Attributes.UserData
I’ll do some testing to see if there’s a difference between the two when I have time (event calls for example).
But could you tell me why attributes are the best place to store user data. ?
Thank you, jmv.
Attribute user data tends to survive better, during a general modeling session, than geometry user data. I don’t have any data to back this up - just my observation.
I would like to get back to this. This is not completely clear to me. Why would you store UserData (same class object 3 times on an object) in a class like RhinoObject?
RhinoObject inherits from ModelComponent, right? ModelComponent has a property UserData, so does RhinoObject as inherit class. Now RhinoObject also stores UserData on the geometry and the attributes, always the same class? Why? And why would they survive or not? Could you please give me some more insights. Would be great.
Yep. But RhinoObject is a runtime object - it is never serialized. It’s data members (Geometry and Attributes) are serialized, however.
This really depends on the command or operation. Some commands completely trash the geometry and return something else. End the end, the attributes tend to survive, which is why commands that trash geometry end up putting the new results back on the same layer as the original.
Anyway, you might just have to take my word for it. Unless you’ve got a special requirement, store your user data on the object’s attributes.
I was not clear on that - the question is: Why does UserData exists 3 times on RhinoObject, which comes along with the question - where to store.
But your explanation shed some light. We are using RhinoObject.Geometry.UserData right now and it seems to work, but I will change to RhinoObject.Attributes.UserData.