mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Added "enable" checkbox consistent with changeAtZ.py. So you don't have to reconfigure it every time
This commit is contained in:
parent
ac16659829
commit
4459ecb5d7
1 changed files with 27 additions and 12 deletions
|
@ -24,20 +24,29 @@ class FilamentChange(Script):
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"settings":
|
"settings":
|
||||||
{
|
{
|
||||||
|
"enabled":
|
||||||
|
{
|
||||||
|
"label": "Enable",
|
||||||
|
"description": "Uncheck to temporarily disable this feature.",
|
||||||
|
"type": "bool",
|
||||||
|
"default_value": true
|
||||||
|
},
|
||||||
"layer_number":
|
"layer_number":
|
||||||
{
|
{
|
||||||
"label": "Layer",
|
"label": "Layer",
|
||||||
"description": "At what layer should color change occur. This will be before the layer starts printing. Specify multiple color changes with a comma.",
|
"description": "At what layer should color change occur. This will be before the layer starts printing. Specify multiple color changes with a comma.",
|
||||||
"unit": "",
|
"unit": "",
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"default_value": "1"
|
"default_value": "1",
|
||||||
|
"enabled": "enabled"
|
||||||
},
|
},
|
||||||
"firmware_config":
|
"firmware_config":
|
||||||
{
|
{
|
||||||
"label": "Use Firmware Configuration",
|
"label": "Use Firmware Configuration",
|
||||||
"description": "Use the settings in your firmware, or customise the parameters of the filament change here.",
|
"description": "Use the settings in your firmware, or customise the parameters of the filament change here.",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": false
|
"default_value": false,
|
||||||
|
"enabled": "enabled"
|
||||||
},
|
},
|
||||||
"initial_retract":
|
"initial_retract":
|
||||||
{
|
{
|
||||||
|
@ -46,7 +55,7 @@ class FilamentChange(Script):
|
||||||
"unit": "mm",
|
"unit": "mm",
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"default_value": 30.0,
|
"default_value": 30.0,
|
||||||
"enabled": "not firmware_config"
|
"enabled": "enabled and not firmware_config"
|
||||||
},
|
},
|
||||||
"later_retract":
|
"later_retract":
|
||||||
{
|
{
|
||||||
|
@ -55,7 +64,7 @@ class FilamentChange(Script):
|
||||||
"unit": "mm",
|
"unit": "mm",
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"default_value": 300.0,
|
"default_value": 300.0,
|
||||||
"enabled": "not firmware_config"
|
"enabled": "enabled and not firmware_config"
|
||||||
},
|
},
|
||||||
"x_position":
|
"x_position":
|
||||||
{
|
{
|
||||||
|
@ -64,7 +73,7 @@ class FilamentChange(Script):
|
||||||
"unit": "mm",
|
"unit": "mm",
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"default_value": 0,
|
"default_value": 0,
|
||||||
"enabled": "not firmware_config"
|
"enabled": "enabled and not firmware_config"
|
||||||
},
|
},
|
||||||
"y_position":
|
"y_position":
|
||||||
{
|
{
|
||||||
|
@ -73,7 +82,7 @@ class FilamentChange(Script):
|
||||||
"unit": "mm",
|
"unit": "mm",
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"default_value": 0,
|
"default_value": 0,
|
||||||
"enabled": "not firmware_config"
|
"enabled": "enabled and not firmware_config"
|
||||||
},
|
},
|
||||||
"z_position":
|
"z_position":
|
||||||
{
|
{
|
||||||
|
@ -82,7 +91,8 @@ class FilamentChange(Script):
|
||||||
"unit": "mm",
|
"unit": "mm",
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"default_value": 0,
|
"default_value": 0,
|
||||||
"minimum_value": 0
|
"minimum_value": 0,
|
||||||
|
"enabled": "enabled"
|
||||||
},
|
},
|
||||||
"retract_method":
|
"retract_method":
|
||||||
{
|
{
|
||||||
|
@ -92,7 +102,7 @@ class FilamentChange(Script):
|
||||||
"options": {"U": "Marlin (M600 U)", "L": "Reprap (M600 L)"},
|
"options": {"U": "Marlin (M600 U)", "L": "Reprap (M600 L)"},
|
||||||
"default_value": "U",
|
"default_value": "U",
|
||||||
"value": "\\\"L\\\" if machine_gcode_flavor==\\\"RepRap (RepRap)\\\" else \\\"U\\\"",
|
"value": "\\\"L\\\" if machine_gcode_flavor==\\\"RepRap (RepRap)\\\" else \\\"U\\\"",
|
||||||
"enabled": "not firmware_config"
|
"enabled": "enabled and not firmware_config"
|
||||||
},
|
},
|
||||||
"machine_gcode_flavor":
|
"machine_gcode_flavor":
|
||||||
{
|
{
|
||||||
|
@ -119,7 +129,8 @@ class FilamentChange(Script):
|
||||||
"label": "Enable macro Before filament change",
|
"label": "Enable macro Before filament change",
|
||||||
"description": "Use this to insert a custom G-code macro before the filament change happens",
|
"description": "Use this to insert a custom G-code macro before the filament change happens",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": false
|
"default_value": false,
|
||||||
|
"enabled": "enabled"
|
||||||
},
|
},
|
||||||
"before_macro":
|
"before_macro":
|
||||||
{
|
{
|
||||||
|
@ -128,14 +139,15 @@ class FilamentChange(Script):
|
||||||
"unit": "",
|
"unit": "",
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"default_value": "M300 S1000 P10000",
|
"default_value": "M300 S1000 P10000",
|
||||||
"enabled": "enable_before_macro"
|
"enabled": "enabled and enable_before_macro"
|
||||||
},
|
},
|
||||||
"enable_after_macro":
|
"enable_after_macro":
|
||||||
{
|
{
|
||||||
"label": "Enable macro After filament change",
|
"label": "Enable macro After filament change",
|
||||||
"description": "Use this to insert a custom G-code macro after the filament change",
|
"description": "Use this to insert a custom G-code macro after the filament change",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": false
|
"default_value": false,
|
||||||
|
"enabled": "enabled"
|
||||||
},
|
},
|
||||||
"after_macro":
|
"after_macro":
|
||||||
{
|
{
|
||||||
|
@ -144,7 +156,7 @@ class FilamentChange(Script):
|
||||||
"unit": "",
|
"unit": "",
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"default_value": "M300 S440 P500",
|
"default_value": "M300 S440 P500",
|
||||||
"enabled": "enable_after_macro"
|
"enabled": "enabled and enable_after_macro"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
|
@ -166,6 +178,7 @@ class FilamentChange(Script):
|
||||||
:param data: A list of layers of g-code.
|
:param data: A list of layers of g-code.
|
||||||
:return: A similar list, with filament change commands inserted.
|
:return: A similar list, with filament change commands inserted.
|
||||||
"""
|
"""
|
||||||
|
enabled = self.getSettingValueByKey("enabled")
|
||||||
layer_nums = self.getSettingValueByKey("layer_number")
|
layer_nums = self.getSettingValueByKey("layer_number")
|
||||||
initial_retract = self.getSettingValueByKey("initial_retract")
|
initial_retract = self.getSettingValueByKey("initial_retract")
|
||||||
later_retract = self.getSettingValueByKey("later_retract")
|
later_retract = self.getSettingValueByKey("later_retract")
|
||||||
|
@ -178,6 +191,8 @@ class FilamentChange(Script):
|
||||||
enable_after_macro = self.getSettingValueByKey("enable_after_macro")
|
enable_after_macro = self.getSettingValueByKey("enable_after_macro")
|
||||||
after_macro = self.getSettingValueByKey("after_macro")
|
after_macro = self.getSettingValueByKey("after_macro")
|
||||||
|
|
||||||
|
if not enabled:
|
||||||
|
return data
|
||||||
|
|
||||||
color_change = ";BEGIN FilamentChange plugin"
|
color_change = ";BEGIN FilamentChange plugin"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue