CAM: add configuration value to suppress blank lines in refactored postprocessors
This commit is contained in:
@@ -667,6 +667,42 @@ G54
|
||||
|
||||
#############################################################################
|
||||
|
||||
def test00191(self):
|
||||
"""Make sure postprocessor doesn't crash on blank lines"""
|
||||
|
||||
path = [
|
||||
Path.Command("G0 X1"),
|
||||
Path.Command(""),
|
||||
Path.Command("G0 X2"),
|
||||
]
|
||||
|
||||
self.post.values["OUTPUT_BLANK_LINES"] = True
|
||||
self.multi_compare(
|
||||
path,
|
||||
"""G90
|
||||
G21
|
||||
G54
|
||||
G0 X1.000
|
||||
|
||||
G0 X2.000
|
||||
""",
|
||||
"",
|
||||
)
|
||||
|
||||
self.post.values["OUTPUT_BLANK_LINES"] = False
|
||||
self.multi_compare(
|
||||
path,
|
||||
"""G90
|
||||
G21
|
||||
G54
|
||||
G0 X1.000
|
||||
G0 X2.000
|
||||
""",
|
||||
"",
|
||||
)
|
||||
|
||||
#############################################################################
|
||||
|
||||
def test00200(self):
|
||||
"""Test Outputting visible arguments.
|
||||
|
||||
|
||||
@@ -478,6 +478,10 @@ def init_shared_values(values: Values) -> None:
|
||||
#
|
||||
values["OUTPUT_COMMENTS"] = True
|
||||
#
|
||||
# If True output blank lines. If False blank lines are suppressed.
|
||||
#
|
||||
values["OUTPUT_BLANK_LINES"] = True
|
||||
#
|
||||
# if False duplicate axis values or feeds are suppressed
|
||||
# if they are the same as the previous line.
|
||||
#
|
||||
|
||||
@@ -719,6 +719,11 @@ def parse_a_path(values: Values, gcode: Gcode, pathobj) -> None:
|
||||
command = c.Name
|
||||
command_line = []
|
||||
|
||||
# Skip blank lines if requested
|
||||
if not command:
|
||||
if not values["OUTPUT_BLANK_LINES"]:
|
||||
continue
|
||||
|
||||
# Modify the command name if necessary
|
||||
if command.startswith("("):
|
||||
if not values["OUTPUT_COMMENTS"]:
|
||||
|
||||
Reference in New Issue
Block a user