With a bit of help from Bing AI and whatever I could find about event handlers here on this forum I put together a c# script that should only recompute after the content of a specified layer has been manipulated.
I’m not someone who does everything in Grasshopper. The use of simple input geometries which are easy to manipulate is in many situations quicker and more intuitive compared to a fully parametrized approach.
I’ve been using EleFront for a few years and most of my definitions use EleFront to reference and bake geometry. Over the years I’ve gone from I forgot how many plugins to just a handful of plugins - trying to do as much as possible with native components.
Honestly, it was a relieve when the new Grasshopper Rhino components were released and I’m super happy with the possibilities overall. But. The recompute strategy is a real pain.
I want to be able to quickly turn on / off a layer and I have absolutely no patience to wait for the rest of my definition to update when it isn’t really necessary.
In real Rhino fashion, instead of forcing the user to adapt to a certain procedure, the query model objects component could allow the user to choose from a few different levels of attention…
A listener component would be another approach. The component would let the user choose from different events such as:
- Geometry has changed
- Attributes have changed
- Key or key combination has been pressed
I’m not a programmer but here’s a definition with everything in it and a Rhino file which can be imported.
on_select_mrtn.gh (27.4 KB)
import_content_layer_filter.3dm (753.7 KB)