Rearranging Data Tree to Regroup Grid Points

I have a grid of scaled rectangles which I have exploded in order to obtain the vertices which define the corners of each rectangle. The data tree is organized so that it has 25 branches (one for each rectangle), each with 4 list items (the 4 corner vertices of each rectangle). I would like to end up with a data tree which contains 16 branches, each containing the 4 points circled in yellow on the included image. I’ve worked on this all day with no luck. Data tree management is my weak suite in Grasshopper, so I’m hoping I can learn from the forum’s collective knowledge. Thank you!!

Data Tree (12.4 KB) (14.7 KB)

1 Like