Rhino 6 for Windows / RhinoCommon V6 / C#
I wrote a simple plugin to test this:
RhinoTestUserData.zip (381.1 KB)
This simple plugin has 2 commands:
- UDSetUserData to give user the ability to select an object and to “attach” to its UserDictionary a simple information: the center of its bounding box.
- UDGetUserData to give user the ability to select an object and to read (if present) the coordinates previously saved in the UserDictionary
Please note that i’m not reading and writing the UserDictionary of the RhinoObject but the UserDictionary of its GeometryBase object.
The plugin also intercepts the BeforeTransformObjects event and updates the coordinates saved in the UserDictionary accordingly to the transformation applied.
So far so good…
That’s what looks like a bug.
- Create a simple object with center in (0, 0, 0)
- Execute UDSetUserData and select the object
- Execute UDGetUserData, select the object and note that the center coordinates are right (0, 0, 0)
- Translate the object by a know value (i.e. +2 along X axis)
- Execute UDGetUserData, select the object and note that the center coordinates are updated (2, 0, 0)
- Undo the transformation
- Execute UDGetUserData, select the object and note that the center coordinates are still (2, 0, 0)
It looks like the GeometryObject.UserDictionary is not restored at its previous state.
Thanks to you all.
@dale Has this something to do with our recent conversation?