Funed arranger for better performance. CURA-3239

This commit is contained in:
Jack Ha 2017-03-30 17:26:56 +02:00
parent 099752125b
commit 9db816b0fc
2 changed files with 10 additions and 9 deletions

View file

@ -124,13 +124,13 @@ class Arrange:
return np.sum(prio_slice[np.where(shape_arr.arr == 1)])
## Find "best" spot
def bestSpot(self, shape_arr, start_prio = 0):
def bestSpot(self, shape_arr, start_prio = 0, step = 1):
start_idx_list = np.where(self._priority_unique_values == start_prio)
if start_idx_list:
start_idx = start_idx_list[0]
else:
start_idx = 0
for prio in self._priority_unique_values[start_idx:]:
for prio in self._priority_unique_values[start_idx::step]:
tryout_idx = np.where(self._priority == prio)
for idx in range(len(tryout_idx[0])):
x = tryout_idx[0][idx]