Help: Event Handler, How check what object was changed?

Hi @dale
How do I know what object was the one that triggered the event handler?

I am just starting to look into this and am going to make a small tool that remeshes some curves on a spesific layer IF new are added or existing are changed. But for that I need to know what object that triggered OnAddRhinoObject etc.

I have started to fiddle with your example from here:

But I don’t want my script re ran every time ANY object is added or modified :slight_smile:

Hi @Holo,

The RhinoObject events expose to properties to either fetch the ObjectId or the object itself:

In code this should look somewhat like this (not tested):

def OnAddRhinoObject(self, sender, e):
    id = e.ObjectId
    obj = e.TheObject

    # do logic here to see if you want to operate any code on this rhino object and go from there
1 Like