Subdivide translation of cuboids in rows and levels

Hello, i want subdivide my number of containers by rows and levels.
Here some situations it should works:

  1. If i have 5 Containers (cuboids) and adjusted only 3 rows and 2 levels, it should translate three cuboids on level 1 and two cuboid on level 2. So logical if the first row is full he should take the next level.

  2. If i have 5 cuboids and i adjusted only 2 rows and 2 levels, it should say to me there are issues.

For the first i have no idea how to do this. Here you see my script.
Hope somebody can help.

A few questions

  1. Is the container always a cuboid?
  2. Are the sub divisions always the same size Relative to each other?
  3. Are your subdivisions always cuboids?
  4. Do you want to make use of the area behind the subdivided area as well?

Hello JacobSmall,

thanks for your time.

  1. Yes
  2. Yes
  3. Yes
  4. I need use of the final groundarea.

The script does work, more or less. I load it up here, so you can have a look.
My first Problem: If the Number of container is less then rows, all disapears.

And my second problem:
My goal is an optimization with Refinery. But here nothing works.
It should use as few levels as possible but at the same time find the smallest area.
I prepare a picture for better comprehensibility.

Container_Test_5.dyn (117.5 KB)
Bürocontainer.rfa (2.1 MB)

Look into the miscellany package. It has nodes for bin packing cuboids which should suit you nicely, and will overcome the bulk of the issues you are having.