Prevent modifying of object with event watcher

I want to prevent the user to modify plugin objects that are added to the document.So my plugin adds the plugin specific objects in locked layers. This way the user can’t modify and select my objects.

But the requirement is that the user can select the object and do on it some non-modifying operations like copying and other measurement operations. How to implement that ? I was thinking to add all my plugin objects in unlocked layers, so the user can select them, and then watch in rhino document watcher if the object is somehow modified, and if it is “unmodify” the object.But which events I should override in the CRhinoEventWatcher class to implement this behavior

Hi Elizabeta,

Rhino is not designed to allow a plug-in developer to prevent a user from modifying the data they create. So you will have a difficult time in preventing this.

If you don’t want users modifying geometry, then you can calculate the CRC code for the geometry using ON_Object::DataCRC and then store this value somewhere. When you detect an object modification, you can check the object’s current CRC value against what you’ve saved. If they differ, then take some drastic action.

Not sure how useful this is…

– Dale

Hi thank you for your reply
But what event to use in other to detect the object modification


Rhino gives a delete/add object many times (moving objects for example).
If something in the attributes has been modified, it will give a “onModifyObjectAttributes” event


This sample might be helpful.