@@ -72,6 +72,15 @@ def getSettingDataString(self):
72
72
"type": "float",
73
73
"default_value": 0,
74
74
"enabled": "not firmware_config"
75
+ },
76
+ "z_position":
77
+ {
78
+ "label": "Z Position (relative)",
79
+ "description": "Extruder relative Z position. Move the print head up for filament change.",
80
+ "unit": "mm",
81
+ "type": "float",
82
+ "default_value": 0,
83
+ "minimum_value": 0
75
84
}
76
85
}
77
86
}"""
@@ -87,6 +96,7 @@ def execute(self, data: List[str]):
87
96
later_retract = self .getSettingValueByKey ("later_retract" )
88
97
x_pos = self .getSettingValueByKey ("x_position" )
89
98
y_pos = self .getSettingValueByKey ("y_position" )
99
+ z_pos = self .getSettingValueByKey ("z_position" )
90
100
firmware_config = self .getSettingValueByKey ("firmware_config" )
91
101
92
102
color_change = "M600"
@@ -100,10 +110,13 @@ def execute(self, data: List[str]):
100
110
101
111
if x_pos is not None :
102
112
color_change = color_change + (" X%.2f" % x_pos )
103
-
113
+
104
114
if y_pos is not None :
105
115
color_change = color_change + (" Y%.2f" % y_pos )
106
116
117
+ if z_pos is not None and z_pos > 0. :
118
+ color_change = color_change + (" Z%.2f" % z_pos )
119
+
107
120
color_change = color_change + " ; Generated by FilamentChange plugin\n "
108
121
109
122
layer_targets = layer_nums .split ("," )
@@ -116,4 +129,4 @@ def execute(self, data: List[str]):
116
129
if 0 < layer_num < len (data ):
117
130
data [layer_num ] = color_change + data [layer_num ]
118
131
119
- return data
132
+ return data
0 commit comments