Why OnDeleteObject event watch transformed objects?

Hi
I’m using OnDeleteObject() event overridden from CRhinoEventWatcher class. My goal is to detect when some objects are deleted from the scene. But the event is triggered for every transformation done on that objects, even if they are moved. How to prevent this? How is possible OnDeleteObject event to catch transformed objects? Is there are any another event watcher ONLY for deleted objects from the scene, or is it possible to add something else with this event?
– Filip

Hi @Filip,

Please review the comments for CRhinoEventWatcher::OnReplaceObject in rhinoSdkEventWatcher.h.

Also, if you want transformation events, then you might want to implement a CRhinoOnTransformObject event handling object.

– Dale

Hi @dale

I need event

NOT for moved or transformed.
So, I have not need of using OnReplaceObject nor OnTransformObject. Is there are some way to detect only deleted objects from scene?
Also, in the comments for CRhinoEventWatcher::OnDeleteObject says “Called if an object is deleted.”, but actually is also called if an object is transformed. Why? Is it possible to use this event only for deleted objects?
– Filip

Hi @Filip,

Changing an object means replacing old (pre-change) with new (changed) object. Moving an object means changing an object. That means you get an OnDeleteObject() as part of OnReplaceObject() (see example code documentation string).

You’ll have to record the IDs of the objects you are interested in. That is why you should also implement a CRhinoTransformObject so you can record the IDs of objetcs that are being transformed.

This all means you have to do some extra bookkeeping on your side to determine when an object is just being moved, when it is actually being deleted.

/Nathan

1 Like

Thanks @nathanletwory and @dale
I’ve used both events OnDelete and OnReplace for my solution.
But I’m still believe that OnDelete should be trigger only on deleted objects :slight_smile:
– Filip