Update PurgeLinesAndUnload.py

Fixes an exception thrown upon a clean start.
This commit is contained in:
HellAholic 2025-06-05 20:57:24 +02:00 committed by GitHub
parent 6ac622826e
commit db8a625d8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,6 +37,10 @@ class PurgeLinesAndUnload(Script):
def __init__(self):
super().__init__()
def initialize(self) -> None:
super().initialize()
# Get required values from the global stack and set default values for the script
self.global_stack = Application.getInstance().getGlobalContainerStack()
self.extruder = self.global_stack.extruderList
self.end_purge_location = None
@ -56,9 +60,6 @@ class PurgeLinesAndUnload(Script):
self.machine_back = self.machine_depth - 1.0
self.start_x = None
self.start_y = None
def initialize(self) -> None:
super().initialize()
# Get the StartUp Gcode from Cura and attempt to catch if it contains purge lines. Message the user if an extrusion is in the startup.
startup_gcode = self.global_stack.getProperty("machine_start_gcode", "value")
start_lines = startup_gcode.splitlines()