Update ChangeAtZ.py

fixed typos and the gcode insert makes it easier to find for others "changeatz"
This commit is contained in:
legend069 2021-10-03 20:00:08 +11:00
parent 4508f60ce5
commit 35dd43675c

View File

@ -370,7 +370,6 @@ class ChangeAtZ(Script):
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_enclosureTemp", "enclosureTemp", "h2_enclosureTemp")
self.setFloatSettingIfEnabled(caz_instance, "i1_Change_extruderOne", "extruderOne", "i2_extruderOne")
self.setFloatSettingIfEnabled(caz_instance, "i3_Change_extruderTwo", "extruderTwo", "i4_extruderTwo")
self.setIntSettingIfEnabled(caz_instance, "j1_Change_fanSpeed", "fanSpeed", "j2_fanSpeed")
@ -876,7 +875,7 @@ class ChangeAtZProcessor:
return ""
# 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
def getCodeLinesFromValues(self, values: Dict[str, any]) -> List[str]:
@ -981,8 +980,8 @@ class ChangeAtZProcessor:
@staticmethod
def getOriginalLine(line: str) -> str:
# get the change at z original (cazo) details
original_line = re.search(r"\[CAZO:(.*?):CAZO\]", line)
# get the change at z original (ChangeAtZ) details
original_line = re.search(r"\[ChangeAtZ:(.*?):ChangeAtZ\]", line)
# if we didn't get a hit, this is the original line
if original_line is None:
@ -1027,7 +1026,7 @@ class ChangeAtZProcessor:
# Marks any current ChangeAtZ layer defaults in the layer for deletion
@staticmethod
def markChangesForDeletion(layer: str):
return re.sub(r";\[CAZD:", ";[CAZD:DELETE:", layer)
return re.sub(r";\[ChangeAtZ:", ";[ChangeAtZ:DELETE:", layer)
# Grabs the current height
def processLayerHeight(self, line: str):
@ -1100,8 +1099,8 @@ class ChangeAtZProcessor:
self.processSetting(line)
# if we haven't hit our target yet, leave the defaults as is (unmark them for deletion)
if "[CAZD:DELETE:" in line:
line = line.replace("[CAZD:DELETE:", "[CAZD:")
if "[ChangeAtZ:DELETE:" in line:
line = line.replace("[ChangeAtZ:DELETE:", "[ChangeAtZ:")
# 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:
@ -1325,7 +1324,7 @@ class ChangeAtZProcessor:
# Removes all the ChangeAtZ layer defaults from the given layer
@staticmethod
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
def reset(self):
@ -1350,7 +1349,7 @@ class ChangeAtZProcessor:
# Sets the original GCODE line in a given GCODE command
@staticmethod
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
def trackChangeableValues(self, line: str):