My rectangles were all squares because both X and Y Random components were using the same default seed value. When I added separate ‘Seed_X’ and ‘Seed_Y’ sliders to fix that I soon encountered an error (red component):
Index too high, it must already exist within the original list
Rather than avoiding the error condition, I added a Combine component to handle it.
Please let me know what is in the expression of “larger than”?
Also how come that my replace widget looks different? In mine in the second row threre is “l” instead of on “0” which I can see on yours?
This is why having a GH file is so much more informative than an image!
And much easier and more accessible to others who might learn from a thread but won’t bother wiring all the components together and running into the same questions you have. Much as it pains me, with rare exceptions, I don’t post GH files (or wordy explanations) when none was provided.
P.S. I just noticed that unless you graft the input to Boundary surface, nested rectangles will create a holed surface. The output must then be flattened.
Do you see how this code works? It proceeds sequentially through the list of rectangles and removes any other rectangles that collide with the one being examined.
This means that with the same set of random rectangles (no changes in the white group), you can get a different result by jittering the list sequence (yellow group added) prior to the Anemone loop.
I decided this old code needed an update. Added ‘Define Region, Cull Intersecting Rectangles’ (cyan group) to define a boundary and cull any rectangles that intersect it. In reality, the boundary can be any shape and orientation. (circle, diamond, zig-zag polyline, etc.)
Replaced ‘Classic’ Anemone loop with ‘Fast’, added Data Dam to make adjustments easier.
Beyond the boundary, there are eight parameters that affect the pattern of rectangles including two sliders in blue groups, Jitter ‘Seed’ and ‘min_sep’.