Guide to Grasshopper Event Handlers and Servers

I’m looking for a good explanation to all the Grasshopper SDK Events and Event Handlers. Probably included with this is the various servers within the Grasshoppper SDK.

Since Grasshopper is very ‘functional’ programming and everything is part of continual event triggers, I want to understand the hierarchy of events and when to use each.

Does anyone know of good documentation on this?

So far, I understand there to be these main Event and Server categories (non-exhaustive):

  1. CentralSettings
  2. Document
  3. DocumentServer
  4. DocumentObject
  5. Data
  6. Component
  7. Menu
  8. m_attributes
  9. Parameters
  10. Wires
  11. Display
  12. FileWatcher
  13. Instances
  14. InstanceServer
  15. FontServer

I cannot find anything online or in the Discourse or Documentation that explain this.
Thanks!

1 Like

I’m bumping up this topic, maybe somebody is knowledgeable on this?

In particular, I have a problem that:

  1. In GHPython, our code selects RhinoDoc Geometry by RhinoDoc Layer from our GH Component. This only happens one time (1x) by default.
  2. I need to find a way to trigger this component to re-select the RhinoDoc Geometry by RhinoDoc Layer when a user creates a new RhinoDoc Geometry. It does not do this automatically since the RhinoDoc Geometry is not connected to a GH Geometry Pipeline or other GH Input component. And I cannot find a way to trigger the component from other components on the canvas.

The only method that works now is that a user tells the Grasshopper Canvas to Recompute. This however, is not user friendly and will cause bugs in the design process.

@D.Ronald
@DavidRutten was kind enough to give me an example that might help. Unfortunately it is in C#. I modified it slightly to check if the object was added to a layer I specify. Let me know if this addresses your issue.

AddObjectHandler_mod.gh (4.0 KB)

@fraguada

We adapted this to Python and worked it into different components.
It works well so far, thank you so much to both you and David!

1 Like