From 42636926ca52bb1499e2ed1bc6c93d97c21945f4 Mon Sep 17 00:00:00 2001 From: jalapenopuzzle <8386278+jalapenopuzzle@users.noreply.github.com> Date: Sat, 29 Mar 2025 12:30:03 +1100 Subject: [PATCH] CAM: snapmaker clean output_header() --- src/Mod/CAM/CAMTests/TestSnapmakerPost.py | 2 +- src/Mod/CAM/Path/Post/scripts/snapmaker_post.py | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Mod/CAM/CAMTests/TestSnapmakerPost.py b/src/Mod/CAM/CAMTests/TestSnapmakerPost.py index 2186482bb9..ac0cb9f3e2 100644 --- a/src/Mod/CAM/CAMTests/TestSnapmakerPost.py +++ b/src/Mod/CAM/CAMTests/TestSnapmakerPost.py @@ -78,7 +78,7 @@ class TestSnapmakerPost(PathTestUtils.PathTestBase): ;header_type: cnc ;machine: Snapmaker 2 A350 50W CNC module ;Post Processor: snapmaker_post -;Cam File: boxtest.fcstd +;CAM File: boxtest.fcstd ;Output Time: \\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{0,6} ;thumbnail: deactivated.""" diff --git a/src/Mod/CAM/Path/Post/scripts/snapmaker_post.py b/src/Mod/CAM/Path/Post/scripts/snapmaker_post.py index 5b50f42219..613ffcbf01 100644 --- a/src/Mod/CAM/Path/Post/scripts/snapmaker_post.py +++ b/src/Mod/CAM/Path/Post/scripts/snapmaker_post.py @@ -565,8 +565,6 @@ class Snapmaker(Path.Post.Processor.PostProcessor): def output_header(self, gcode: List[str]): """custom method derived from Path.Post.UtilsExport.output_header""" cam_file: str - comment: str - nl: str = "\n" if not self.values["OUTPUT_HEADER"]: return @@ -580,15 +578,12 @@ class Snapmaker(Path.Post.Processor.PostProcessor): add_comment("Header Start") add_comment("header_type: cnc") add_comment(f'machine: {self.values["MACHINE_NAME"]}') - comment = Path.Post.UtilsParse.create_comment( - self.values, f'Post Processor: {self.values["POSTPROCESSOR_FILE_NAME"]}' - ) - gcode.append(f"{Path.Post.UtilsParse.linenumber(self.values)}{comment}{nl}") + add_comment(f'Post Processor: {self.values["POSTPROCESSOR_FILE_NAME"]}') if FreeCAD.ActiveDocument: cam_file = os.path.basename(FreeCAD.ActiveDocument.FileName) else: cam_file = "" - add_comment(f"Cam File: {cam_file}") + add_comment(f"CAM File: {cam_file}") add_comment(f"Output Time: {datetime.datetime.now()}") add_comment(self.get_thumbnail())