Dynamic Grasshopper Components

Hi, I was wondering if it is possible to dynamically register Grasshopper Components at runtime? The goal I have in mind is for a Rhino Plugin to be able to add a couple of Grasshopper Components at runtime based on some external dependency. I have been looking through the documentation/definitions and the closest I have gotten is GH_ComponentServer but I can’t seem to find the functionality there.

I am aware there might be some risks involved with this, the only risk I can currently see is if a Component is removed then it will come up as an uneditable blank square on the canvas. Are there any other risks involved as side effects from dynamically creating Components?

Any help/hints greatly appreciated!

Thanks,
Sanchez

Hi Sanchez nice to see you here!

the BHoM plugin has a small number of components most of which which have a UI to dynamically search from a vast number of diverse functions and datatypes, which once selected generate a component with the right number of inputs and outputs. see here Grasshopper_Toolkit/GH_Component.cs at main · BHoM/Grasshopper_Toolkit · GitHub

Not sure if this classifies as an external dependency, as the functions are all compiled dlls included with the plugin. it is decoupled from the .gha plugin and the functionality is shared across their various UIs (excel, dynamo and grasshopper)

3 Likes