Grouping blocks

I was trying to group a building I am trying to make in grasshopper, where each block on the same level should be in the same group.

for now the building is grouped in 4 groups, where each group is the boxes standing on top of each other.

You will have to sort the blocks according their Z-coordinate…

If you need more help, post your Grasshopper file with the relevant geometry internalised.

Not sure how to extract the z-coordinate… Here is my grasshopper file: (26.5 KB)

Actually all you need to do is flip the matrix. (26.3 KB)