Prevent object transform

Hi all

Is it possible to prevent transformation of an object if it has some special properties?
Like to subscribe to OnBeforeTransform event and then call something like “PreventDefault()”.

I don’t know of a way of doing this, sorry.

– Dale

Hi Dale,

For now I’m using some dirty hacking like this

void OnBeforeTransform(object sender, Rhino.DocObjects.RhinoTransformObjectsEventArgs e)
  {
    foreach (var rhinoObj in e.Objects)
    {
      var transform = Transform.Translation(1, 0, 0);
      var transformBack = Transform.Translation(-1, 0, 0);

      rhinoObj.Geometry.Transform(transform);
      rhinoObj.Geometry.Transform(transformBack);
      rhinoObj.CommitChanges();
    }
  }

I don’t know how it works under the hood, but if you subscribe to BeforeTransformObjects and then move an object back and forth, it would keep the original object in place. The transfomation gizmo will still be transformed though but I’m ok with it for now.