My problem: “There is an arbitrary amount of arbitrary sized rectangles. How to put them in a smallest possible rectangle?”
This is the so called 2D Binary Packing problem, or Rectangle Packing problem, but til now I have found only this program in picture (LinPacker), but the algorithms there are not available to implement in Python. Can anyone help me? This is needed for a city planning project, the rectangles represent existing quarters.
There is box packing code already in Blender for the UV tools. I remember ideasman originally wrote it in Python, for the lightmap unwrap script, but there’s also a ‘pack islands’ command in the UV editor that’s built in. Maybe scripts just call that now, i’m not sure. But check out the unwrap scripts bundled with Blender, for sure.