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

add overturn flag for restricted to upside #37

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion py3dbp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class Item:
def __init__(self, name, width, height, depth, weight):
def __init__(self, name, width, height, depth, weight, overturn=True):
self.name = name
self.width = width
self.height = height
Expand All @@ -15,6 +15,7 @@ def __init__(self, name, width, height, depth, weight):
self.rotation_type = 0
self.position = START_POSITION
self.number_of_decimals = DEFAULT_NUMBER_OF_DECIMALS
self.overturn = overturn

def format_numbers(self, number_of_decimals):
self.width = set_to_decimal(self.width, number_of_decimals)
Expand Down Expand Up @@ -97,6 +98,10 @@ def put_item(self, item, pivot):

for i in range(0, len(RotationType.ALL)):
item.rotation_type = i

if not item.overturn and i not in [RotationType.RT_WHD, RotationType.RT_DHW]:
continue

dimension = item.get_dimension()
if (
self.width < pivot[0] + dimension[0] or
Expand Down