From b91c5ef2aff66a9a801dac8dc6077786ea62d7d9 Mon Sep 17 00:00:00 2001 From: tarman3 Date: Thu, 10 Apr 2025 13:05:48 +0300 Subject: [PATCH] CAM: Multiline POSTAMBLE and PREAMBLE arguments in old postprocessors (#20715) * CAM Multiline POSTAMBLE and PREAMBLE in old postprocessors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * CAM: Fix preamble and postamble help text --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/Mod/CAM/Path/Post/scripts/KineticNCBeamicon2_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/dynapath_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/estlcam_post.py | 4 ++-- src/Mod/CAM/Path/Post/scripts/fangling_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/fanuc_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/grbl_post.py | 6 +++--- src/Mod/CAM/Path/Post/scripts/jtech_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/marlin_post.py | 4 ++-- src/Mod/CAM/Path/Post/scripts/rrf_post.py | 4 ++-- src/Mod/CAM/Path/Post/scripts/smoothie_post.py | 8 ++++---- src/Mod/CAM/Path/Post/scripts/uccnc_post.py | 4 ++-- src/Mod/CAM/Path/Post/scripts/wedm_post.py | 6 +++--- 15 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/Mod/CAM/Path/Post/scripts/KineticNCBeamicon2_post.py b/src/Mod/CAM/Path/Post/scripts/KineticNCBeamicon2_post.py index 5a3378ec6e..2005ca2141 100644 --- a/src/Mod/CAM/Path/Post/scripts/KineticNCBeamicon2_post.py +++ b/src/Mod/CAM/Path/Post/scripts/KineticNCBeamicon2_post.py @@ -68,11 +68,11 @@ parser.add_argument( parser.add_argument("--precision", default="3", help="number of digits of precision, default=3") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="G17\nG90"', + help='set commands to be issued before the first command, default="%\\nG17 G21 G40 G49 G80 G90\\nM08"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M05\nG17 G90\nM2"', + help='set commands to be issued after the last command, default="M05 M09\\nG17 G90 G80 G40\\nM30"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -156,9 +156,9 @@ def processArguments(argstring): print("Show editor = %d" % SHOW_EDITOR) PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py b/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py index 781135bae6..527ffa2167 100644 --- a/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py +++ b/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py @@ -59,11 +59,11 @@ parser.add_argument( parser.add_argument("--precision", default="3", help="number of digits of precision, default=3") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="G17\nG90\nG80\nG40"', + help='set commands to be issued before the first command, default="G17\\nG90\\nG80\\nG40"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M09\nM05\nG80\nG40\nG17\nG90\nM30"', + help='set commands to be issued after the last command, default="M09\\nM05\\nG80\\nG40\\nG17\\nG90\\nM30"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G70)" @@ -173,9 +173,9 @@ def processArguments(argstring): if args.precision is not None: PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G70" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/dynapath_post.py b/src/Mod/CAM/Path/Post/scripts/dynapath_post.py index 2e801c5723..4e1b83f3c2 100644 --- a/src/Mod/CAM/Path/Post/scripts/dynapath_post.py +++ b/src/Mod/CAM/Path/Post/scripts/dynapath_post.py @@ -86,11 +86,11 @@ parser.add_argument( parser.add_argument("--precision", default="3", help="number of digits of precision, default=3") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="G17\nG90\nG80\nG40"', + help='set commands to be issued before the first command, default="G17\\nG90\\nG80\\nG40"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M09\nM05\nG80\nG40\nG17\nG90\nM30"', + help='set commands to be issued after the last command, default="M09\\nM05\\nG80\\nG40\\nG17\\nG90\\nM30"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -176,9 +176,9 @@ def processArguments(argstring): print("Show editor = %d" % SHOW_EDITOR) PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/estlcam_post.py b/src/Mod/CAM/Path/Post/scripts/estlcam_post.py index ee47e9cc9d..878395c72c 100644 --- a/src/Mod/CAM/Path/Post/scripts/estlcam_post.py +++ b/src/Mod/CAM/Path/Post/scripts/estlcam_post.py @@ -179,9 +179,9 @@ def processArguments(argstring): SHOW_EDITOR = False PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/fangling_post.py b/src/Mod/CAM/Path/Post/scripts/fangling_post.py index 618f15de0e..7733b978aa 100644 --- a/src/Mod/CAM/Path/Post/scripts/fangling_post.py +++ b/src/Mod/CAM/Path/Post/scripts/fangling_post.py @@ -65,11 +65,11 @@ parser.add_argument( ) parser.add_argument("--precision", default="3", help="number of digits of precision, default=3") parser.add_argument( - "--preamble", help='set commands to be issued before the first command, default="G17\nG90"' + "--preamble", help='set commands to be issued before the first command, default="G90"' ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M5\nG17 G90\nM2"', + help='set commands to be issued after the last command, default="M8\\nG90 G40\\nM2"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -156,9 +156,9 @@ def processArguments(argstring): print("Show editor = %d" % SHOW_EDITOR) PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/fanuc_post.py b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py index 2edc7abafe..fd65a5e731 100644 --- a/src/Mod/CAM/Path/Post/scripts/fanuc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py @@ -60,11 +60,11 @@ parser.add_argument( parser.add_argument("--precision", default="3", help="number of digits of precision, default=3") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="G17\nG90"', + help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M05\nG17 G90\nM2"', + help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM6 T0\\nM2"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -161,9 +161,9 @@ def processArguments(argstring): print("Show editor = %d" % SHOW_EDITOR) PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/grbl_post.py b/src/Mod/CAM/Path/Post/scripts/grbl_post.py index 19437c297e..1ae2256f8c 100644 --- a/src/Mod/CAM/Path/Post/scripts/grbl_post.py +++ b/src/Mod/CAM/Path/Post/scripts/grbl_post.py @@ -127,7 +127,7 @@ parser.add_argument( ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M5\nG17 G90\n;M2"', + help='set commands to be issued after the last command, default="M5\\nG17 G90\\nM2"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -215,9 +215,9 @@ def processArguments(argstring): SHOW_EDITOR = True PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.no_translate_drill: TRANSLATE_DRILL_CYCLES = False if args.translate_drill: diff --git a/src/Mod/CAM/Path/Post/scripts/jtech_post.py b/src/Mod/CAM/Path/Post/scripts/jtech_post.py index 2b152031aa..17f89d05b1 100644 --- a/src/Mod/CAM/Path/Post/scripts/jtech_post.py +++ b/src/Mod/CAM/Path/Post/scripts/jtech_post.py @@ -56,11 +56,11 @@ parser.add_argument( parser.add_argument("--precision", default="3", help="number of digits of precision, default=3") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="M05 S0\nG90"', + help='set commands to be issued before the first command, default="M05 S0\\nG90"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M05 S0\nM2"', + help='set commands to be issued after the last command, default="M05 S0\\nM2"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -155,9 +155,9 @@ def processArguments(argstring): print("Show editor = %d" % SHOW_EDITOR) PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py b/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py index 3532c8d9d3..6697d8dc07 100644 --- a/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py @@ -56,11 +56,11 @@ parser.add_argument( parser.add_argument("--precision", default="3", help="number of digits of precision, default=3") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="G17\nG90"', + help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M05\nG17 G90\nM2"', + help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -148,9 +148,9 @@ def processArguments(argstring): print("Show editor = %d" % SHOW_EDITOR) PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py b/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py index 4933f6b244..6c5fcf5770 100644 --- a/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py +++ b/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py @@ -56,11 +56,11 @@ parser.add_argument( parser.add_argument("--precision", default="3", help="number of digits of precision, default=3") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="G17\nG90"', + help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M05\nG17 G90\nM2"', + help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -148,9 +148,9 @@ def processArguments(argstring): print("Show editor = %d" % SHOW_EDITOR) PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/marlin_post.py b/src/Mod/CAM/Path/Post/scripts/marlin_post.py index 8bf25a30ba..df0babcdf9 100644 --- a/src/Mod/CAM/Path/Post/scripts/marlin_post.py +++ b/src/Mod/CAM/Path/Post/scripts/marlin_post.py @@ -262,9 +262,9 @@ def processArguments(argstring): if args.show_editor: SHOW_EDITOR = True if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.no_translate_drill: TRANSLATE_DRILL_CYCLES = False if args.translate_drill: diff --git a/src/Mod/CAM/Path/Post/scripts/rrf_post.py b/src/Mod/CAM/Path/Post/scripts/rrf_post.py index a18d14b341..d6423e5e60 100644 --- a/src/Mod/CAM/Path/Post/scripts/rrf_post.py +++ b/src/Mod/CAM/Path/Post/scripts/rrf_post.py @@ -260,9 +260,9 @@ def processArguments(argstring): if args.show_editor: SHOW_EDITOR = True if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.no_translate_drill: TRANSLATE_DRILL_CYCLES = False if args.translate_drill: diff --git a/src/Mod/CAM/Path/Post/scripts/smoothie_post.py b/src/Mod/CAM/Path/Post/scripts/smoothie_post.py index 9d863b357f..70e6761823 100644 --- a/src/Mod/CAM/Path/Post/scripts/smoothie_post.py +++ b/src/Mod/CAM/Path/Post/scripts/smoothie_post.py @@ -68,11 +68,11 @@ parser.add_argument( parser.add_argument("--precision", default="4", help="number of digits of precision, default=4") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="G17\nG90"', + help='set commands to be issued before the first command, default="G17\\nG90"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M05\nG17 G90\nM2"', + help='set commands to be issued after the last command, default="M05\\nG17 G90\\nM2"', ) parser.add_argument("--IP_ADDR", help="IP Address for machine target machine") parser.add_argument( @@ -172,9 +172,9 @@ def processArguments(argstring): print("Show editor = %d" % SHOW_EDITOR) PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min" diff --git a/src/Mod/CAM/Path/Post/scripts/uccnc_post.py b/src/Mod/CAM/Path/Post/scripts/uccnc_post.py index a1382bb9a5..ddd6224399 100644 --- a/src/Mod/CAM/Path/Post/scripts/uccnc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/uccnc_post.py @@ -336,14 +336,14 @@ def processArguments(argstring): PRECISION = args.precision if args.preamble is not None: - PREAMBLE = args.preamble + PREAMBLE = args.preamble.replace("\\n", "\n") elif OUTPUT_COMMENTS: PREAMBLE = PREAMBLE_DEFAULT else: PREAMBLE = PREAMBLE_DEFAULT_NO_COMMENT if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") elif OUTPUT_COMMENTS: POSTAMBLE = POSTAMBLE_DEFAULT else: diff --git a/src/Mod/CAM/Path/Post/scripts/wedm_post.py b/src/Mod/CAM/Path/Post/scripts/wedm_post.py index fef75e01ff..141c4c34ee 100644 --- a/src/Mod/CAM/Path/Post/scripts/wedm_post.py +++ b/src/Mod/CAM/Path/Post/scripts/wedm_post.py @@ -68,11 +68,11 @@ parser.add_argument("--precision", default="3", help="number of digits of precis parser.add_argument("--fixed-length", default="0", help="use fixed length coordinates, default=0") parser.add_argument( "--preamble", - help='set commands to be issued before the first command, default="G17\nG90"', + help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90"', ) parser.add_argument( "--postamble", - help='set commands to be issued after the last command, default="M05\nG17 G90\nM2"', + help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2"', ) parser.add_argument( "--inches", action="store_true", help="Convert output for US imperial mode (G20)" @@ -208,7 +208,7 @@ def processArguments(argstring): if args.preamble is not None: PREAMBLE = args.preamble.replace("\\n", "\n") if args.postamble is not None: - POSTAMBLE = args.postamble + POSTAMBLE = args.postamble.replace("\\n", "\n") if args.inches: UNITS = "G20" UNIT_SPEED_FORMAT = "in/min"