diff --git a/src/Mod/CAM/CAMTests/TestLinuxCNCPost.py b/src/Mod/CAM/CAMTests/TestLinuxCNCPost.py index a33ee00998..68988f32d9 100644 --- a/src/Mod/CAM/CAMTests/TestLinuxCNCPost.py +++ b/src/Mod/CAM/CAMTests/TestLinuxCNCPost.py @@ -188,3 +188,14 @@ class TestLinuxCNCPost(PathTestUtils.PathTestBase): lines = gcode.splitlines() has_g64_without_p = any("G64" in line and "P" not in line for line in lines) self.assertTrue(has_g64_without_p, "Expected G64 without P parameter when tolerance is 0") + + def test_blend_interaction_with_preamble_argument(self): + """Test interaction with a --preamble command line argument.""" + self.profile_op.Path = Path.Path([]) + self.job.PostProcessorArgs = ( + '--no-header --no-comments --blend-mode BLEND --preamble="G80 G90" --no-show-editor' + ) + gcode = self.post.export()[0][1] + lines = gcode.splitlines() + self.assertEqual(lines[0], "G80 G90") + self.assertEqual(lines[1], "G64") diff --git a/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py b/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py index 71e22a9d3e..bdc0207e54 100644 --- a/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py @@ -172,10 +172,7 @@ M2""" # Update PREAMBLE with blend command blend_cmd = self._get_blend_command() - self.values[ - "PREAMBLE" - ] = f"""G17 G54 G40 G49 G80 G90 -{blend_cmd}""" + self.values["PREAMBLE"] += f"\n{blend_cmd}" return flag, args