Intercepting editings and commands in Rhino 6 using RhinoCommon


(Sebastiano Del Gobbo) #1

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!

(Nathan 'jesterKing' Letwory) #2

Review the events on the RhinoDoc class:

(Sebastiano Del Gobbo) #3

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?

(Nathan 'jesterKing' Letwory) #4

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

Edit: I have logged this as RH-45468.

(Sebastiano Del Gobbo) #5

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

(Nathan 'jesterKing' Letwory) #6

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.

(Sebastiano Del Gobbo) #7

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).

(Nathan 'jesterKing' Letwory) #8

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

(Dale Fugier) #9

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:


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

– Dale

(Sebastiano Del Gobbo) #10

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