Activate Gumballs with a C# command?

Hi all

For a project using a Human UI interface, I would like to have the user activate/deactivate the gumball to alter the shape of an object. In Grasshopper, it is currently possible to activate the gumball of internalized points; but only if I click the ‘point’ component.

Is there a way to 'select’ components with C#? Or is there any other method to activate the gumballs?


Thanks in advance!

I found a code that allows you to select all sliders in a Grasshopper document:

using System.Linq;
GrasshopperDocument.Objects.OfType<Grasshopper.Kernel.Special.GH_NumberSlider>().ToList().ForEach(s => s.Attributes.Selected = true);

Probably, I could adjust this code to select one custom component. Selection based on a component Id? Any help is very welcome!

May this help you

1 Like

I think there’s a metahopper component that can cause an object on the canvas to be selected, that might work

1 Like

Hi Andrew, Thank you for the quick response and suggestion. I love your work!

In the end, I used the following code:

if (x)
Component.Params.Input[1].Sources[0].Attributes.Selected = true;

with the following result:


How do you get 3 gumballs to display simultaneously?

I’m guessing this is something that requires some custom scripted nodes in GH?


Yes, it work. But you are not able with metahopper to unselected the component.

This code from Gieljan work , but I dont know how to use it. C# is ntot my friend :smiley:

Can you share @gieljan_vantyghem your .gh file please ??