# Need help sorting areas within bounding box

Hey guys!

I’ve been searching through forums and youtube videos for the past couple days looking for a way to organize spaces (with a pre-defined domain for the area) within a bounding box but can’t find a script that works with the constraints I need and I had no luck writing one my self. I’m just looking for some advice from someone with a bit more experience than me that could help out or point me in the right direction.

So the red box is my bounding box, and the green boxes are courtyards that need to be fixed in their locations, and none of the areas are allowed to pass through these green spaces…also worth noting that none of the areas listed are necessarily required to be rectangular (however it would be amazing if there was a way I could choose the domain of how many edges the individual areas have, I was looking at 4-8 edges per area).

In the images I’ve listed an example of required spaces and the domain for their areas, but am absolutely stumped on how to output iterations from this information. It would be ideal to be able to either orient or go back and view the different iterations to manually trawl through and pick ones with specific positives/negatives for further testing.

I’ve attached 2 examples of desired outputs that I have done manually,

Thanks very much and I greatly appreciate any help received!
All the best, Kayleb.

Hello
Here a way to use K-Mean clustering for this type of problem, it is not optimized to search a surface but it divides a surface.

k_mean2_test_surface_division.ghx (459.9 KB)

You could also take a look at that

1 Like

Ah okay, a lot more complex than I expected. Thanks a lot for the help!

Most of the time hard question to solve manually or question that have many answer are hard to solve numerically. To my point of view you must code it with the rules you want. By hand you see to have thes rules
Make a wall from a corner of a little square; make a wall from the edge of the big square.
Wall are perpandicular. It is surely possible to make some space divisions with theses rules and then selecting divisions to make rooms. Nothing simple.

1 Like