How to be notified about changes of model unit system

I would like to be notified in case the user changes the model unit system, resulting in scaling of the document objects.

The reason I’m asking this: I have custom user data (derived from ON_UserData) attached to certain document objects. This data would need to be scaled as well. According to my tests it seems that the scaling transformation resulting from a change of the model units is not recorded in ON_UserData::m_userdata_xform.

I have found the following event watcher, but don’t know how I would use it to detect changes of the module unit system:

void CRhinoEventWatcher::OnDocumentPropertiesChanged(CRhinoDoc& doc);

Assigned to Rhino Developer category.

This is not what I am seeing. When I change the model’s units and pick “yes” to scale objects, my test user data’s Transform() member is called. This is by design, of course.

Have you put a breakpoint in your ON_UserData-derived classes Transform() override?

– Dale

Dale, you are absolutely right, I set a breakpoint once again and now it worked.
Somehow our users sometimes manage to end up with our user data being not synchronized anymore with their mesh objects. Can you think of any operations that would cause this?

Morphing (Bend, Flow, Taper, Twist, etc.) would be one case. Point editing (probably) would be another.

We catch control point editing (moving of vertices) of course. The other ones (morphing) need to be trapped individually I guess, using an event watcher? It would be great if there was a general possibility to be notified about such changes which affect the geometry of an object, but are not recorded in ON_UserData::m_userdata_xform.