Don't let arranger place all objects on the same spot if they don't fit

CURA-7440
This commit is contained in:
Jaime van Kessel 2020-10-05 14:31:42 +02:00
parent a14135be5e
commit 59b9639d87
No known key found for this signature in database
GPG key ID: 3710727397403C91

View file

@ -36,14 +36,9 @@ class MultiplyObjectsJob(Job):
status_message.show()
scene = Application.getInstance().getController().getScene()
total_progress = len(self._objects) * self._count
current_progress = 0
global_container_stack = Application.getInstance().getGlobalContainerStack()
if global_container_stack is None:
return # We can't do anything in this case.
machine_width = global_container_stack.getProperty("machine_width", "value")
machine_depth = global_container_stack.getProperty("machine_depth", "value")
root = scene.getRoot()
@ -80,7 +75,7 @@ class MultiplyObjectsJob(Job):
nodes.append(new_node)
factor = 10000
found_solution_for_all, node_items = findNodePlacement(nodes, Application.getInstance().getBuildVolume(), fixed_nodes, factor = 10000)
not_fit_count = 0
if nodes:
operation = GroupedOperation()
for new_node, node_item in zip(nodes, node_items):
@ -98,6 +93,7 @@ class MultiplyObjectsJob(Job):
# We didn't find a spot
operation.addOperation(
TranslateOperation(new_node, Vector(200, 0, -not_fit_count * 20), set_position=True))
not_fit_count += 1
operation.push()
status_message.hide()