All Projects → enzoruiz → 3dbinpacking

enzoruiz / 3dbinpacking

Licence: MIT license
A python library for 3D Bin Packing

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to 3dbinpacking

vpsolver
Arc-flow Vector Packing Solver (VPSolver)
Stars: ✭ 86 (-57.64%)
Mutual labels:  bin-packing
Muuri
Infinite responsive, sortable, filterable and draggable layouts
Stars: ✭ 9,797 (+4726.11%)
Mutual labels:  bin-packing
bin-packing
😔 Failed to implement some kind layout in browser.
Stars: ✭ 53 (-73.89%)
Mutual labels:  bin-packing
nest2D
Nest2D is a 2D bin packaging tool for python.
Stars: ✭ 42 (-79.31%)
Mutual labels:  bin-packing
pack
📦 lightweight rectangle packing algorithm
Stars: ✭ 31 (-84.73%)
Mutual labels:  bin-packing
bp3d
Golang package for 3d bin packing problem
Stars: ✭ 50 (-75.37%)
Mutual labels:  bin-packing
Rectangle-Bin-Packing
👜 Haxe algorithms for 2D rectangular bin packing
Stars: ✭ 32 (-84.24%)
Mutual labels:  bin-packing
libnfporb
Implementation of a robust no-fit polygon generation in a C++ library using an orbiting approach
Stars: ✭ 85 (-58.13%)
Mutual labels:  bin-packing
gbp
gbp: a bin packing problem solver - an r package solves 1d - 4d bin packing problem.
Stars: ✭ 24 (-88.18%)
Mutual labels:  3d-bin-packing

3D Bin Packing

3D Bin Packing implementation based on this paper. The code is based on gedex implementation in Go.

Features

  1. Sorting Bins and Items: [bigger_first=False/True] By default all the bins and items are sorted from the smallest to the biggest, also it can be vice versa, to make the packing in such ordering.
  2. Item Distribution:
    • [distribute_items=True] From a list of bins and items, put the items in the bins that at least one item be in one bin that can be fitted. That is, distribute all the items in all the bins so that they can be contained.
    • [distribute_items=False] From a list of bins and items, try to put all the items in each bin and in the end it show per bin all the items that was fitted and the items that was not.
  3. Number of decimals: [number_of_decimals=X] Define the limits of decimals of the inputs and the outputs. By default is 3.

Install

pip install py3dbp

Basic Explanation

Bin and Items have the same creation params:

my_bin = Bin(name, width, height, depth, max_weight)
my_item = Item(name, width, height, depth, weight)

Packer have three main functions:

packer = Packer()           # PACKER DEFINITION

packer.add_bin(my_bin)      # ADDING BINS TO PACKER
packer.add_item(my_item)    # ADDING ITEMS TO PACKER

packer.pack()               # PACKING - by default (bigger_first=False, distribute_items=False, number_of_decimals=3)

After packing:

packer.bins                 # GET ALL BINS OF PACKER
my_bin.items                # GET ALL FITTED ITEMS IN EACH BIN
my_bin.unfitted_items       # GET ALL UNFITTED ITEMS IN EACH BIN

Usage

from py3dbp import Packer, Bin, Item

packer = Packer()

packer.add_bin(Bin('small-envelope', 11.5, 6.125, 0.25, 10))
packer.add_bin(Bin('large-envelope', 15.0, 12.0, 0.75, 15))
packer.add_bin(Bin('small-box', 8.625, 5.375, 1.625, 70.0))
packer.add_bin(Bin('medium-box', 11.0, 8.5, 5.5, 70.0))
packer.add_bin(Bin('medium-2-box', 13.625, 11.875, 3.375, 70.0))
packer.add_bin(Bin('large-box', 12.0, 12.0, 5.5, 70.0))
packer.add_bin(Bin('large-2-box', 23.6875, 11.75, 3.0, 70.0))

packer.add_item(Item('50g [powder 1]', 3.9370, 1.9685, 1.9685, 1))
packer.add_item(Item('50g [powder 2]', 3.9370, 1.9685, 1.9685, 2))
packer.add_item(Item('50g [powder 3]', 3.9370, 1.9685, 1.9685, 3))
packer.add_item(Item('250g [powder 4]', 7.8740, 3.9370, 1.9685, 4))
packer.add_item(Item('250g [powder 5]', 7.8740, 3.9370, 1.9685, 5))
packer.add_item(Item('250g [powder 6]', 7.8740, 3.9370, 1.9685, 6))
packer.add_item(Item('250g [powder 7]', 7.8740, 3.9370, 1.9685, 7))
packer.add_item(Item('250g [powder 8]', 7.8740, 3.9370, 1.9685, 8))
packer.add_item(Item('250g [powder 9]', 7.8740, 3.9370, 1.9685, 9))

packer.pack()

for b in packer.bins:
    print(":::::::::::", b.string())

    print("FITTED ITEMS:")
    for item in b.items:
        print("====> ", item.string())

    print("UNFITTED ITEMS:")
    for item in b.unfitted_items:
        print("====> ", item.string())

    print("***************************************************")
    print("***************************************************")

Latest Stable Version

py3dbp==1.1.2

Versioning

  • 1.x
    • Two ways to distribute items (all items in all bins - all items in each bin).
    • Get per bin the fitted and unfitted items.
    • Set the limit of decimals of inputs and outputs.
  • 0.x
    • Try to put all items in the first bin that can fit at least one.

Credit

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].