Get LastObject during each AddRhinoObject event

Hello,

I’m trying to write a ghpy component so that whenever an object is created inside the Rhino Doc, it is automatically passed to the grasshopper component.

I was not able to get the AddRhinoObject event to return the object itself. What I am trying instead is use the AddRhinoObject event to trigger an ExpireSolution in Grasshopper, and then get the last object created by using LastObject() inside the active RhinoDoc. Please see the attached code sample.

Currently, the script is triggered whenever an object is created inside Rhino. However, it will continue to pass the same object each time the event is triggered. Thank you for looking into this!

Best,
Anran

min_lastobject.gh (6.8 KB)