Add Z Position parameter to FilamentChange (#9658)

* Add Z Position

* PR Comment: Add minimum value for z_position

Co-authored-by: Konstantinos Karmas <konskarm@gmail.com>
This commit is contained in:
Humsie 2021-05-21 17:02:53 +02:00 committed by GitHub
parent 0e95a4612a
commit 21baf90ec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"
@ -104,6 +114,9 @@ class FilamentChange(Script):
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(",")