Tree coordination, preview object with colors by boolean list

I cannot figure out the compact GH solution to this and would appreciate pointing me to the likely obvious solution.

I have ten objects, ten colors and a list of ten boolean indicators. I want to list toggle the preview display of the objects with the cooresponding colors. I can do this by repeating a path of individual list item extraction and ten stream gates and custom previews, but I am sure there is a more compact method.
(The Stream Gate only takes a single gate input.)

You’ll have to organize into branches of a tree and select on the basis of path.

Post a .gh file if you want help with these things.

Certainly, here is a demo file. Working but inelegant.
TheLongWay.gh (25.5 KB)


which outputs:

TheShortWay.gh (43.4 KB)


TheComfortableWay.gh (48.4 KB)

Requires Metahopper

Note that for either of the two solutions above, if you want multiple geometries to a colour, you will have to group these first with the Group component. Otherwise, you will be grafting the individual geometries to separate branches.

1 Like

Stellar responses Volker, very much appreciated! I still have a lot to learn about trees and branches.

@nxakt Sorry, I don’t know why I was thinking so complicatedly about this last night.

This is much easier and beginner friendly:


TheSimplestWay.gh (43.9 KB)

1 Like

That’s the way! I did learn a lot from the previous tree branching splitting and simplifying solution. But it was not intuitive to me. I was wondering if one had to be some kind of Grasshopper savant to be able to see the solution like that!
The culling example is perfect, appreciate you taking the time and the further thought on it.

In affect, both solutions do the same thing. But whereas the first solutions takes geometries or colors common to a tree path, the last solution simply does this by assuming geometries and colors common to a list index.

I think the reason I immediately jumped to the path solution was because I considered the problem of having to group multiple geometries to a category. With tree paths, the number of items in a branch doesn’t matter. You choose the branch, and get all the items listed in that branch.

But then I remembered that you can group geometries as a single item, which made a solution that relied of list index viable again in my mind. Generally, it is easier, and there more tools to deal with lists than with tree branches.

Being able to extract the path and apply it was very informative, I did not have that in my toolbox.
Additionally the “group” command was exactly what I needed for the solution, was also unaware of its potential.

You mean the Group component, which found under Transform > Util in Grasshopper?

I just want to be careful here that you understand what I meant. It is analogous to grouping objects with the “_Group” command in Rhino.