Group by multiple parameters

Hi guys,

I am trying to group all elements from a single level in order to assign 1 single color per level.
However it doesnt seem to work properly since there are 2 parameters.

  1. Reference level
  2. Level

I tried few things ;

  1. Category/Level/All elements at level/group/color ---- which lead to override node not working
  2. This script;

Do you guys know why it seems to “glitch” ?

Here is the result



you can use GroupByKey twice and “keying” by workplane an level and create a list.



You just need to combine the lists of values first. Some elements will use param1 and the others will use param2. Use an If statement to combine them like so:

param1value == "" ? param2value : param1value;

If the value from param1 is empty (no parameter) use the value from param2, otherwise use the value from param1.

Hey sir, thanks for your answer!
I am not sure I understand tho… could you elaborate how it works? Can I use the node IF instead?

Yes, you can use the node instead. It’s the same logic as I mentioned above. The last sentence is an explanation of the logic represented in the codeblock (or node).

Yeah I clearly don’t understand. it would be like

getparameter (level) going into IF “” then getparameter (Refenrence Level) going into IF “” then getparameter (workplane) , then this one into the key?

Im so trash ahah

That’s basically the idea, yes. If a value is blank ("") you get the next parameter. You could nest this condition for as many parameters as you have. This should leave you with each element having a value from the correct parameter and allow you to group them all by key (since the keys are all valid now).

Single condition:

More than the one condition:


You are a genius! i love you ! thanks brother

@Nick_Boyts do you know why everything works except Pipe fittings and Pipe accessories?
both doesnt get colored but everything else is working perfectly. Is it because it is taking the “host” level?
thanks for your help

*SOLVED Thank you sir!