CAM: fix some non-refactored postprocessors crashing on blank lines
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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="")
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user