3D Bin Packing DP3DK algorithm with grasshopper


I´m looking to develop a 3D bin packing algorithm, specifically known as DP3DK algorithm, which performs an analysis on a master cuboid container which could have predetermined dimensions (1000x1200x2200, , 400x300x200, etc). Given this shape I want to find:

  • Sub-Cuboids which:
  • Are greater than specified (variable which I can play with) minimum dimensions
  • Divide the master cuboid by whole numbers
  • May be used in combinations of sizes which result in a packing solution with 100% volume utilization

From a set of selected (manually input) sub-cuboids, generate models of all successful packing solutions using the specified sub-cuboids, because not every sub cuboid combination would be succesful since not every combination achieves this 100% of utilization (which is a critical point for this algorithm´s success.)

Here´s an example of an example I found on Baumer´s site of what I want to achieve.

This is how a succesful manual attempt in Rhino (no grasshopper code) looks like:

As you can see in the previous image, those cuboid shapes on the left are all packed together into a single master cuboid. This succesful attempt was achieved thanks to this predetermined set of cuboids:

  • Master cuboid of 1000x1000x1200 mm

  • 10 subcuboids of 600x400x200 mm

  • 15 subcuboids of 300x200x200 mm

  • 1 subcuboids of 400x200x100 mm

  • 2 subcuboids of 400x400x500 mm

  • 12 subcuboids of 200x300x250 mm

  • 16 subcuboids of 600x200x100 mm

I´ve been looking all over rhino and grasshopper forums and still haven´t been able to see anybody achieve something similar to 3D packing (and if someone knows about a solution please let me know :call_me_hand: ). I´ve already tried using Packrat version 0.4 for grasshopper but it didn´t work properly and also using Galapagos for the input and master container´s volume optimization. I attached the grasshopper algorithm along with the packrat version I´m using to this post.

190609_Packing_galapagos.gh (26.9 KB)
packrat04.zip (47.2 KB)

Anyway, if there`s no solution in sight I plan to create my own using python, the Grasshopper API, Rhinocommon and Rhino 3DM.js javascript library to create a custom programmed plugin. In this way I plan to code a program which can be accesed not only from Rhino and Grasshopper but also from any web browser (hence the Rhino 3DM.js mention).

Image taken from https://raw.githubusercontent.com/mcneel/rhino3dm/master/docs/images/rhino3dm_rhinologo.png

I`ve also found an npm package by the name of 3D bin package : https://www.npmjs.com/package/3d-bin-packing

And this other repository: https://github.com/olragon/binpackingjs

In conclusion, there are several approaches to this issue:

  1. Search for 3D packing Grasshoper algorithm
  2. Code my own solution using Python, Rhino SDK and Grasshopper API.
  3. Build a solution using NodeJS and javascript.

I`m looking for some professional advice on how to approach this issue, so please let me know what you think.

Moved to the Grasshopper category.