Hi there! Not sure how to phrase the question, so let me explain what I am trying to achieve and how far I’ve managed to get. Would appreciate any help!

Create a rectangle.

Subdivide rectangle into nnumber of rows/columns of equal width

Subdivide the created rows/columns into rectangles of random widths (within a given domain)  I need to develop this a bit further as it’s somewhat clunky when you start changing variables

Split the rectangles into 5 groups, randomly distributed.

Each group of rectangles will be assigned a different geometric design.
I got up to Step 4 by plugging the generated curves into a SrfSplit component, so I end up with a bunch of separate surfaces. These surfaces I can then usually split up into groups quite easily and then assign a different colour to each group. But now I want to add lines inside of these rectangles, and I don’t necessarily want each rectangle in the group to have the same colours  just the same collection of curves. The problem however is that the order of the segments of these surfaces are inconsistent, and it appears to be because of intermediate points throwing off the segment count per rectangle. I’ve tried simplifying the outline in various ways, but I can’t seem to get this right. Image below shows the List Item component isolating one of the segments, and you can see that it does not select the right hand side segment in all of the rectangles.
Image below shows an idea of what the next step is. Would help if the order of the segments and vertices are consistent!
grid division 20221217.gh (23.9 KB)