From 20847a0b33a9f31da2e1d3a464976f88669437ef Mon Sep 17 00:00:00 2001 From: HellAholic Date: Thu, 26 Dec 2024 16:54:26 +0100 Subject: [PATCH] Final adjustments to V2 - Add condition to check for self.start_y before appending undefined/non to the gcode - Move self.start_x and self.start_y def to the init() --- .../PostProcessingPlugin/scripts/PurgeLinesAndUnload_v2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/PurgeLinesAndUnload_v2.py b/plugins/PostProcessingPlugin/scripts/PurgeLinesAndUnload_v2.py index f276f56e71..81dc05507a 100644 --- a/plugins/PostProcessingPlugin/scripts/PurgeLinesAndUnload_v2.py +++ b/plugins/PostProcessingPlugin/scripts/PurgeLinesAndUnload_v2.py @@ -56,6 +56,8 @@ class PurgeLinesAndUnload_V2(Script): self.machine_right = self.machine_width - 1.0 self.machine_front = 1.0 self.machine_back = self.machine_depth - 1.0 + self.start_x = None + self.start_y = None def initialize(self) -> None: super().initialize() @@ -352,7 +354,7 @@ class PurgeLinesAndUnload_V2(Script): add_move("Y", self.machine_back) else: add_move("Y", self.machine_front) - if len(moves) <= 1: + if len(moves) == 1 and self.start_y: moves.append(f"G0 F{self.speed_travel} Y{self.start_y} ; Move to start Y\n") # Combine moves into a single G-code string or return a comment if no movement is needed return "".join(moves) if len(moves) > 1 else f";----------[Already at {location_name}, No Moves necessary]\n" @@ -707,8 +709,6 @@ class PurgeLinesAndUnload_V2(Script): # Travel moves around the bed periphery to keep strings from crossing the footprint of the model. def _move_to_start(self, data: str) -> str: - self.start_x = None - self.start_y = None move_str = None layer = data[2].split("\n") for line in layer: