Notifications
Clear all

G-code snippets for pause/resume with octoprint?  

  RSS
Marc Liyanage
(@marc-liyanage)
Active Member
G-code snippets for pause/resume with octoprint?

I recently asked about pausing prints in this thread:

https://forum.prusa3d.com/forum/general-discussion-announcements-and-releases/pause-print-g-code-ignored-during-print-on-prusa-mini/

With the workaround of using filament change instead of pause, I now get perfect results when I try to insert magnets or nuts mid-print.

Now I want to move over to using octoprint on a Raspberry Pi so I don't have to move the USB stick back and forth between my computer and my Prusa Mini, which is in another room.

The octoprint setup worked great right away. I am now trying to use octoprint's "@pause" dummy gcode. In PrusaSlicer I use the custom g-code at layer feature to insert @pause. That does pause the print, and I can resume it through octoprint's web UI.

The only problem is that the results are not as good as what I got with the USB stick route and the filament change command. With just the @pause command, the problem is that the hot nozzle stays in place and melts whatever area of the print it's at.

So now I am trying to add two G-code snippets in octoprint's "after pause" and "after resume" scripts. I found a starting point in octoprint's docs here:

    https://docs.octoprint.org/en/master/features/gcode_scripts.html#more-nifty-pause-and-resume

I pasted the code snippets below. The behavior is improved, the nozzle moves away from the print and to a location that lets me access the print area to insert things.

I have two problems:

1.) When the printer pauses and the nozzle moves up, it leaves behind a vertical strand of melted filament. I have to cut that off with a side-cutter. I thought the retraction for the E axis would prevent that.

2.) More importantly, when the print resumes, it seems that no filament is extruded. It just goes through the motions but no more filament is built up.

With the manual filament change method, I did not have either of these issues, so I know the printer is capable of cleanly pausing and resuming the print.

I tried various changes to the snippet, for example I tried to add a few mm more extrusion at resume than retraction at the pause (with a dwell and manual cleanup of the resulting gunk at the nozzle after the extrusion) to make sure the filament is really at the tip of the nozzle.

I tried to capture the issues in a video (sorry for the quality):

You can hopefully see that no filament is extruded when it resumes. Ignore the fact that it's a bit messy because I didn't clean the nozzle this time and cut off the extra vertical strand, I did that in other attempts and it made no difference. The main problem is that the nozzle doesn't seem to be extruding filament after the resume.

I wonder if anybody has experience with this and can help me come up with some g-code that does the right thing.

 

 

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

; retract filament, move Z slightly upwards
G1 Z+5 E-5 F4500

; absolute XYZE
M82
G90

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

and:

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

; prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500

; absolute E
M82

; absolute XYZ
G90

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

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

 

Napsal : 04/07/2020 8:39 pm
atomleef se líbí
atomleef
(@atomleef)
Estimable Member
RE: G-code snippets for pause/resume with octoprint?

Thanks for sharing, for beginner user as me I still quite not understand. I will try to understand it. 😄 

I also use swap color command, the nozzle is move away from the print some filament stuck to the nozzle and need to remove by hand as you said. Sorry for no solution yet just want to taking about problem. Good luck

Napsal : 07/07/2020 1:44 am
assist
(@assist)
Active Member
RE: G-code snippets for pause/resume with octoprint?

Thanks for sharing this code. It helps a lot.

It would be better if Prusa comes up with a codeless way of printing objects where we define an object using dimensions rather than the code.

Napsal : 07/07/2020 9:56 am
beboyle
(@beboyle)
New Member
RE: G-code snippets for pause/resume with octoprint?

Not sure if you ever got an answer but I suspect the reason  you are seeing no extrusion after resume is the use of the "M82" command to set absolute positioning on the extruder instead of "M83" for relative positioning which is what PrusaSlicer by default expects and requires. 

Napsal : 29/10/2020 5:15 am
örkelprint
(@orkelprint)
Eminent Member
RE: G-code snippets for pause/resume with octoprint?

Isn't the "change filament" routine the M600 command? At least thats the one that gets triggered from the filament sensor. So you could use this.

Napsal : 29/10/2020 7:52 am
PrusaTester2020
(@prusatester2020)
Estimable Member
RE: G-code snippets for pause/resume with octoprint?

I used the same code for Pause/Resume and the behavior is the same. Anyone solved the issue for the Prusa Mini?

Napsal : 02/01/2021 7:53 pm
örkelprint
(@orkelprint)
Eminent Member
RE: G-code snippets for pause/resume with octoprint?

Hey guys, I just did some research into this topic as well and got everything working now.

You have to set the extruder back to relative mode in the after pause gcode. Put an M83 in there and it should work.

I got the Prusa slicer M601 pause command to work as well.

- in Octoprint Printer/serial connection settings go to firmware/protocol settings and add M601 to pause command list

- Add your custom pause/resume gcode in octoprint. Don't forget M83 in resume gcode.

Using pause command from prusa slicer should now work.

 

Example gcode for octoprint in combination with prusa slicer and prusa mini:

After pause:

G91 ; relative coordinates
G1 F1200 Z20
G1 F4800 X50 Y50

Before resume:

G1 X-50 Y-50
G1 F1200 Z-20
G90 ; absolute coordinates
M83 ; relative Extruder
Napsal : 30/03/2021 5:15 pm
Livius, karl-herbert, foorschtbar a 1 lidem se líbí
tre4b
(@tre4b)
Eminent Member
Does yours resume heating

Does this resume heating too.  For some reason when the pause hits my machine stops heating the hot end.  It then tries to resume with the filament at about 120 degrees and surprise surprise fails to extrude!

Napsal : 03/08/2021 2:54 pm
örkelprint
(@orkelprint)
Eminent Member
Re: Heating

Are you sure there is no custom gcode somewhere? It should stay on the printing temperature.

Napsal : 03/08/2021 5:18 pm
tre4b
(@tre4b)
Eminent Member
found reason for temp drop

Yeah,  prusa bug by the look of it.  If I use @pause as custom GCode rather than the stock prusaslicer M601 then it all works fine and the head does not loose temperature.

 

Napsal : 05/08/2021 3:32 pm
k3im
 k3im
(@k3im)
New Member
same problem here

I have the same problem when adding a pause in PrusaSlicer. Funny enough it creates the same GCode as it did before:

GCode created in June (worked fine, temperature stayed or was adjusted before continuing print):

;PAUSE_PRINT
M117 Place magnets
M601

GCode created yesterday (print pauses, but prompt is not visible, after pressing "resume print" in the menu, the print continues without increasing temperature first, fails of course):

;PAUSE_PRINT
M117 Place
M601

I am printing from Octopi. Could that cause a problem due to some incompatibility? Will try today to print from SD card.

 

Posted by: @tre4b

Does this resume heating too.  For some reason when the pause hits my machine stops heating the hot end.  It then tries to resume with the filament at about 120 degrees and surprise surprise fails to extrude!

 

Napsal : 28/08/2021 9:10 am
Ty se líbí
k3im
 k3im
(@k3im)
New Member
Works just fine from SD card / known issue

Just printed the same GCode from SD card and everything worked just fine (when resuming the hotend heated up as it was supposed to before continuing the print).

For anybody else struggling with this: it seems to be a known issue and there is a workaround available that will do for me.

Napsal : 28/08/2021 11:43 am
F0erster a örkelprint se líbí
Share: