Completion Code


What is the problem?

I am trying to make the bed on my CR-10 mini go forward when the print completes rather than end up with the bed at the back which needs the bed pulling forward to get the print off the base.

What did you already try to solve it?
I have put this code into the 'when print completes' box and also into the 'when print is cancelled' box in the GCODE Scripts settings

G1 F1800 E-3
G1 F3000 Z10
G28 X0 Y200 ; home x axis
M106 S0 ; turn off cooling fan
M104 S0 ; turn off extruder
M140 S0 ; turn off bed
M84 ; disable motors

This works correctly when I cancel a print, bringing the print bed forward for me to take the failed print of the bed but it doesn't when a print job is completed.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)

Printer:- CR-10 Mini
OctoPrint:- 1.3.10
Slicer:- Cura 3.6

Any ideas why this doesn't work for the end of print but it does for the cancel?

Also are there any other codes I should consider placing into this?


Iain Morrison


Hi @Iain_Morrison!

Just put this code to the second GCODE script box: After ending a print job.


Thanks - should I place this before the code I have in the box or replace the code I have in the box?


depends what you're putting there, but probably want to add and/or replace any moves.


My original post shows what I am putting into the boxes in Octoprint :slight_smile:


@tedder42 asked for the code you already have in the box After ending a print job .


That is what I have written in my original post


Sorry, I've overseen that.

Then it should work as aspected...

Could you please provide the logs then.


You have exactly the same code in "After print job is cancelled" and "After print job completes"
In the "cancelled" case it works - in the "completes"-case not.
Is it right so far?
Than there is a chance that someting in your endcode in Cura intersects with the "completes" endcode in Octoprint.


@BerndJM - you’ve have it spot on - I also wondered about whether the Cura code is causing an issue and I will try commenting out the Cura end of print and see if that fixes it - I thought that octoprint would apply its code after the print completed and therefore after the Cura gcode has run though?

Will try it and see what happens



Check Cura for any post-processing scripts. If it adds an M84 then that would turn off the motors, defeating your attempt to move things around.