Skip to content

Commit

Permalink
PLUGIN: fix z-hop issue before move line in post processor
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeKeck committed Oct 30, 2024
1 parent 60f3843 commit ee36cfb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions klippy/ratos.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ def process_gode_file(self, filename, enable_post_processing):
move_x = ''
move_y = ''
move_line = 0
move_z_hop_line = 0
if toolchange_line > 0:
for i2 in range(20):
if lines[toolchange_line + i2].rstrip().replace(" ", " ").startswith("G1 X"):
Expand All @@ -430,6 +431,8 @@ def process_gode_file(self, filename, enable_post_processing):
move_x = splittedstring[1].rstrip()
move_y = splittedstring[2].rstrip()
move_line = toolchange_line + i2
if lines[toolchange_line + i2 - 1].rstrip().startswith("G1 Z"):
move_z_hop_line = toolchange_line + i2 - 1
break

# z-drop after toolchange
Expand Down Expand Up @@ -482,6 +485,8 @@ def process_gode_file(self, filename, enable_post_processing):
new_toolchange_gcode = ('TOOL T=' + lines[toolchange_line].rstrip().replace("T", "") + ' ' + move_x.replace("X", "X=") + ' ' + move_y.replace("Y", "Y=") + ' ' + move_z.replace("Z", "Z=")).rstrip()
lines[toolchange_line] = new_toolchange_gcode + '\n'
lines[move_line] = REMOVED_BY_POST_PROCESSOR + lines[move_line].rstrip().replace(" ", " ") + '\n'
if move_z_hop_line > 0:
lines[move_z_hop_line] = REMOVED_BY_POST_PROCESSOR + lines[move_z_hop_line].rstrip() + '\n'
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'
Expand Down

0 comments on commit ee36cfb

Please sign in to comment.