From 8caae610ba0ae178ac5ecc9fc63cfffd622f6729 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 10 Jun 2021 16:18:42 +0200 Subject: [PATCH 1/4] Set object bottom to be on buildplate with center model action CURA-7859 --- cura/CuraActions.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cura/CuraActions.py b/cura/CuraActions.py index d6e5add912..3ae458985b 100644 --- a/cura/CuraActions.py +++ b/cura/CuraActions.py @@ -67,11 +67,15 @@ class CuraActions(QObject): current_node = parent_node parent_node = current_node.getParent() - # This was formerly done with SetTransformOperation but because of - # unpredictable matrix deconstruction it was possible that mirrors - # could manifest as rotations. Centering is therefore done by - # moving the node to negative whatever its position is: - center_operation = TranslateOperation(current_node, -current_node._position) + # Find out where the bottom of the object is + bbox = current_node.getBoundingBox() + if bbox: + center_y = current_node.getWorldPosition().y - bbox.bottom + 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.push() From 76da7768e8ccc42ea7362b20414baf677ddd327c Mon Sep 17 00:00:00 2001 From: Ewald Kleefstra Date: Wed, 7 Apr 2021 10:58:36 +0200 Subject: [PATCH 2/4] Added relative extrusion mode support for PauseAtHeight.py script --- plugins/PostProcessingPlugin/scripts/PauseAtHeight.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 2a055b86ac..29714aedf1 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -507,7 +507,16 @@ class PauseAtHeight(Script): else: Logger.log("w", "No previous feedrate found in gcode, feedrate for next layer(s) might be incorrect") - prepend_gcode += self.putValue(M = 82) + " ; switch back to absolute E values\n" + extrusion_mode_string = "absolute" + extrusion_mode_numeric = 82 + + extruders = list(Application.getInstance().getGlobalContainerStack().extruders.values()) + relative_extrusion = extruders[0].getProperty("relative_extrusion", "value") + if relative_extrusion: + extrusion_mode_string = "relative" + extrusion_mode_numeric = 83 + + prepend_gcode += self.putValue(M = extrusion_mode_numeric) + " ; switch back to " + extrusion_mode_string + " E values\n" # reset extrude value to pre pause value prepend_gcode += self.putValue(G = 92, E = current_e) + "\n" From 94871a32e370993bb392f168e379b9bf53843d40 Mon Sep 17 00:00:00 2001 From: Ewald Kleefstra <31920433+ewaldkleefstra@users.noreply.github.com> Date: Mon, 7 Jun 2021 17:45:51 +0200 Subject: [PATCH 3/4] Update plugins/PostProcessingPlugin/scripts/PauseAtHeight.py Get extrusion mode from global container stack instead of first extruder Co-authored-by: Ghostkeeper --- plugins/PostProcessingPlugin/scripts/PauseAtHeight.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 29714aedf1..a9e570e0cb 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -510,8 +510,7 @@ class PauseAtHeight(Script): extrusion_mode_string = "absolute" extrusion_mode_numeric = 82 - extruders = list(Application.getInstance().getGlobalContainerStack().extruders.values()) - relative_extrusion = extruders[0].getProperty("relative_extrusion", "value") + relative_extrusion = Application.getInstance().getGlobalContainerStack().getProperty("relative_extrusion", "value") if relative_extrusion: extrusion_mode_string = "relative" extrusion_mode_numeric = 83 From cf604570bb5756563f8c329dde810e6f51b98ffc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Jun 2021 15:41:30 +0200 Subject: [PATCH 4/4] Fix code style Contributes to issue CURA-7859. --- cura/CuraActions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraActions.py b/cura/CuraActions.py index 3ae458985b..4d121338d8 100644 --- a/cura/CuraActions.py +++ b/cura/CuraActions.py @@ -75,7 +75,7 @@ class CuraActions(QObject): 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) + center_operation = TranslateOperation(current_node, Vector(0, center_y, 0), set_position = True) operation.addOperation(center_operation) operation.push()