diff options
author | Jack Ha <j.ha@ultimaker.com> | 2017-04-06 15:56:54 +0300 |
---|---|---|
committer | Jack Ha <j.ha@ultimaker.com> | 2017-04-06 15:56:54 +0300 |
commit | 203ebcf1a1ab3507013256609d5d849a317ca8fb (patch) | |
tree | 1dfa1c5c40549f46e639f3ee9483572c99cdc187 /cura/Arrange.py | |
parent | cebe52b1fe3ffb04c2f9ddb5534b50d9ac2ff23a (diff) |
Arranger findNodePlacements now places objects on top of build plate. CURA-3239
Diffstat (limited to 'cura/Arrange.py')
-rwxr-xr-x | cura/Arrange.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cura/Arrange.py b/cura/Arrange.py index 148661c45b..2ab407205c 100755 --- a/cura/Arrange.py +++ b/cura/Arrange.py @@ -2,6 +2,7 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Logger import Logger from UM.Math.Vector import Vector from cura.ShapeArray import ShapeArray +from cura import ZOffsetDecorator from collections import namedtuple @@ -67,12 +68,19 @@ class Arrange: offset_shape_arr, start_prio = start_prio, step = step) x, y = best_spot.x, best_spot.y start_prio = best_spot.priority + # Ensure that the object is above the build platform + new_node.removeDecorator(ZOffsetDecorator.ZOffsetDecorator) + if new_node.getBoundingBox(): + center_y = new_node.getWorldPosition().y - new_node.getBoundingBox().bottom + else: + center_y = 0 + if x is not None: # We could find a place - new_node.setPosition(Vector(x, 0, y)) - self.place(x, y, hull_shape_arr) # take place before the next one + new_node.setPosition(Vector(x, center_y, y)) + self.place(x, y, hull_shape_arr) # place the object in arranger else: Logger.log("d", "Could not find spot!") - new_node.setPosition(Vector(200, 0, 100 - i * 20)) + new_node.setPosition(Vector(200, center_y, 100 - i * 20)) nodes.append(new_node) return nodes |