Deselect objects

Hi all,

So I saw that there is the component “select objects” to select components in grasshopper canvas, which at the moment is pretty useful to me because I am using the gumball component and I want to active it with booleans.

My question is if there is any option to deselect with the boolean as well. The select object starts selecting all the components additionaly to what was selected before. The issue to use enable/disable as a solution is that that even disabled, the object is still selected, and then the function of the component does not work anymore when it is already previously selected.

What happens if you invert the boolean? Set it to false and the expected behavior is deselect.

Nothing happens, that is, everything continues selected because the component itself does not have a boolean → I am using a workaround. It looks like this:
Step 1 - Nothing there, everything deselected:

Step 2 - Select the component I want (wished behaviour):

Step 3 - Press false, the Metahopper component is not being fed by anything anymore, but it doesn’t deselect the already selected gumball component:

Here’s a script that does what you need:

using System.Linq;
foreach(var o in O.OfType<IGH_ActiveObject>()) {
        o.Attributes.Selected = S;
    } (3.6 KB)

1 Like

Hi @andheum that is so nice! I really appreciate your answer and thanks a lot for the solution!