How to properly pause Octoprint to change filament manualy

How to properly pause Octoprint to change filament manualy

Clicking on Pause in Octoprint  stops the 3d print.  The printing head remains on the last position. If you want to change a filament you need to move the print head on a better position. In standard settings, you don’t have a chance to resume the print successfully. The print head doesn’t return to the last position automatically.

To be able to resume printing successfully,  you have enter some commands which will printer execute immediately after a click on Pause button and before the printer continues printing after a click on Resume button.

Go to the Octoprint settings  (wrench icon) -> GCODE Scripts. Into the input field “After print job is paused” enter  following code:

{% if pause_position.x is not none %}
; relative XYZE
G91
M83

; retract filament of 0.8 mm up, move Z slightly upwards and 
G1 Z+5 E-0.8 F4500

; absolute XYZE
M82
G90

; move to a safe rest position, adjust as necessary
G1 X0 Y0
{% endif %}

And into the “Before print job is resumed” input field

{% if pause_position.x is not none %}
; relative extruder
M83

; prime nozzle
G1 E-0.8 F4500
G1 E0.8 F4500
G1 E0.8 F4500

; absolute E
M82

; absolute XYZ
G90

; reset E
G92 E{{ pause_position.e }}

M83 ; extruder relative mode

; 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 %}

Credits: code above is modified code from this Octoprint documetation page.

Update:  September 21st 2018 11:20

This code was successfully tested on

  • Prusa MK2S
  • Prusa MK3
  • Octoprint Version 1.3.9
  •  Slic3r Prusa Edition 1.4.0 + win64

I am not able to test other 3d printers.

Bi-color cube printed via octoprint  by  pause/resume controls.

Share this post

Comments (11)

  • Kris Reply

    I believe, thta in “Before print job is resumed” after “reset E” should be M82 instead of M83.

    2018-08-16 at 19:29
    • Rick Reply

      Thank you so much, that mistake completely mess up my extruder. 😉 Thanks to the author nonetheless. 😀

      2018-09-20 at 21:22
      • yirco Reply

        Hello Rick,
        I am sorry you have problems with the code I posted. I wouldn’t post something which I didn’t tested. Nevertheless, I did it again. I copied the code from the webpage into the Octoprint.
        Then I run a print. Paused the print. Changed the filament. Resumed. And again – pause, changed the filament, resume. Everything worked fine for me.
        Current test configuration:
        – Prusa MK2S with Firmware 3.1.0
        – Octoprint Version 1.3.9
        – Raspberry Pi 3
        – Slic3r Prusa Edition 1.4.0 + win64
        What is your configuration?
        Did you move the extruder during the pause manually?

        @Kris,
        there is a switching from relative to absolute mode and back. It is possible that some switching is obsolete.
        Why do you recommend M82 instead of M83?

        2018-09-21 at 11:08
        • Murphy Reply

          Hey yirco – I just printed benchy with 2 layers using your pause G-code and it worked perfectly with the latest versions of everything.
          – Prusa i3 MK3 Firmware 3.4.0
          – Octoprint Version 1.3.9
          – Rapsberry Pi B+
          – Slic3r Prusa Edition 1.41.0+linux64
          Unloading and loading filament was simple using the standard menu on the MK3. After a slight lag when pause is selected (probably due to cached commands) the print head rose up, went to a safe position and awaited manual filament change. It resumed printing right where it left off when the resume button was selected. Thanks for the great G-code!

          2018-09-23 at 4:14
          • yirco

            Hi Murphy,
            thanks for sharing the positive experience.
            You are right about the lag after pressing/clicking the Pause. The printer has to finish movements which are already cached. Otherwise, it wouldn’t be possible to determine exactly the position where to continue.
            best regards
            yirco

            2018-09-24 at 12:19
    • Simon Barter Reply

      Thank you Yirco for the code!

      Thank you Kris, after changing it to M82 instead of M83 it worked on my FLSUN QQ too!!!!

      2018-10-13 at 18:49
  • noneya Reply

    Thanks for the code, but reset E still has M83. Please update the snippet.

    2018-10-27 at 1:29
  • Steve Reply

    Worked great on an Ender 3 with stock firmware. Thanks!

    2018-11-02 at 5:05
  • nigew Reply

    I tried it, with M83, on an Anycubic i3 MEGA, Octoprint 1.3.9, Pi 3 B, Cura 3.6 without success. The position movements are excellent. Unfortunately the feed did not restart, even though the position and movement did. Happy to try again, and report back, if you want to suggest an alternative resume script.

    2018-12-07 at 9:58
    • yirco Reply

      Hi nigew
      thanks for sharing.
      I am still not very sure why it on some printers work and not on others. I do believe that it depends on the slicer. I use Prusa printers and Sli3r Prusa Edition which sets extruder to relative mode on the beginning.

      Recently I’ve found this article about relative/absolute extruder mode. Look at the beginning of your GCODE generated by Cura. Is there M83 or M82 on the beginning? Before the printing continues you have to set it back to the mode of your slicer. I will appreciate if you try this and let us know about the result.
      best regards
      yirco

      2018-12-07 at 12:04
  • yirco Reply

    Hello guys,

    thank you all for sharing your experience. I suppose whether to use M83 or M82 in “before the print is resumed” depends on how the GCODE is generated. Each slicer can do it differently.
    Please let me know which slicer are you using and which M83/M82 works for you.
    If confirmed I will update the code with the comment.
    Thanks
    yirco

    2018-12-07 at 12:19

Leave a Reply

Your email address will not be published. Required fields are marked *