mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-20 01:59:17 +08:00
Retry auto-arrange with a few different strategies
CURA-10403
This commit is contained in:
parent
1509e27983
commit
0d0375d5e0
@ -108,18 +108,24 @@ class Nest2DArrange(Arranger):
|
||||
item.markAsFixedInBin(0)
|
||||
node_items.append(item)
|
||||
|
||||
config = NfpConfig()
|
||||
config.accuracy = 1.0
|
||||
config.alignment = NfpConfig.Alignment.CENTER
|
||||
if self._lock_rotation:
|
||||
config.rotations = [0.0]
|
||||
tried_strategies = [NfpConfig.Alignment.CENTER] * 3 + [NfpConfig.Alignment.BOTTOM_LEFT] * 3
|
||||
found_solution_for_all = False
|
||||
while not found_solution_for_all and len(tried_strategies) > 0:
|
||||
config = NfpConfig()
|
||||
config.accuracy = 1.0
|
||||
config.alignment = NfpConfig.Alignment.CENTER
|
||||
config.starting_point = tried_strategies[0]
|
||||
tried_strategies = tried_strategies[1:]
|
||||
|
||||
num_bins = nest(node_items, build_plate_bounding_box, spacing, config)
|
||||
if self._lock_rotation:
|
||||
config.rotations = [0.0]
|
||||
|
||||
# Strip the fixed items (previously placed) and the disallowed areas from the results again.
|
||||
node_items = list(filter(lambda item: not item.isFixed(), node_items))
|
||||
num_bins = nest(node_items, build_plate_bounding_box, spacing, config)
|
||||
|
||||
found_solution_for_all = num_bins == 1
|
||||
# Strip the fixed items (previously placed) and the disallowed areas from the results again.
|
||||
node_items = list(filter(lambda item: not item.isFixed(), node_items))
|
||||
|
||||
found_solution_for_all = num_bins == 1
|
||||
|
||||
return found_solution_for_all, node_items
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user