Assigning specific colors (material) to specific panels (branches)

Hi everyone!

I am working on the script for assigning colors (materials) to curtain wall panels.

I had help with gradient going through the panels and my script works. However the logic of the exercise got more complicated. Please see image attached.

I have 9 set colors which I need to apply to curtain wall elements. Each curtain wall will have 3 colors assigned to it in respective order. So first curtain wall and it’s panels will have colors 1/2 and 3 in random order. Following curtain wall will have colors 4/5/6 in random order and so on. Furthermore curtain walls that align vertically should have the same pattern.

In my script I tried so far to call out a single branch apply to it first 3 colors in random order. So I could keep repeating this process by calling out branches in order and keep copying my swatches but that would be a nightmare of a script. If anyone has any suggestions on how I could simplify that I would be very grateful.
I have attached revit and grasshopper files to wetransfer link if you would like to take a look.

The top script is the version with gradient and the bottom script my attempts to apply new logic.

Thank you to everyone in advanced!

Hi Alina,

If you can isolate examples on questions like this that don’t include Rhino.Inside.Revit you may get more responses from the Grasshopper forum.

Here is an example of list matching and then jittering the values.

image (16.0 KB)

Hi Japhy,

Good point, I will do that in future. And thank you for your help once again!