Fitting rectangles into larger area


I am trying to fit a combination of various predefined rectangles into an area. The the 4 rectangles have a size of (880mmx1300mm),(880mmx985mm),(730mm, 1300mm), (730mm, 1300mm).

I want to fit a combination of these into a larger area. Not all panels have to be used (it might be that the most efficient way would be to simply use one version or two).

The area which i want to fill will have two rectangles inside (windows on a facade) where the panels should not go. I am trying to figure out the easiest way to do this. Any help would be appreciated…

Hi @serabouch,

Being a little more specific really wouldn’t hurt! How do the different types of panels and surface/facade to populate look like?

there are four types of panels. They are simple rectangles. (800mmx1300mm), (800mmx985mm), (730mmx1300mm), (730mmx1300mm). These have to fit as perfect as possible in a bigger area (Also a rectangle) with two windows (therefore holes in the area where panels will not go). I would like to generate a script which fits these panels inside this area most efficiently. I hope i am being more clear!

example.3dm (48.6 KB)

@serabouch, unfortunately this is probably harder to do than you might image, especially in vanilla Grasshopper. You would probably constantly have to reevaluate the distribution and make changes as you go which is easier to do in scripting (Python, C#, etc.), if you know how to.

In your case, could the different modules be rotated?

Anyways, check out the following links! Maybe there’s something that helps?

@laurent_delrieu, you seem to be the rectangle packing master! :slight_smile: Would you be so kind as to give your five cents?


Thanks ill check out the forum, it looks like the problem i am having is discussed. Also, yes the panels can be rotated. Thanks for the help!

If you are interested i made another forum with a similar problem but only considering one rectangle: Subdividing surface into predefined equal rectangle

For all your questions you could use nesting algorithm. You’ll have to provide enough rectangles in order to fill your shape. You can duplicate your rectangles.
Use OpenNest

And if you want less order

1 Like

here a script, not optimized as OpenNest, play with Jitter (0 or one) and Seed. (24.6 KB)


Thank you! i will play around with it now and see how it goes.