How to go to highest print Z before parking on pause/cancel?


What is the problem?
When printing multiple objects, with "complete individual object"
Cancelling or pausing (moving carriage to park position) crashes thru other, finished objects.

What did you already try to solve it?
Tried to look for a variable like "highest_z_so_far_during_this_print"


I can only answer reliably for my own printer, one with a bed which moves up/down. Review this throughout to make sure that it works for your printer. I assume that Z=0 is the maximum distance away from the bed. I further assume that you're using absolute extrusion mode.

Before Pause

{% if pause_position.x is not none %}
; relative XYZE

; retract filament
G1 E-5 F4500

; absolute XYZE

; move to a safe rest position, noting that we move up first, then horizontally
G1 Z0
G1 X0 Y0
{% endif %}

Before Resume

{% if pause_position.x is not none %}
; relative extruder mode + prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500
; and back to absolute extruder mode
M82                             ; Not good if you use relative extrusion

; absolute XYZ mode

; reset extruder audit to what it was earlier
G92 E{{ pause_position.e }}     ; Unnecessary if you use relative extrusion

; Here, I'm returning the hotend assembly horizontally first and then vertically
G1 X{{ pause_position.x }} Y{{ pause_position.y }} F4500
G1 Z{{ pause_position.z }} F4500

; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}
{% endif %}


Thank you. will try to adapt it to my printer where Z=0 is on the bed.