# BeforeTransformObjects Event

**URL:** <https://discourse.mcneel.com/t/beforetransformobjects-event/43338>\
**Category:** Scripting\
**Created:** [April 21, 2017, 3:01am UTC](https://discourse.mcneel.com/t/beforetransformobjects-event/43338 "2017-04-21T03:01:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [April 21, 2017, 3:01am UTC](https://discourse.mcneel.com/t/beforetransformobjects-event/43338/1 "2017-04-21T03:01:54Z")

</div>

Hi @dale,

i am trying to get the objects which are transformed using an `BeforeTransformObjects` Event handler in Rhino 5 SR12. Below code toggles the event handler:

```python
import Rhino
import scriptcontext

def MyTransformEvent(sender, e):
    print e.Objects

def DoSomething():
    key = "MyTransformEvent"
    if scriptcontext.sticky.has_key(key):
        print "Event DISABLED"
        scriptcontext.doc.BeforeTransformObjects -= scriptcontext.sticky[key]
        scriptcontext.sticky.Remove(key)
    else:
        print "EVENT ENABLED"
        scriptcontext.sticky[key] = eval(key)
        scriptcontext.doc.BeforeTransformObjects += eval(key)

if __name__ ==" __main__":
    DoSomething()

```

While the event is enabled, in Rhino 5 SR 12 the `MyTransformEvent` function always returns `None` for the objects beeing transformed while in Rhino 6 WIP, i get this result, eg. when a single point is transformed:

```auto
Array[RhinoObject]((<Rhino.DocObjects.PointObject object at 0x000000000000002E [ModelGeometry: (unnamed) (0)]>))

```

Is there anything i can do to make it work in Rhino 5 and get the objects beeing transformed ?

- 

c.

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/772741_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [April 21, 2017, 4:28pm UTC](https://discourse.mcneel.com/t/beforetransformobjects-event/43338/2 "2017-04-21T16:28:51Z")

</div>

> [@clement](#):
>
> s there anything i can do to make it work in Rhino 5 and get the objects beeing transformed ?

It might be possible to iterate the document looking for selected objects. But that is the only potential solution, I believe…

– Dale

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [April 21, 2017, 6:03pm UTC](https://discourse.mcneel.com/t/beforetransformobjects-event/43338/3 "2017-04-21T18:03:10Z")

</div>

@dale, thanks that is what i did in the hope the objects are the same.

I’ll do some filtering for unwanted objects anyway 😉

- 

c.
