doc.Objects.Transform don't fires the RhinoDoc.BeforeTransformObjects event

Hello,

I think that there is a bug in RhinoDoc.BeforeTransformObjects event. It seems that the event is fired only if the transformation of the objects is done directly by the user using the Rhino commands. Instead, if I try to transform the document’s objects with

doc.Objects.Transform(obj_ref, xform, true)

in a custom command, the event RhinoDoc.BeforeTransformObjects is not fired.

Is it a bug or is it the correct behaviour?

Thanks in advance

Hi @g.todeschini,

The RhinoDoc.BeforeTransformObjects event is only triggered from commands that inherit from TransformCommand and call TransformCommand.TransformObjects.

– Dale

Hi @dale ,
Shouldn’t RhinoDoc.BeforeTransformObjects get called on an undo of a transform as well? Or I am missing some ceremonial code to get it to work properly?

Quick gh example, where it only gets triggered on the transform but not when undoing it.

  private void RunScript(bool run, ref object A)
  {
    if(run) RhinoDoc.BeforeTransformObjects += onTransform;
    else RhinoDoc.BeforeTransformObjects -= onTransform;
  }

  void onTransform(object sender, Rhino.DocObjects.RhinoTransformObjectsEventArgs ea){
    RhinoApp.WriteLine("Transforming {0} objects.", ea.ObjectCount);
  }

Sorry, no, it does not.

– Dale