Set object bottom to be on buildplate with center model action

CURA-7859
This commit is contained in:
Jaime van Kessel 2021-06-10 16:18:42 +02:00
parent dc8c5e4268
commit 8caae610ba
No known key found for this signature in database
GPG Key ID: 3710727397403C91

View File

@ -67,11 +67,15 @@ class CuraActions(QObject):
current_node = parent_node current_node = parent_node
parent_node = current_node.getParent() parent_node = current_node.getParent()
# This was formerly done with SetTransformOperation but because of # Find out where the bottom of the object is
# unpredictable matrix deconstruction it was possible that mirrors bbox = current_node.getBoundingBox()
# could manifest as rotations. Centering is therefore done by if bbox:
# moving the node to negative whatever its position is: center_y = current_node.getWorldPosition().y - bbox.bottom
center_operation = TranslateOperation(current_node, -current_node._position) else:
center_y = 0
# Move the object so that it's bottom is on to of the buildplate
center_operation = TranslateOperation(current_node, Vector(0, center_y, 0), set_position= True)
operation.addOperation(center_operation) operation.addOperation(center_operation)
operation.push() operation.push()