Data tree structure

I’m trying to understand how to reorganize the structure of a data-tree, I created a parametric facade like the image below, which works great when I have the sliders that control the size of the window, before I array them in a rectangular grid.

However, I want to array the windows first, and then have the sliders that control their geometry, with the purpose of allowing Galapagos to control each window independently. (In the case above, all windows get modify at the same time).

The problem is that the cells around the window and the window planes are two different trees, and they get organized in different orders, so the cells get messed up, like the image below. BUT notice how “zero” in both trees is in the same place, so that cell gets created correctly.

My question is how can I re-arrange the trees order, so the cells work as in the first image. Please see rhino and grasshopper files attached. Any help is very much appreciated testtest.gh (19.5 KB) 20191217 Springdale Massing_HZ.3dm (6.8 MB)

If i understood well what you are aiming to…

testtest_RE.gh (31.0 KB)

another way using mostly your logic


191220_testtest_re.gh (26.8 KB)

Thank you both for your responses. Daniel, your solution is very close to what I’m looking for, except that the RuledSurface misses the corners of the polygons (highlighted in red). Any idea of how to fix that, I tried going back to EdgeSurface but no luck.

Interesting, for me the surfaces have all their corners.
Find attached with EdgeSurface.
191220_testtest_re2.gh (27.6 KB)

Thank you so much for your help! I appreciate it!