Selection update to grasshopper

The only way I can seem to get the real time current selection from a rhino document into grasshopper is by connect a trigger to “objects by selection” in the human package.

Is there a way to import the current selection to grasshopper and have it update only when an object is selected or deselected?

I tried to prompt claude and chat gpt with some items from RhinoCommon for both python3 and c# scripts to no avail. Tried logging commandprompt and watching the item selection event manager. This probably didnt work because I dont really understand code other than gh very well but any help with a script option would be appreciated!

Thanks!

1 Like

Its everything I’ve always wanted, thank you.


Actually, is there a way to get the GUID’s of the selected objects as well? In my example the selected points are not importing their guids, I can get guids from the dynamic pipeline from human package.

SelectedObjectsUpdated.gh (15.7 KB)

2 Likes

Beautiful, sending some coffee

1 Like


Thank you so much, however there is a problem with the guids not clearing. Is there a simple fix?

I’ve just updated the code in my previous post. Please download the revised version from.

1 Like


Handling events inside a scripting component can be a bit tricky, so I’ve developed a C# component for easier integration. Here are the plugin installation file and source code:
SelectedObjectsListener.gha (7 KB)
SelectedObjectsListener.zip (66.0 KB)

1 Like

Works pretty well! One issue might be the way it causes geometry to refresh when you move it. It tends to slow down the process significantly when moving large numbers of points.