Skip to content
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

Unable to run program #1

Open
liyinstyle opened this issue Nov 29, 2024 · 2 comments
Open

Unable to run program #1

liyinstyle opened this issue Nov 29, 2024 · 2 comments

Comments

@liyinstyle
Copy link

"python -m unittest discover tests" is correct?

@h3110Fr13nd
Copy link
Owner

@liyinstyle That's the command to test if the tool is working properly with some predefined tests.
If you want to run an example.
After you install with command

pip install 3d-bin-packer

And a file assuming main.py

from bin_packer import Packer, Bin, Item

# Create bins
bin1 = Bin('Le grande box', 100, 100, 300)

# Create items
items = [Item('Item 1', 150, 50, 50) for i in range(1000)]

# Create packer and add bins and items
packer = Packer()
packer.add_bin(bin1)
for item in items:
    packer.add_item(item)

# Pack items into bins
packer.pack()

# Check the results
for bin_ in packer.bins:
    print(f"Bin: {bin_.name}")
    for item in bin_.items:
        print(f"  Packed item: {item.name}")
        print(f"    Position: {item.position}")


print("Unfit items:", len(packer.unfit_items))

And running with simple command

python3 main.py

You should be able to run the Program with above Command.

To run the tests you can use following command

python -m unittest discover tests

@h3110Fr13nd
Copy link
Owner

Let me know iff you face any issue @liyinstyle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants