-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example.py output not reasonable #25
Comments
Hi, I just visualized the code with python and Yes, I guess the Decimal data is wrong. I mean, the calculations aren't wrong - item5 can be fitted in the large-box, |
I have a similar problem with my data when I extract the information, the position locates the package outside the bin but the unfit items list is empty. Were any of you able to fix this issue? |
When the bins and items are created in the example.py file, only one copy of each item exists in the packer object. As the bins are packed, items are appended to the list of fitted/unfitted data structures (Bin.items[] and Bin.unfitted_items[]). The positions and rotations of the items are modified through each pass of the packer.pack() "for bin in self.bins:" loop. So by the end of packing all bins, the positions and rotations of the items are set to whatever was last assigned to each item. The fitted/unfitted lists are correct, but the positions and rotations are scrambled. If you want the lists to stay intact and keep the positions, you can copy the items before they are appended to the fitted lists inside the put_item() method:
Now when I output the binned items, I get (after removing the decimal formatting methods): ::::::::::: large-box(12.0 x 12.0 x 5.5, max_weight:70.0) vol(792.0) You get similar output if you only have one bin as the item position/rotation data is still in tact. |
Running the provide example.py gives:
The position of the 5th item
pos([Decimal('19.685'), 0, 0])
seems to be outside the box, which is set as12.000x12.000x5.500
Is this a bug, or my understanding of the notation is wrong?
Run condition:
git checkout latest master
python 3.8.10
The text was updated successfully, but these errors were encountered: