CAM: fix some non-refactored postprocessors crashing on blank lines

This commit is contained in:
jffmichi
2025-05-20 05:00:06 +02:00
parent 7b58dd2977
commit a59fc30d6c
13 changed files with 13 additions and 13 deletions

View File

@@ -344,7 +344,7 @@ def parse(pathobj):
if command == lastcommand:
outstring.pop(0)
if c.Name[0] == "(" and not OUTPUT_COMMENTS: # command is a comment
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
continue
# Now add the remaining parameters in order

View File

@@ -282,7 +282,7 @@ def parse(pathobj):
commandlist = [] # list of elements in the command, code and params.
command = c.Name # command M or G code or comment string
if command[0] == "(":
if command.startswith("("):
command = PostUtils.fcoms(command, COMMENT)
commandlist.append(command)

View File

@@ -401,7 +401,7 @@ def parse(pathobj):
if command == lastcommand:
outstring.pop(0)
if c.Name[0] == "(" and not OUTPUT_COMMENTS: # command is a comment
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
continue
# Now add the remaining parameters in order

View File

@@ -251,7 +251,7 @@ def parse(pathobj):
command = c.Name
# fablin does not support parenthesis syntax, so removing that (pocket) in the agnostic gcode
if command[0] == "(":
if command.startswith("("):
if not OUTPUT_COMMENTS:
pass
else:

View File

@@ -411,7 +411,7 @@ def parse(pathobj):
if command == lastcommand:
outstring.pop(0)
if c.Name[0] == "(" and not OUTPUT_COMMENTS: # command is a comment
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
continue
# Now add the remaining parameters in order

View File

@@ -504,7 +504,7 @@ def parse(pathobj):
if command == "G80" and lastcommand == nextcommand:
continue
if c.Name[0] == "(" and not OUTPUT_COMMENTS: # command is a comment
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
continue
# Now add the remaining parameters in order

View File

@@ -313,7 +313,7 @@ def parse(pathobj):
if command == lastcommand:
outstring.pop(0)
if c.Name[0] == "(" and not OUTPUT_COMMENTS: # command is a comment
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
continue
# Now add the remaining parameters in order

View File

@@ -355,7 +355,7 @@ def parse(pathobj):
if command == lastcommand:
outstring.pop(0)
if c.Name[0] == "(" and not OUTPUT_COMMENTS: # command is a comment
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
continue
# Now add the remaining parameters in order

View File

@@ -387,7 +387,7 @@ def parse(pathobj):
if command == lastcommand:
outstring.pop(0)
if c.Name[0] == "(" and not OUTPUT_COMMENTS: # command is a comment
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
continue
# Now add the remaining parameters in order

View File

@@ -359,7 +359,7 @@ def parse(pathobj):
output += scommands[command](c)
if c.Parameters:
CurrentState.update(c.Parameters)
elif command[0] == "(":
elif command.startswith("("):
output += "' " + command + "\n"
else:
print("I don't know what the hell the command: ", end="")

View File

@@ -412,7 +412,7 @@ def export(objectslist, filename, argstring):
command = command.replace("G0", "G") # normalize: G01 -> G1
if command != UNITS or UNITS_INCLUDED:
if command[0] == "(":
if command.startswith("("):
command = PostUtils.fcoms(command, COMMENT)
# the mapping is done for output only! For internal things we
# still use the old value.

View File

@@ -599,7 +599,7 @@ def parse(pathobj):
if command == lastcommand:
commandlist.pop(0)
if c.Name[0] == "(" and not OUTPUT_COMMENTS: # command is a comment
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
continue
# Now add the remaining parameters in order

View File

@@ -456,7 +456,7 @@ def parse(pathobj):
if command == lastcommand:
outstring.pop(0)
if command[0] == "(": # command is a comment
if command.startswith("("): # command is a comment
if OUTPUT_COMMENTS: # Edit comment with COMMENT_CHAR
outstring.insert(0, COMMENT_CHAR)
else: