Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Ha <jackha@gmail.com>2018-05-22 18:13:35 +0300
committerJack Ha <jackha@gmail.com>2018-05-22 18:13:35 +0300
commitf5bed242ed2dc96d81e5758aa3e7e87c26820808 (patch)
tree431ef6393e6a9cc41db2564de01b418f8acb04b1 /cura/MultiplyObjectsJob.py
parent310aee07ac19cfd0695390e4ec69a791445c792a (diff)
CURA-5370 Small refactor for Arranger: make x and y consistent (numpy arrays start with y first in general), faster, cleanup, more unit tests, take actual build plate size in Arranger instances
Diffstat (limited to 'cura/MultiplyObjectsJob.py')
-rw-r--r--cura/MultiplyObjectsJob.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/cura/MultiplyObjectsJob.py b/cura/MultiplyObjectsJob.py
index 3444da249f..46f7f56f8a 100644
--- a/cura/MultiplyObjectsJob.py
+++ b/cura/MultiplyObjectsJob.py
@@ -30,11 +30,18 @@ class MultiplyObjectsJob(Job):
total_progress = len(self._objects) * self._count
current_progress = 0
+ global_container_stack = Application.getInstance().getGlobalContainerStack()
+ machine_width = global_container_stack.getProperty("machine_width", "value")
+ machine_depth = global_container_stack.getProperty("machine_depth", "value")
+
root = scene.getRoot()
- arranger = Arrange.create(scene_root=root)
+ scale = 0.5
+ arranger = Arrange.create(x = machine_width, y = machine_depth, scene_root = root, scale = scale)
processed_nodes = []
nodes = []
+ not_fit_count = 0
+
for node in self._objects:
# If object is part of a group, multiply group
current_node = node
@@ -46,12 +53,13 @@ class MultiplyObjectsJob(Job):
processed_nodes.append(current_node)
node_too_big = False
- if node.getBoundingBox().width < 300 or node.getBoundingBox().depth < 300:
- offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(current_node, min_offset=self._min_offset)
+ if node.getBoundingBox().width < machine_width or node.getBoundingBox().depth < machine_depth:
+ offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(current_node, min_offset = self._min_offset, scale = scale)
else:
node_too_big = True
found_solution_for_all = True
+ arranger.resetLastPriority()
for i in range(self._count):
# We do place the nodes one by one, as we want to yield in between.
if not node_too_big:
@@ -59,8 +67,9 @@ class MultiplyObjectsJob(Job):
if node_too_big or not solution_found:
found_solution_for_all = False
new_location = new_node.getPosition()
- new_location = new_location.set(z = 100 - i * 20)
+ new_location = new_location.set(z = - not_fit_count * 20)
new_node.setPosition(new_location)
+ not_fit_count += 1
# Same build plate
build_plate_number = current_node.callDecoration("getBuildPlateNumber")