mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 00:45:13 +08:00
Update ChangeAtZ.py
fixed typos and the gcode insert makes it easier to find for others "changeatz"
This commit is contained in:
parent
4508f60ce5
commit
35dd43675c
@ -79,7 +79,7 @@ class ChangeAtZ(Script):
|
|||||||
"description": "Allows adding multiple ChangeAtZ 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
|
||||||
},
|
},
|
||||||
"a_trigger": {
|
"a_trigger": {
|
||||||
"label": "Trigger",
|
"label": "Trigger",
|
||||||
"description": "Trigger at height or at layer no.",
|
"description": "Trigger at height or at layer no.",
|
||||||
@ -126,7 +126,7 @@ class ChangeAtZ(Script):
|
|||||||
"description": "Displays the current changes to the LCD",
|
"description": "Displays the current changes to the LCD",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": false
|
"default_value": false
|
||||||
},
|
},
|
||||||
"e1_Change_speed": {
|
"e1_Change_speed": {
|
||||||
"label": "Change Speed",
|
"label": "Change Speed",
|
||||||
"description": "Select if total speed (print and travel) has to be changed",
|
"description": "Select if total speed (print and travel) has to be changed",
|
||||||
@ -160,7 +160,7 @@ class ChangeAtZ(Script):
|
|||||||
"minimum_value_warning": "10",
|
"minimum_value_warning": "10",
|
||||||
"maximum_value_warning": "200",
|
"maximum_value_warning": "200",
|
||||||
"enabled": "f1_Change_printspeed"
|
"enabled": "f1_Change_printspeed"
|
||||||
},
|
},
|
||||||
"g1_Change_flowrate": {
|
"g1_Change_flowrate": {
|
||||||
"label": "Change Flow Rate",
|
"label": "Change Flow Rate",
|
||||||
"description": "Select if flow rate has to be changed",
|
"description": "Select if flow rate has to be changed",
|
||||||
@ -302,25 +302,25 @@ class ChangeAtZ(Script):
|
|||||||
"description": "Indicates you would like to modify retraction properties.",
|
"description": "Indicates you would like to modify retraction properties.",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": false
|
"default_value": false
|
||||||
},
|
},
|
||||||
"caz_retractstyle": {
|
"caz_retractstyle": {
|
||||||
"label": "Retract Style",
|
"label": "Retract Style",
|
||||||
"description": "Specify if you're using firmware retraction or linear move based retractions. Check your printer settings to see which you're using.",
|
"description": "Specify if you're using firmware retraction or linear move based retractions. Check your printer settings to see which you're using.",
|
||||||
"type": "enum",
|
"type": "enum",
|
||||||
"options": {
|
"options": {
|
||||||
"linear": "Linear Move",
|
"linear": "Linear Move",
|
||||||
"firmware": "Firmware"
|
"firmware": "Firmware"
|
||||||
},
|
},
|
||||||
"default_value": "linear",
|
"default_value": "linear",
|
||||||
"enabled": "caz_change_retract"
|
"enabled": "caz_change_retract"
|
||||||
},
|
},
|
||||||
"caz_change_retractfeedrate": {
|
"caz_change_retractfeedrate": {
|
||||||
"label": "Change Retract Feed Rate",
|
"label": "Change Retract Feed Rate",
|
||||||
"description": "Changes the retraction feed rate during print",
|
"description": "Changes the retraction feed rate during print",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": false,
|
"default_value": false,
|
||||||
"enabled": "caz_change_retract"
|
"enabled": "caz_change_retract"
|
||||||
},
|
},
|
||||||
"caz_retractfeedrate": {
|
"caz_retractfeedrate": {
|
||||||
"label": "Retract Feed Rate",
|
"label": "Retract Feed Rate",
|
||||||
"description": "New Retract Feed Rate (mm/s)",
|
"description": "New Retract Feed Rate (mm/s)",
|
||||||
@ -370,7 +370,6 @@ class ChangeAtZ(Script):
|
|||||||
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_enclosureTemp", "enclosureTemp", "h2_enclosureTemp")
|
self.setFloatSettingIfEnabled(caz_instance, "h1_Change_enclosureTemp", "enclosureTemp", "h2_enclosureTemp")
|
||||||
|
|
||||||
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")
|
||||||
@ -876,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]:
|
||||||
@ -981,8 +980,8 @@ class ChangeAtZProcessor:
|
|||||||
@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:
|
||||||
@ -1027,7 +1026,7 @@ class ChangeAtZProcessor:
|
|||||||
# Marks any current ChangeAtZ 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):
|
||||||
@ -1100,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:
|
||||||
@ -1325,7 +1324,7 @@ class ChangeAtZProcessor:
|
|||||||
# Removes all the ChangeAtZ 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):
|
||||||
@ -1350,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):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user