I see the recommended GCODE snippet for beforePrintResumed in the Octoprint documentation, but I would also like to have it re-home X and Y axises before resuming the print to ensure the system knows where the nozzle actually is in relation to the bed. I just knocked my hot end off by accident (stumbled into my printer lol!) and lost a big print, so it would be nice to be able to press pause and have it G28 X Y before resuming. However, I don't know if that requires additional steps in the GCODE or where to place it to work properly. Absolute vs relative positioning I'm still kind of uncertain of how to use in GCODE. This is what I got from the documentation, and I am using Cura as my slicer. Thanks!
{% if pause_position.x is not none %}
; relative extruder
M83
; prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500
; absolute E
M82
; absolute XYZ
G90
; reset E
G92 E{{ pause_position.e }}
; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} 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 %}
Anywhere after the G90 and before the following G1.
If I were changing this code, I'd move the reset E above the G90 so the first part of the code deals with E and the second part deals with X,Y, and Z. You will have to determine how your printer reacts to G28 XY
. Mine positions the nozzle over the Z-min switch in anticipation of a G28 Z
. I'd have to separate the G1 into two commands, one to get Z back to the proper height before moving to the old X and Y locations.
So along the lines of:
{% if pause_position.x is not none %}
; re-home X & Y over Z min switch
G28 X Y
; relative extruder
M83
; prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500
; absolute E
M82
; reset E
G92 E{{ pause_position.e }}
; absolute XYZ
G90
; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} 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 %}
Not exactly. The G28
code goes after the M90
and the comment should reflect how YOUR printer acts, not mine. If G28 XY
messes with Z, then I believe the best implementation would change G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500
into:
G1 Z{{ pause_position.z }} F4500
G1 X{{ pause_position.x }} Y{{ pause_position.y }} F4500
This avoids the possibility that the straight line between where the nozzle is and where the nozzle needs to be intersecting with the printed object, probably knocking it over.
You will need to do the testing on your printer and make any modifications necessary. I can't do that for you.
1 Like