mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-20 07:59:05 +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)
|
item.markAsFixedInBin(0)
|
||||||
node_items.append(item)
|
node_items.append(item)
|
||||||
|
|
||||||
config = NfpConfig()
|
tried_strategies = [NfpConfig.Alignment.CENTER] * 3 + [NfpConfig.Alignment.BOTTOM_LEFT] * 3
|
||||||
config.accuracy = 1.0
|
found_solution_for_all = False
|
||||||
config.alignment = NfpConfig.Alignment.CENTER
|
while not found_solution_for_all and len(tried_strategies) > 0:
|
||||||
if self._lock_rotation:
|
config = NfpConfig()
|
||||||
config.rotations = [0.0]
|
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.
|
num_bins = nest(node_items, build_plate_bounding_box, spacing, config)
|
||||||
node_items = list(filter(lambda item: not item.isFixed(), node_items))
|
|
||||||
|
|
||||||
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
|
return found_solution_for_all, node_items
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user