Skip to content

Commit

Permalink
Post Processor: fix new prusa slicer z-hop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeKeck committed Oct 24, 2024
1 parent 2fedbf3 commit 3390caa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion klippy/ratos.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def cmd_TEST_PROCESS_GCODE_FILE(self, gcmd):
filename = gcmd.get('FILENAME', "")
if filename[0] == '/':
filename = filename[1:]
self.process_gode_file(filename, False)
self.process_gode_file(filename, True)
self.dual_carriage = dual_carriage

desc_HELLO_RATOS = "RatOS mainsail welcome message"
Expand Down Expand Up @@ -403,11 +403,14 @@ def process_gode_file(self, filename, enable_post_processing):

# toolchange retraction
retraction_line = 0
retraction_z_hop_line = 0
if tower_line == 0 and toolchange_line > 0:
for i2 in range(20):
if slicer_name == PRUSA_SLICER or slicer_name == SUPER_SLICER:
if lines[toolchange_line + i2].rstrip().startswith("G1 E-"):
retraction_line = toolchange_line + i2
if lines[toolchange_line + i2 + 1].rstrip().startswith("G1 Z"):
retraction_z_hop_line = toolchange_line + i2 + 1
break
elif slicer_name == ORCA_SLICER:
if lines[toolchange_line - i2].rstrip().startswith("G1 E-"):
Expand Down Expand Up @@ -482,6 +485,8 @@ def process_gode_file(self, filename, enable_post_processing):
if retraction_line > 0 and extrusion_line > 0:
lines[retraction_line] = REMOVED_BY_POST_PROCESSOR + lines[retraction_line].rstrip() + '\n'
lines[extrusion_line] = REMOVED_BY_POST_PROCESSOR + lines[extrusion_line].rstrip() + '\n'
if retraction_z_hop_line > 0:
lines[retraction_z_hop_line] = REMOVED_BY_POST_PROCESSOR + lines[retraction_z_hop_line].rstrip() + '\n'

# add START_PRINT parameters
if (enable_post_processing):
Expand Down

0 comments on commit 3390caa

Please sign in to comment.