mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Merge branch 'master' of https://github.com/legend069/Cura into legend069-master
This commit is contained in:
commit
e286b17bd9
1 changed files with 67 additions and 24 deletions
|
@ -11,6 +11,8 @@
|
||||||
# Modified by Jaime van Kessel (Ultimaker), j.vankessel@ultimaker.com to make it work for 15.10 / 2.x
|
# Modified by Jaime van Kessel (Ultimaker), j.vankessel@ultimaker.com to make it work for 15.10 / 2.x
|
||||||
# Modified by Ghostkeeper (Ultimaker), rubend@tutanota.com, to debug.
|
# Modified by Ghostkeeper (Ultimaker), rubend@tutanota.com, to debug.
|
||||||
# Modified by Wes Hanney, https://github.com/novamxd, Retract Length + Speed, Clean up
|
# Modified by Wes Hanney, https://github.com/novamxd, Retract Length + Speed, Clean up
|
||||||
|
# Modified by Alex Jaxon, https://github.com/legend069, Added option to modify Build Volume Temperature
|
||||||
|
|
||||||
|
|
||||||
# history / changelog:
|
# history / changelog:
|
||||||
# V3.0.1: TweakAtZ-state default 1 (i.e. the plugin works without any TweakAtZ comment)
|
# V3.0.1: TweakAtZ-state default 1 (i.e. the plugin works without any TweakAtZ comment)
|
||||||
|
@ -33,13 +35,18 @@
|
||||||
# V5.0: Bugfix for fall back after one layer and doubled G0 commands when using print speed tweak, Initial version for Cura 2.x
|
# V5.0: Bugfix for fall back after one layer and doubled G0 commands when using print speed tweak, Initial version for Cura 2.x
|
||||||
# V5.0.1: Bugfix for calling unknown property 'bedTemp' of previous settings storage and unknown variable 'speed'
|
# V5.0.1: Bugfix for calling unknown property 'bedTemp' of previous settings storage and unknown variable 'speed'
|
||||||
# V5.1: API Changes included for use with Cura 2.2
|
# V5.1: API Changes included for use with Cura 2.2
|
||||||
# V5.2.0: Wes Hanney. Added support for changing Retract Length and Speed. Removed layer spread option. Fixed issue of cumulative ChangeZ
|
# V5.2.0: Wes Hanney. Added support for changing Retract Length and Speed. Removed layer spread option. Fixed issue of cumulative ChangeAtZ
|
||||||
# mods so they can now properly be stacked on top of each other. Applied code refactoring to clean up various coding styles. Added comments.
|
# mods so they can now properly be stacked on top of each other. Applied code refactoring to clean up various coding styles. Added comments.
|
||||||
# Broke up functions for clarity. Split up class so it can be debugged outside of Cura.
|
# Broke up functions for clarity. Split up class so it can be debugged outside of Cura.
|
||||||
# V5.2.1: Wes Hanney. Added support for firmware based retractions. Fixed issue of properly restoring previous values in single layer option.
|
# V5.2.1: Wes Hanney. Added support for firmware based retractions. Fixed issue of properly restoring previous values in single layer option.
|
||||||
# Added support for outputting changes to LCD (untested). Added type hints to most functions and variables. Added more comments. Created GCodeCommand
|
# Added support for outputting changes to LCD (untested). Added type hints to most functions and variables. Added more comments. Created GCodeCommand
|
||||||
# class for better detection of G1 vs G10 or G11 commands, and accessing arguments. Moved most GCode methods to GCodeCommand class. Improved wording
|
# class for better detection of G1 vs G10 or G11 commands, and accessing arguments. Moved most GCode methods to GCodeCommand class. Improved wording
|
||||||
# of Single Layer vs Keep Layer to better reflect what was happening.
|
# of Single Layer vs Keep Layer to better reflect what was happening.
|
||||||
|
# V5.2.2 Alex Jaxon, Added option to modify Build Volume Temperature keeping current format
|
||||||
|
# updated from "Experimental" to "Beta"
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Uses -
|
# Uses -
|
||||||
# M220 S<factor in percent> - set speed factor override percentage
|
# M220 S<factor in percent> - set speed factor override percentage
|
||||||
|
@ -56,20 +63,20 @@ from ..Script import Script
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
# this was broken up into a separate class so the main ChangeZ script could be debugged outside of Cura
|
# this was broken up into a separate class so the main ChangeAtZ script could be debugged outside of Cura
|
||||||
class ChangeAtZ(Script):
|
class ChangeAtZ(Script):
|
||||||
version = "5.2.1"
|
version = "5.2.2"
|
||||||
|
|
||||||
def getSettingDataString(self):
|
def getSettingDataString(self):
|
||||||
return """{
|
return """{
|
||||||
"name": "ChangeAtZ """ + self.version + """(Experimental)",
|
"name": "ChangeAtZ """ + self.version + """(Beta)",
|
||||||
"key": "ChangeAtZ",
|
"key": "ChangeAtZ",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"settings": {
|
"settings": {
|
||||||
"caz_enabled": {
|
"caz_enabled": {
|
||||||
"label": "Enabled",
|
"label": "Enabled",
|
||||||
"description": "Allows adding multiple ChangeZ mods and disabling them as needed.",
|
"description": "Allows adding multiple ChangeAtZ mods and disabling them as needed.",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": true
|
"default_value": true
|
||||||
},
|
},
|
||||||
|
@ -221,6 +228,23 @@ class ChangeAtZ(Script):
|
||||||
"minimum_value_warning": "30",
|
"minimum_value_warning": "30",
|
||||||
"maximum_value_warning": "120",
|
"maximum_value_warning": "120",
|
||||||
"enabled": "h1_Change_bedTemp"
|
"enabled": "h1_Change_bedTemp"
|
||||||
|
},
|
||||||
|
"h1_Change_BuildVolumeTemperature": {
|
||||||
|
"label": "Change Build Volume Temperature",
|
||||||
|
"description": "Select if Build Volume Temperature has to be changed",
|
||||||
|
"type": "bool",
|
||||||
|
"default_value": false
|
||||||
|
},
|
||||||
|
"h2_BuildVolumeTemperature": {
|
||||||
|
"label": "Build Volume Temperature",
|
||||||
|
"description": "New Build Volume Temperature",
|
||||||
|
"unit": "C",
|
||||||
|
"type": "float",
|
||||||
|
"default_value": 20,
|
||||||
|
"minimum_value": "0",
|
||||||
|
"minimum_value_warning": "10",
|
||||||
|
"maximum_value_warning": "50",
|
||||||
|
"enabled": "h1_Change_BuildVolumeTemperature"
|
||||||
},
|
},
|
||||||
"i1_Change_extruderOne": {
|
"i1_Change_extruderOne": {
|
||||||
"label": "Change Extruder 1 Temp",
|
"label": "Change Extruder 1 Temp",
|
||||||
|
@ -345,6 +369,7 @@ class ChangeAtZ(Script):
|
||||||
self.setIntSettingIfEnabled(caz_instance, "g3_Change_flowrateOne", "flowrateOne", "g4_flowrateOne")
|
self.setIntSettingIfEnabled(caz_instance, "g3_Change_flowrateOne", "flowrateOne", "g4_flowrateOne")
|
||||||
self.setIntSettingIfEnabled(caz_instance, "g5_Change_flowrateTwo", "flowrateTwo", "g6_flowrateTwo")
|
self.setIntSettingIfEnabled(caz_instance, "g5_Change_flowrateTwo", "flowrateTwo", "g6_flowrateTwo")
|
||||||
self.setFloatSettingIfEnabled(caz_instance, "h1_Change_bedTemp", "bedTemp", "h2_bedTemp")
|
self.setFloatSettingIfEnabled(caz_instance, "h1_Change_bedTemp", "bedTemp", "h2_bedTemp")
|
||||||
|
self.setFloatSettingIfEnabled(caz_instance, "h1_Change_BuildVolumeTemperature", "BuildVolumeTemperature", "h2_BuildVolumeTemperature")
|
||||||
self.setFloatSettingIfEnabled(caz_instance, "i1_Change_extruderOne", "extruderOne", "i2_extruderOne")
|
self.setFloatSettingIfEnabled(caz_instance, "i1_Change_extruderOne", "extruderOne", "i2_extruderOne")
|
||||||
self.setFloatSettingIfEnabled(caz_instance, "i3_Change_extruderTwo", "extruderTwo", "i4_extruderTwo")
|
self.setFloatSettingIfEnabled(caz_instance, "i3_Change_extruderTwo", "extruderTwo", "i4_extruderTwo")
|
||||||
self.setIntSettingIfEnabled(caz_instance, "j1_Change_fanSpeed", "fanSpeed", "j2_fanSpeed")
|
self.setIntSettingIfEnabled(caz_instance, "j1_Change_fanSpeed", "fanSpeed", "j2_fanSpeed")
|
||||||
|
@ -776,6 +801,10 @@ class ChangeAtZProcessor:
|
||||||
if "bedTemp" in values:
|
if "bedTemp" in values:
|
||||||
codes.append("BedTemp: " + str(round(values["bedTemp"])))
|
codes.append("BedTemp: " + str(round(values["bedTemp"])))
|
||||||
|
|
||||||
|
# looking for wait for Build Volume Temperature
|
||||||
|
if "BuildVolumeTemperature" in values:
|
||||||
|
codes.append("BuildVolumeTemperature: " + str(round(values["BuildVolumeTemperature"])))
|
||||||
|
|
||||||
# set our extruder one temp (if specified)
|
# set our extruder one temp (if specified)
|
||||||
if "extruderOne" in values:
|
if "extruderOne" in values:
|
||||||
codes.append("Extruder 1 Temp: " + str(round(values["extruderOne"])))
|
codes.append("Extruder 1 Temp: " + str(round(values["extruderOne"])))
|
||||||
|
@ -846,7 +875,7 @@ class ChangeAtZProcessor:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# return our default block for this layer
|
# return our default block for this layer
|
||||||
return ";[CAZD:\n" + "\n".join(codes) + "\n;:CAZD]"
|
return ";[ChangeAtZ:\n" + "\n".join(codes) + "\n;ChangeAtZ]"
|
||||||
|
|
||||||
# Builds the relevant GCODE lines from the given collection of values
|
# Builds the relevant GCODE lines from the given collection of values
|
||||||
def getCodeLinesFromValues(self, values: Dict[str, any]) -> List[str]:
|
def getCodeLinesFromValues(self, values: Dict[str, any]) -> List[str]:
|
||||||
|
@ -858,6 +887,10 @@ class ChangeAtZProcessor:
|
||||||
if "bedTemp" in values:
|
if "bedTemp" in values:
|
||||||
codes.append("M140 S" + str(values["bedTemp"]))
|
codes.append("M140 S" + str(values["bedTemp"]))
|
||||||
|
|
||||||
|
# looking for wait for Build Volume Temperature
|
||||||
|
if "BuildVolumeTemperature" in values:
|
||||||
|
codes.append("M141 S" + str(values["BuildVolumeTemperature"]))
|
||||||
|
|
||||||
# set our extruder one temp (if specified)
|
# set our extruder one temp (if specified)
|
||||||
if "extruderOne" in values:
|
if "extruderOne" in values:
|
||||||
codes.append("M104 S" + str(values["extruderOne"]) + " T0")
|
codes.append("M104 S" + str(values["extruderOne"]) + " T0")
|
||||||
|
@ -943,12 +976,12 @@ class ChangeAtZProcessor:
|
||||||
# nothing to do
|
# nothing to do
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# Returns the unmodified GCODE line from previous ChangeZ edits
|
# Returns the unmodified GCODE line from previous ChangeAtZ edits
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getOriginalLine(line: str) -> str:
|
def getOriginalLine(line: str) -> str:
|
||||||
|
|
||||||
# get the change at z original (cazo) details
|
# get the change at z original (ChangeAtZ) details
|
||||||
original_line = re.search(r"\[CAZO:(.*?):CAZO\]", line)
|
original_line = re.search(r"\[ChangeAtZ:(.*?):ChangeAtZ\]", line)
|
||||||
|
|
||||||
# if we didn't get a hit, this is the original line
|
# if we didn't get a hit, this is the original line
|
||||||
if original_line is None:
|
if original_line is None:
|
||||||
|
@ -990,10 +1023,10 @@ class ChangeAtZProcessor:
|
||||||
else:
|
else:
|
||||||
return self.currentZ >= self.targetZ
|
return self.currentZ >= self.targetZ
|
||||||
|
|
||||||
# Marks any current ChangeZ layer defaults in the layer for deletion
|
# Marks any current ChangeAtZ layer defaults in the layer for deletion
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def markChangesForDeletion(layer: str):
|
def markChangesForDeletion(layer: str):
|
||||||
return re.sub(r";\[CAZD:", ";[CAZD:DELETE:", layer)
|
return re.sub(r";\[ChangeAtZ:", ";[ChangeAtZ:DELETE:", layer)
|
||||||
|
|
||||||
# Grabs the current height
|
# Grabs the current height
|
||||||
def processLayerHeight(self, line: str):
|
def processLayerHeight(self, line: str):
|
||||||
|
@ -1066,8 +1099,8 @@ class ChangeAtZProcessor:
|
||||||
self.processSetting(line)
|
self.processSetting(line)
|
||||||
|
|
||||||
# if we haven't hit our target yet, leave the defaults as is (unmark them for deletion)
|
# if we haven't hit our target yet, leave the defaults as is (unmark them for deletion)
|
||||||
if "[CAZD:DELETE:" in line:
|
if "[ChangeAtZ:DELETE:" in line:
|
||||||
line = line.replace("[CAZD:DELETE:", "[CAZD:")
|
line = line.replace("[ChangeAtZ:DELETE:", "[ChangeAtZ:")
|
||||||
|
|
||||||
# if we're targeting by Z, we want to add our values before the first linear move
|
# if we're targeting by Z, we want to add our values before the first linear move
|
||||||
if "G1 " in line or "G0 " in line:
|
if "G1 " in line or "G0 " in line:
|
||||||
|
@ -1288,10 +1321,10 @@ class ChangeAtZProcessor:
|
||||||
# flag that we're inside our target layer
|
# flag that we're inside our target layer
|
||||||
self.insideTargetLayer = True
|
self.insideTargetLayer = True
|
||||||
|
|
||||||
# Removes all the ChangeZ layer defaults from the given layer
|
# Removes all the ChangeAtZ layer defaults from the given layer
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def removeMarkedChanges(layer: str) -> str:
|
def removeMarkedChanges(layer: str) -> str:
|
||||||
return re.sub(r";\[CAZD:DELETE:[\s\S]+?:CAZD\](\n|$)", "", layer)
|
return re.sub(r";\[ChangeAtZ:DELETE:[\s\S]+?:ChangeAtZ\](\n|$)", "", layer)
|
||||||
|
|
||||||
# Resets the class contents to defaults
|
# Resets the class contents to defaults
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
@ -1316,7 +1349,7 @@ class ChangeAtZProcessor:
|
||||||
# Sets the original GCODE line in a given GCODE command
|
# Sets the original GCODE line in a given GCODE command
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def setOriginalLine(line, original) -> str:
|
def setOriginalLine(line, original) -> str:
|
||||||
return line + ";[CAZO:" + original + ":CAZO]"
|
return line + ";[ChangeAtZ:" + original + ":ChangeAtZ]"
|
||||||
|
|
||||||
# Tracks the change in gcode values we're interested in
|
# Tracks the change in gcode values we're interested in
|
||||||
def trackChangeableValues(self, line: str):
|
def trackChangeableValues(self, line: str):
|
||||||
|
@ -1364,6 +1397,16 @@ class ChangeAtZProcessor:
|
||||||
# move to the next command
|
# move to the next command
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# handle Build Volume Temperature changes, really shouldn't want to wait for enclousure temp mid print though.
|
||||||
|
if command.command == "M141" or command.command == "M191":
|
||||||
|
|
||||||
|
# get our bed temp if provided
|
||||||
|
if "S" in command.arguments:
|
||||||
|
self.lastValues["BuildVolumeTemperature"] = command.getArgumentAsFloat("S")
|
||||||
|
|
||||||
|
# move to the next command
|
||||||
|
return
|
||||||
|
|
||||||
# handle extruder temp changes
|
# handle extruder temp changes
|
||||||
if command.command == "M104" or command.command == "M109":
|
if command.command == "M104" or command.command == "M109":
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue