OctoPrint "After Print Job is Cancelled" GCODE Script
 
Notifications
Clear all

[Closed] OctoPrint "After Print Job is Cancelled" GCODE Script  

  RSS
Woody
(@woody-2)
New Member
OctoPrint "After Print Job is Cancelled" GCODE Script

Posting this here in the hopes that it will help someone in the future. I am using OctoPrint v1.3.4, with a Original Prusa i3 MK2 running FW 3.0.11. Hre is my problem; when I cancel a print from the OctoPrint interface, it just does a dead stop, and shuts things down. This has lead to a bunch of extra cleanup getting bad prints off of the print head. :/ I wanted OctoPrint to behave like a cancel from the LCD, here is what I came up with;

In OctoPrint go to Settings (the wrench), then GCODE Scripts. In the "After Print Job is Cancelled" area enter the following;


G91; Set to Relative position
G1 E-1 F300; retract the filament a bit before lifting the nozzle
G0 Z15; move z axis up 15
G28 X; home X axis
G1 Y150 F5000; move part out for inspection
G90; Set to Absolute position
M104 S0 ; turn off extruder heat
M140 S0 ; turn off heated bed
M106 S0 ; Turn off fan
M18; Move Freely

Save and test. A "Cancel" from OctoPrint should behave much more like a cancel form the LCD.

Hope this helps,
-Woody.

Posted : 11/06/2017 11:40 pm
Bytor
(@bytor)
Estimable Member
Re: OctoPrint "After Print Job is Cancelled" GCODE Script

Thanks for the code.

I gave it a try and it works great so far. Much better than the standard cancel action of Octopi.

- 1st "printer" TIKO 3D
- 2nd PRUSA i3 MK2S with MMU v1
- 3rd PRUSA i3 MK2S
- 4th PRUSA i3 MK3 with MMU v2- 5th PRUSA i3 MK4 (upgraded from MK3) with MMU v3 (upgraded from…

Posted : 16/06/2017 3:19 am
Carsten
(@carsten-2)
Estimable Member
Re: OctoPrint "After Print Job is Cancelled" GCODE Script

I will try it also.

One thing: the GCode Reprap Wiki says that Marlin (based) FWs should call M84 instead of M18?

Carsten

My Prints: https://www.prusaprinters.org/social/15695-carsten/prints
My Employer: https://make-magazin.de

Posted : 25/06/2017 12:41 pm
Birdman2010
(@birdman2010)
Eminent Member
Re: OctoPrint "After Print Job is Cancelled" GCODE Script

Thank you for this post! You posted last year and it helped me today!

I changed your code slightly since you moved the extruder using relative positioning. I changed it to absolute positioning. In addition, there was default code in this section already so I used the existing code. Here is my updated code:

G91 ; set to Relative position
G1 E-1 F300 ; retract filament a bit before lifting nozzle
G0 Z15 ; move z axis up 15mm
G90 ; set to Absolute position
G1 Y190 F5000 ; move part out for inspection
G1 X190 F5000 ; move nozzle out of the way

M84 ; disable motors

;disable all heaters
{% snippet 'disable_hotends' %}
{% snippet 'disable_bed' %}

M106 S0 ; disable fan

Posted : 11/06/2018 6:57 pm
Woody liked
Share: