# RhinoObject/Geometry/Attributes, 3 UserData

**URL:** <https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243>\
**Category:** Rhino Developer\
**Tags:** windows, rhinocommon\
**Created:** [February 1, 2022, 9:21am UTC](https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243 "2022-02-01T09:21:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kitjmv](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/kitjmv/32/769169_2.png) [@kitjmv](https://discourse.mcneel.com/u/kitjmv)\
**Post date:** [February 1, 2022, 9:21am UTC](https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243/1 "2022-02-01T09:21:07Z")

</div>

Hello,

I would like to understand and know when to use UserDataList rather than another ?

```auto
RhinoObject.UserData
RhinoObject.Geometry.UserData
RhinoObject.Attributes.UserData

```

What is the purpose of each ?

Can `UserData` be shared between multiple objects, geometries, attributes ?

`RhinoObject.UserData.ShouldWrite/Read/Write` seems never to be called and data is not written to file, Is this normal ?

thank you, jmv.

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [February 1, 2022, 6:55pm UTC](https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243/2 "2022-02-01T18:55:33Z")

</div>

Hi @kitjmv,

Some background:

> **[Plugin User Data](https://developer.rhino3d.com/guides/rhinocommon/plugin-user-data/)**
>
> This guide gives an overview of user data and how to use it with RhinoCommon.

```auto
RhinoObject.UserData

```

This is only here because of class inheritance and should not be used.

```auto
RhinoObject.Geometry.UserData

```

This is user data stored on an object’s geometry.

```auto
RhinoObject.Attributes.UserData

```

This is user data stored on an object’s attributes. Generally, this is the best place to store user data.

> [@kitjmv](#):
>
> Can `UserData` be shared between multiple objects, geometries, attributes ?

Two objects cannot reference the same user data object.

– Dale

---

<div class="post-metadata">

**Author:** ![kitjmv](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/kitjmv/32/769169_2.png) [@kitjmv](https://discourse.mcneel.com/u/kitjmv)\
**Post date:** [February 2, 2022, 5:46am UTC](https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243/3 "2022-02-02T05:46:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [February 2, 2022, 4:21pm UTC](https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243/4 "2022-02-02T16:21:34Z")

</div>

> [@kitjmv](#):
>
> But could you tell me why attributes are the best place to store user data. ?

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.

– Dale

---

<div class="post-metadata">

**Author:** ![Christian\_Hartz1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/christian_hartz1/32/722920_2.png) [@Christian\_Hartz1](https://discourse.mcneel.com/u/Christian_Hartz1)\
**Post date:** [January 18, 2024, 3:30pm UTC](https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243/5 "2024-01-18T15:30:22Z")

</div>

Hey @dale,

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.

Kindest  
Christian

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [January 18, 2024, 4:36pm UTC](https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243/6 "2024-01-18T16:36:42Z")

</div>

Hi @Christian_Hartz1,

> [@Christian\_Hartz1](#):
>
> Why would you store UserData (same class object 3 times on an object) in a class like RhinoObject?

I don’t understand - I’d certainly never do this.

> [@Christian\_Hartz1](#):
>
> RhinoObject inherits from ModelComponent, right?

Yep. But `RhinoObject` is a runtime object - it is never serialized. It’s data members (`Geometry` and `Attributes`) are serialized, however.

> [@Christian\_Hartz1](#):
>
> And why would they survive or not?

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.

– Dale

---

<div class="post-metadata">

**Author:** ![Christian\_Hartz1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/christian_hartz1/32/722920_2.png) [@Christian\_Hartz1](https://discourse.mcneel.com/u/Christian_Hartz1)\
**Post date:** [January 19, 2024, 8:03am UTC](https://discourse.mcneel.com/t/rhinoobject-geometry-attributes-3-userdata/137243/7 "2024-01-19T08:03:50Z")

</div>

Hey @dale,

thank you once again for your quick reply.

> [@dale](#):
>
> I don’t understand - I’d certainly never do this.

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.

Thanks and Kindest  
Christian
