Pattern generation with a minimal distance

They are many ways,
you can look at that

you can generate rectangles then pack them with OpenNest.
Too perfect !!


generate pattern with minimum distance.gh (9.6 KB)

You can generate your own code with your constrains… Kangaroo could surely also be used.

2 Likes

Please remove the duplicate thread and post a GH file next time.

Duplicate Thread.

1 Like

The model I posted above fails to detect nested rectangles:

Here is a way to fix that using Boundary surfaces and BBX instead of CCX:

P.S. Oops! I forgot about “minimal distance”. Oh well.

Thanks for the useful info. By the way minimum distance in overlapping are not equal geometrically. :slight_smile:

Hi Joseph!
Thanks for the solution. Actually I dont find the loop widget. Where I can I get it?

Anemone plugin.

Here’s a way to account for minimal distance (purple group):

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):

  1. 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.

I learned something new today.

Dear joseph!
It is great!
Thanks for your effort!

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.

cull_rectangles_2020Sep20d2

I tried to copy everything carefully. No success.

Post a file next time and you would have working code much sooner! Here it is:

cull_rectangles_2020Sep20d.gh (22.7 KB)

Thanks Joseph!
I have learnt the lesson.

I have modified some parameters for the sake of the desired geometry. But the solution stops before finishing the job.


cull_rectangles_2020Sep22d mod1.gh (25.7 KB) fileted rect.3dm (30.4 KB)

It looks correct to me. Only 270 non-overlapping rectangles of the original 395 you generated. Disable preview on the Geo param you added to the code.

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.


cull_rectangles_2020Sep23a.gh (28.3 KB)

1 Like

Thanks for the addition. It is great!

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’.


cull_rectangles_2023Mar5a.gh (31.2 KB)