GCode Scripts - pause and resume

Under GCODE scripts I have the following:

After print job is paused
; Raise nozzle
G0 Z5 F3000
; Lower Nozzle Temp (stop oozing)
M104 S160

Before print job is resumed
; Reset extruder temp before print
M109 S210
; Lower nozzle back down
G0 Z-5 F1000

The GCODE's work, however on resume the print nozzle crashes into the bed. I figured raising by 5mm then lowering by 5mm would place it back into the same Z position but it doesn't.

What command should I be using here?

Cheers

Ahhh nevermind, fixed it by adding a G91 (relative positioning) before the G0 then G90 (back to absolute) after

you're assuming relative positioning
if it was in absolute mode it
goes to position Z=5
pause
go to position z=-5

you need to set relative before
then absolute after

aha - we crossed!

hahaaa, timing - cheers - I'd just worked it out :slight_smile: Thanks.

Should also follow the doc's and use scripts with variables instead of hard coding the temps :slight_smile:

https://docs.octoprint.org/en/master/features/gcode_scripts.html