Skip to content

Commit

Permalink
Source code for version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sweiss93 authored Dec 3, 2020
1 parent 8719561 commit 407dd55
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
7 changes: 3 additions & 4 deletions LengthNestPro.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def keyPressEvent(self, event):
self.enter_was_pressed()
else:
super().keyPressEvent(event)
print(event.key())
# print(event.key())

def delete_cell_contents(self):
indices = self.selectedIndexes()
Expand Down Expand Up @@ -550,9 +550,8 @@ def gather_inputs(self):

self.repaint()

if len(part_lengths) != 0 and stock_length != -1 and left_waste != -1 and right_waste != -1 and spacing != -1 \
and b.all() != 0:
(final_patterns, final_allocations, part_lengths, part_names, spacing, left_waste, right_waste,
if len(part_lengths) != 0 and stock_length != -1 and left_waste != -1 and right_waste != -1 and spacing != -1:
(final_patterns, final_allocations, part_lengths, part_names, b, spacing, left_waste, right_waste,
stock_length) = length_nest_pro(part_lengths, b, part_names, spacing, left_waste, right_waste,
stock_length)

Expand Down
16 changes: 6 additions & 10 deletions LengthNestProCalculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def length_nest_pro(part_lengths, b, part_names, spacing, left_waste, right_wast
# left_waste = .12
# right_waste = 4.75
# stock_length = 288
pattern_max = 3 # TODO remove this feature
pattern_max = 100 # TODO remove this feature?
lp_time = 0
inv_time = 0
append_time = 0
Expand Down Expand Up @@ -55,17 +55,15 @@ def length_nest_pro(part_lengths, b, part_names, spacing, left_waste, right_wast
# part_lengths[i] = random.random()*3+2
# b[i] = round(random.random()*1000)

# print(part_lengths)
# print(b)
# print(part_numbers)

# # #
# Remove any parts where PartQty is 0 (remove entries from part_lengths and b)
for i in range(len(b))[::-1]:
if b[i] == 0:
b = np.delete(b, i, 0)
part_lengths = np.delete(part_lengths, i, 0)
# part_numbers = np.delete(part_numbers, i, 0)
part_names = np.delete(part_names, i, 0)

b_modified = b

# # #
# Combine parts with same length? Must still consider quantities...
Expand Down Expand Up @@ -449,7 +447,7 @@ def length_nest_pro(part_lengths, b, part_names, spacing, left_waste, right_wast
nested = np.dot(patterns, int_allocation)
new_totals = b.copy()
new_totals = new_totals - nested
print(new_totals)
# print(new_totals)

b = new_totals

Expand Down Expand Up @@ -683,9 +681,7 @@ def length_nest_pro(part_lengths, b, part_names, spacing, left_waste, right_wast
final_patterns = np.delete(final_patterns, i, 1)
final_allocations = np.delete(final_allocations, i, 0)

print(final_patterns)
print(final_allocations)
return final_patterns, final_allocations, part_lengths, part_names, spacing, left_waste, right_waste, stock_length
return final_patterns, final_allocations, part_lengths, part_names, b_modified, spacing, left_waste, right_waste, stock_length

# Write to file
# with open('output.csv', 'w') as csvfile:
Expand Down

0 comments on commit 407dd55

Please sign in to comment.