Assign Values in a list within a list within a list

Hello,

I am hoping someone here can point me in the right direction.

I have a model with loads of curtain panels in it. I would like to assign these an “ID” based on three criteria (colour, width and height). I managed to create a list which groups the panels in the 1st tier (@L4) by colour, the 2nd tier (@L3) groups them by width and the 3rd tier (@L2) by height.

Panels that have the same colour, width and height should now get the same “ID”.
The IDs are defined as:
“O”, “R” or “G” for the colour + 01 … n for the number of different width + “-” + 01 … n for the number of different heights, i.e. O01-1, … O10-1, O10-2, R01-1 etc.

I thought that if I somehow count how many elements are in each “group” I would be able to create another list with the IDs using “list.cycle” … but I struggle to get that to work.

The graph as far as I mentioned it:

The entire graph:

Manually created schedule in Revit (but there are too many panels and too frequent changes to maintain this):


Number by Type.dyn (65.6 KB)

As always, your help is much appreciated.

Hi @philipp_lammers ,

You are not after a Cycle function, since you want each item in your list to be different.
A range would probably suit you better, see if something like this helps you get started:

3 Likes

@Daan thanks a lot. That helped indeed. And also thanks for the quick reply.

Just for completion and future reference by others, this is how I manged the list within a list:

1 Like

Nice!

PS: Why use @@L2 when you are flattening right after? Just use @L2 instead and you won’t need to flatten

True. That’s me tying different ways before finding one that works ;-). I first attempted to assign the values while elements and IDs are still grouped until I realized it’s easier to “flatten”.
I have to go backwards through the script and tidy it up a little.