Automatically change group color by general rules?

Hi,
I was doing some work today in gh, creating a definition that is going to be used mainly by other users. I then found myself, once again, needing to set different color groups based on general rules for clarification purposes.

You see in this image, all sliders have a group, and all geometry to be baked is “on” in preview and has a blob group outline. Still I feel this is not enough, I wish I could automatically assign a different color to these two categories: Sliders and geometry to be baked.

This discussion here is quite old, but David provided a very handy script that changes the color based on the name of the group. But… for cases such as mine its not ideal. I wonder if something like this can be improved upon.

The idea is to be able to assign a different group color to components that:
Have preview set on
Have a blob, box or rectangle outline
Special components such as panels, sliders, containers, etc.

I believe this is all possible via metahopper (to some degree) Have you checked it out?

Hey Micheal, I have not, but I think it would not be an ideal solution, at least not for shearing defs.

Well it doesn’t require Metahopper once set. So you can set it and send it. Or are you hoping that the people you send to will also set it?

Try monkey around with this one.

GroupColor.gh (14.7 KB)

The color component can be embedded in your GH files, perhaps hidden in a Cluster wich can be reused.

If you don’t want the colorizing components in your file, then insert the cluster with the color components, set the colors (for all color-coded groups, see C1, C2, C3 or whatever color group codes of your choice) and when done setting the colors then just delete the components/clusters from the definition.

// Rolf

4 Likes

Mmhm did not think of that, will give it a try. Thanks. I just need to set it myself.

Hi Rolf, the color VB script and componets is no problem. I am not worried about it being in the file.

I currently use it the way you suggested. But it is quite impractical to name every group when definitions start having many sliders and bmany components need baking, even if the name is a single character like “0”.

Would like to have a variant which colorizes all groups which contains a slider, regardless of group names ? Like so:

Edit: Added default color to avoid transparent when color input isn’t connected
SliderGroupColor.gh (13.5 KB)

// Rolf

1 Like

Hey Rolf, I am getting some errors with the C# components, maybe because I am not using the latest version?
It says: The first component error states: “The type or namespace ‘GH_Group’ could not be found… (Line 94)”

Hm. Strange. I couldn’t drill down to find out in which namespace the GH_Group type resides in. These are the namespaces that I had in the component (I added “Drawing” and “Special”)
bild

Perhaps @DavidRutten knows why some namespaces are missing. I know that not all .dll’s are even reachable from the Script Components, depending on GH version they have to be explicitly assigned to the component. My Grasshopper version seems to be 1.0.0007

bild

// Rolf

@RIL really nice!

How could your C# change only the colour of the group that belongs to, without using a group name?. I’d like to implement this inside my code, thank you in advance!

hello nice work is it possible to give a list of names and list of color in it?
@rajeev_pulari