add Marlin Advanced Pause Feature!

This commit is contained in:
Sekisback 2020-12-24 09:46:19 +01:00
parent 9efe5dd5e2
commit b458005e7e

View file

@ -1,6 +1,9 @@
# Copyright (c) 2019 Ultimaker B.V. # Copyright (c) 2019 Ultimaker B.V.
# The PostProcessingPlugin is released under the terms of the AGPLv3 or higher. # The PostProcessingPlugin is released under the terms of the AGPLv3 or higher.
# Modifikation 06.09.2020
# add checkbox, now you can choose and use configuration from Marlin Advanced Pause Feature!
from typing import List from typing import List
from ..Script import Script from ..Script import Script
@ -19,6 +22,14 @@ class FilamentChange(Script):
"version": 2, "version": 2,
"settings": "settings":
{ {
"marlin":
{
"label": "Use Marlin Config?",
"description": "Use configuration from Marlin Advanced Pause Feature!",
"type": "bool",
"default_value": true
},
"layer_number": "layer_number":
{ {
"label": "Layer", "label": "Layer",
@ -34,7 +45,9 @@ class FilamentChange(Script):
"description": "Initial filament retraction distance. The filament will be retracted with this amount before moving the nozzle away from the ongoing print.", "description": "Initial filament retraction distance. The filament will be retracted with this amount before moving the nozzle away from the ongoing print.",
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 30.0 "default_value": 30.0,
"enabled": "marlin == 0"
}, },
"later_retract": "later_retract":
{ {
@ -42,7 +55,9 @@ class FilamentChange(Script):
"description": "Later filament retraction distance for removal. The filament will be retracted all the way out of the printer so that you can change the filament.", "description": "Later filament retraction distance for removal. The filament will be retracted all the way out of the printer so that you can change the filament.",
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 300.0 "default_value": 300.0,
"enabled": "marlin == 0"
}, },
"x_position": "x_position":
{ {
@ -50,7 +65,9 @@ class FilamentChange(Script):
"description": "Extruder X position. The print head will move here for filament change.", "description": "Extruder X position. The print head will move here for filament change.",
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 0 "default_value": 0,
"enabled": "marlin == 0"
}, },
"y_position": "y_position":
{ {
@ -58,7 +75,9 @@ class FilamentChange(Script):
"description": "Extruder Y position. The print head will move here for filament change.", "description": "Extruder Y position. The print head will move here for filament change.",
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 0 "default_value": 0,
"enabled": "marlin == 0"
} }
} }
}""" }"""
@ -74,22 +93,26 @@ class FilamentChange(Script):
later_retract = self.getSettingValueByKey("later_retract") later_retract = self.getSettingValueByKey("later_retract")
x_pos = self.getSettingValueByKey("x_position") x_pos = self.getSettingValueByKey("x_position")
y_pos = self.getSettingValueByKey("y_position") y_pos = self.getSettingValueByKey("y_position")
marlin_conf = self.getSettingValueByKey("marlin")
color_change = "M600" color_change = "M600"
if initial_retract is not None and initial_retract > 0.: if marlin_conf:
color_change = color_change + (" E%.2f" % initial_retract) color_change = color_change + " ; Generated by FilamentChange plugin\n"
else:
if initial_retract is not None and initial_retract > 0.:
color_change = color_change + (" E%.2f" % initial_retract)
if later_retract is not None and later_retract > 0.: if later_retract is not None and later_retract > 0.:
color_change = color_change + (" L%.2f" % later_retract) color_change = color_change + (" L%.2f" % later_retract)
if x_pos is not None: if x_pos is not None:
color_change = color_change + (" X%.2f" % x_pos) color_change = color_change + (" X%.2f" % x_pos)
if y_pos is not None: if y_pos is not None:
color_change = color_change + (" Y%.2f" % y_pos) color_change = color_change + (" Y%.2f" % y_pos)
color_change = color_change + " ; Generated by FilamentChange plugin\n" color_change = color_change + " ; Generated by FilamentChange plugin\n"
layer_targets = layer_nums.split(",") layer_targets = layer_nums.split(",")
if len(layer_targets) > 0: if len(layer_targets) > 0: