Track Change in C# RhinoCommon


I was wondering what is the best way to do the following (and I would appreciate some help):

Let’s say I want to create my own Point class - MyPoint - that has the Point3d information plus some other metadata. And I want the user to be able to draw MyPoint. That means the user would draw a normal point and I would create an instance of the MyPoint class and save the GUID of the Point Object there. (And I would try to serialize MyPoint using the custom UserData).

Now…the problem is when the user moves or deletes the original point. I want to be able to detect this action immediately and update my MyPoint instance accordingly. (Maybe I have some information displayed in the Conduit that I want to be moved to the new place, or delete the instance if the original point is deleted, handle the Undo appropriately, etc.)

Can I detect this automatically? When the user moves or deletes geometry in the document? Or when the user uses Undo maybe? Was there an EventWatcher example?


This is not just about event tracking, when you ‘save as’ the document all the Guid values of the objects are also changed. When you copy and paste the objects, the guides change again. I am working on this kind of approach, but I am still facing real challenges and I think I am on the wrong track. If you are doing this for individual Rhino objects, it is easier to use the ‘user data’ of the objects. Just serialise it and write it to the object. However, when you need to keep track of multiple objects that are part of a complex structure, it is a real challenge.

If you are only dealing with single objects, keep going with ‘UserData’.