From bca1fe32d1832571101e4d95fe6ee5d1435872e5 Mon Sep 17 00:00:00 2001 From: petterreinholdtsen Date: Fri, 9 Jan 2026 17:40:02 +0100 Subject: [PATCH] CAM: Dropped trailing percent from fanuc post processor output. (#26617) * CAM: Dropped trailing percent from fanuc post processor output. A trailing percent cause one Fanuc controller to hang when the program is completed when drip feeding G code, and the minicom ascii upload was unable to complete the upload. Had to use emergecy stop to get the machine out of the hang. * CAM: Adjust Fanuc post processor test to no longer expect trailing percent. --- src/Mod/CAM/CAMTests/TestFanucPost.py | 13 ++++--------- src/Mod/CAM/Path/Post/scripts/fanuc_post.py | 1 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Mod/CAM/CAMTests/TestFanucPost.py b/src/Mod/CAM/CAMTests/TestFanucPost.py index 3ad8501185..d1f320d3f5 100644 --- a/src/Mod/CAM/CAMTests/TestFanucPost.py +++ b/src/Mod/CAM/CAMTests/TestFanucPost.py @@ -91,7 +91,7 @@ class TestFanucPost(PathTestUtils.PathTestBase): # Header contains a time stamp that messes up unit testing. # Only test length of result. gcode = self.post.export()[0][1] - self.assertEqual(28, len(gcode.splitlines())) + self.assertEqual(27, len(gcode.splitlines())) # Test without header expected = """% (BEGIN PREAMBLE) @@ -117,7 +117,6 @@ G54 M05 G17 G54 G90 G80 G40 M30 -% """ self.profile_op.Path = Path.Path([]) @@ -143,7 +142,6 @@ G54 M05 G17 G54 G90 G80 G40 M30 -% """ self.profile_op.Path = Path.Path([]) @@ -166,7 +164,7 @@ M30 # Header contains a time stamp that messes up unit testing. # Only test length of result. gcode = self.post.export()[0][1] - self.assertEqual(32, len(gcode.splitlines())) + self.assertEqual(31, len(gcode.splitlines())) # Test without header expected = """% (BEGIN PREAMBLE) @@ -196,7 +194,6 @@ M6 T0 M05 G17 G54 G90 G80 G40 M30 -% """ self.profile_op.Path = Path.Path([]) @@ -225,7 +222,6 @@ M6 T0 M05 G17 G54 G90 G80 G40 M30 -% """ self.profile_op.Path = Path.Path([]) @@ -290,9 +286,8 @@ M30 "--no-header --no-comments --postamble='G0 Z50\nM30' --no-show-editor" ) gcode = self.post.export()[0][1] - self.assertEqual(gcode.splitlines()[-3], "G0 Z50") - self.assertEqual(gcode.splitlines()[-2], "M30") - self.assertEqual(gcode.splitlines()[-1], "%") + self.assertEqual(gcode.splitlines()[-2], "G0 Z50") + self.assertEqual(gcode.splitlines()[-1], "M30") def test_inches(self): """ diff --git a/src/Mod/CAM/Path/Post/scripts/fanuc_post.py b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py index 399de11221..85a3d88d50 100644 --- a/src/Mod/CAM/Path/Post/scripts/fanuc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py @@ -348,7 +348,6 @@ def export(objectslist, filename, argstring): gcode += "(BEGIN POSTAMBLE)\n" for line in POSTAMBLE.splitlines(): gcode += linenumber() + line + "\n" - gcode += "%\n" if FreeCAD.GuiUp and SHOW_EDITOR: dia = PostUtils.GCodeEditorDialog()