From bcb569977d3072ecbdc79cf3430fd48ea26447d9 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sat, 29 Nov 2025 21:04:59 +0100 Subject: [PATCH] CAM: Avoid adding trailing space to all M6 lines. The Fanuc post processor add a trailing space to all M6 lines. This make it problematic to write test for the generated output, when compiled with the automatic policy enforcer on github removing trialing space from the expected output. Avoid the problem by removing the trailing space from the generated output. --- src/Mod/CAM/Path/Post/scripts/fanuc_post.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Mod/CAM/Path/Post/scripts/fanuc_post.py b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py index 97ed5b031c..ab95d7fc4b 100644 --- a/src/Mod/CAM/Path/Post/scripts/fanuc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py @@ -437,6 +437,7 @@ def parse(pathobj): for index, c in enumerate(commands): outstring = [] + outsuffix = [] command = c.Name if index + 1 == len(commands): nextcommand = "" @@ -622,8 +623,7 @@ def parse(pathobj): # add height offset if USE_TLO: - tool_height = "\nG43 H" + str(int(c.Parameters["T"])) - outstring.append(tool_height) + outsuffix.append("G43 H" + str(int(c.Parameters["T"])) if command == "message": if OUTPUT_COMMENTS is False: @@ -637,9 +637,11 @@ def parse(pathobj): outstring.insert(0, (linenumber())) # append the line to the final output - for w in outstring: - out += w.upper() + COMMAND_SPACE + out += COMMAND_SPACE.join(outstring).upper() out = out.strip() + "\n" + if len(outsuffix) >= 1: + for line in outsuffix: + out += linenumber() + line + "\n" return out