Intercepting editings and commands in Rhino 6 using RhinoCommon

Hi guys!
I would like to know if it is possible to intercept all editings and commands inside a document.
More deeply, I would like to know

  • Object(s) edited or modified by the command
  • New object(s) eventually created
  • Editing data (i.e. translation amount) or command parameters (i.e. offset amount)
    If this is possible… How?
    Thanks a lot!

Review the events on the RhinoDoc class: http://developer.rhino3d.com/api/RhinoCommon/html/Events_T_Rhino_RhinoDoc.htm

Thanks a lot, Nathan!
I have read the documentation and I have studied some sample code.
It looks like the events that could be catched are:

  • RhinoDoc.ModifyObjectAttributes
  • RhinoDoc.BeforeTransformObjects
  • Command.BeginCommand
  • Command.EndCommand
    But it looks like they don’t expose all the information needed.
    For instance, if I execute the “Offset” command, it seems that, in the “EndCommand” event, no information about the offset amount is passed… Am I missing something?

Hmm, it looks like the AfterTransformObjects event isn’t wrapped in RhinoCommon.

Edit: I have logged this as RH-45468.

1 Like

Do I have more options in C++?
Is there something similar to "AfterTransformObjects " event, in C++, that carries more information?

Actually, with the BeforeTransformObjects you get the transform with which the object(s) are going to be transformed.

Is that enough information for you? I don’t think you need the AfterTransformObjects, as it won’t give you any useful information other than the transform event ID.

I’m not sure: i tried it and it is easy to understand, if you are editing the complete object.
I think is less intuitive when you’re editing points of a curve: in the RhinoTransformObjectsEventArgs object you don’t have any reference to the edited object or (better) to the edited point(s).

Ah, not sure how to do that. Maybe @dale can give some better samples for that.

Hi @software_comas,

In general, it is not possible to know all the details of “how” an object has been modified. But you can be notified when something happens to an object by handling these events:

RhinoDoc.AddRhinoObject
RhinoDoc.ReplaceRhinoObject
RhinoDoc.DeleteRhinoObject
RhinoDoc.UndeleteRhinoObject
RhinoDoc.PurgeRhinoObject
RhinoDoc.ModifyObjectAttributes
RhinoDoc.BeforeTransformObjects

The document has other events, for tracking layer, group, dimstyle, etc., changes.

– Dale

1 Like

Thanks a lot, Dale! :slight_smile:
I’ll try to find a way to understand how an object was modified, catching those events…