Move the nozzle up by 1cm instantly if printing aborted?

I've had a problem with my bed surface calibration after I moved nozzle way too upwards, and after that incident, I had to abort a few prints. Since I didn't check and didn't understand what's going on, my nozzle was digging into the print surface and when stopped, it left a hole in a place where it stopped ruining a new surface for me.
Is there a way for octoprint not to stay in place if I abort the print, but rather instantly move the nozzle 1cm upwards?

You can add whatever you want to the Gcode scripts in the settings.

Doc: GCODE Scripts — OctoPrint master documentation

You wnat the "afterPrintCancelled" script, default is specified there, but you could add below before M84:

G91; relative moves
G0 Z10; move up by 10

1 Like

Two points

You might wish to return to absolute mode after the G0.

This will be problematic if the nozzle height is more than Zmax - 10 when cancelled.

Why return to absolute? print is cancelled, and next print will reset all settings.

second point, the printer fw itself will limit the range of operation to sane values

What happens if you do something after cancelling and before initiating a new print.

Thanks, I did not know that, never been brave enough to test.

i would say, that it's responsibility of that "do something" to ensure that env is properly set, not the job before...

I guess it's just me, but why take a chance for one gcode?

That looks like something that may work, thank you. But is there a method to automatically inject this stuff in cura or in octoprint itself in case I'll be using a different slicer?

In slicers, you can configure what to do when job ends in normal way, since it's just appended to main gcode.
What to do when it's paused of aborted, is not normal flow execution, and hance can't be done at slicer level.