From 21baf90ec87cadf605b1433e6e024460a0161d6b Mon Sep 17 00:00:00 2001 From: Humsie Date: Fri, 21 May 2021 17:02:53 +0200 Subject: [PATCH] Add Z Position parameter to FilamentChange (#9658) * Add Z Position * PR Comment: Add minimum value for z_position Co-authored-by: Konstantinos Karmas --- .../scripts/FilamentChange.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/FilamentChange.py b/plugins/PostProcessingPlugin/scripts/FilamentChange.py index 5e984a2cd1..17ff045b8d 100644 --- a/plugins/PostProcessingPlugin/scripts/FilamentChange.py +++ b/plugins/PostProcessingPlugin/scripts/FilamentChange.py @@ -72,6 +72,15 @@ class FilamentChange(Script): "type": "float", "default_value": 0, "enabled": "not firmware_config" + }, + "z_position": + { + "label": "Z Position (relative)", + "description": "Extruder relative Z position. Move the print head up for filament change.", + "unit": "mm", + "type": "float", + "default_value": 0, + "minimum_value": 0 } } }""" @@ -87,6 +96,7 @@ class FilamentChange(Script): later_retract = self.getSettingValueByKey("later_retract") x_pos = self.getSettingValueByKey("x_position") y_pos = self.getSettingValueByKey("y_position") + z_pos = self.getSettingValueByKey("z_position") firmware_config = self.getSettingValueByKey("firmware_config") color_change = "M600" @@ -100,10 +110,13 @@ class FilamentChange(Script): if x_pos is not None: color_change = color_change + (" X%.2f" % x_pos) - + if y_pos is not None: color_change = color_change + (" Y%.2f" % y_pos) + if z_pos is not None and z_pos > 0.: + color_change = color_change + (" Z%.2f" % z_pos) + color_change = color_change + " ; Generated by FilamentChange plugin\n" layer_targets = layer_nums.split(",") @@ -116,4 +129,4 @@ class FilamentChange(Script): if 0 < layer_num < len(data): data[layer_num] = color_change + data[layer_num] - return data \ No newline at end of file + return data