Change Filament Mid Print

Something interesting happened during my printing session. While I was in the middle of printing something, it unexpectedly paused. I suspect the slicer added the pause feature because I had just sliced the calibration cube with a pause. It was odd because the calibration cube didn't pause at all, but this print did. Anyway, once I resumed the print, everything went smoothly and the extruder actually extruded filament. I didn't do a change, but in my testing, clicking pause on OctoPrint and not changing the filament and unpausing, didn't extrude filament so that was a surprise!

Regarding my terminal experiment, I wanted to note that when I executed M600, nothing happened maybe that was because I didn't have a print job running?

Recv:  T:48.94 /0.00 B:43.99 /0.00 @:0 B@:0
Recv:  T:48.83 /0.00 B:43.85 /0.00 @:0 B@:0
Recv:  T:48.64 /0.00 B:43.76 /0.00 @:0 B@:0
Send: M600
Recv: ok
Recv:  T:48.38 /0.00 B:43.57 /0.00 @:0 B@:0
Recv:  T:48.34 /0.00 B:43.69 /0.00 @:0 B@:0
Recv:  T:48.12 /0.00 B:43.51 /0.00 @:0 B@:0
Recv:  T:47.85 /0.00 B:43.37 /0.00 @:0 B@:0
Recv:  T:47.76 /0.00 B:43.28 /0.00 @:0 B@:0
Recv:  T:47.59 /0.00 B:43.30 /0.00 @:0 B@:0
Recv:  T:47.41 /0.00 B:43.24 /0.00 @:0 B@:0
Recv:  T:47.32 /0.00 B:43.22 /0.00 @:0 B@:0
Recv:  T:47.15 /0.00 B:43.18 /0.00 @:0 B@:0
Recv:  T:46.99 /0.00 B:43.08 /0.00 @:0 B@:0
Recv:  T:46.81 /0.00 B:42.99 /0.00 @:0 B@:0
Recv:  T:46.73 /0.00 B:42.92 /0.00 @:0 B@:0
Recv:  T:46.50 /0.00 B:42.89 /0.00 @:0 B@:0
Recv:  T:46.40 /0.00 B:42.86 /0.00 @:0 B@:0
Recv:  T:46.25 /0.00 B:42.83 /0.00 @:0 B@:0
Recv:  T:46.21 /0.00 B:42.65 /0.00 @:0 B@:0
Recv:  T:46.00 /0.00 B:42.62 /0.00 @:0 B@:0
Recv:  T:45.79 /0.00 B:42.50 /0.00 @:0 B@:0
Recv:  T:45.70 /0.00 B:42.37 /0.00 @:0 B@:0
Recv:  T:45.53 /0.00 B:42.32 /0.00 @:0 B@:0
Send: M115
Recv: FIRMWARE_NAME:Marlin 2.1.1 (Feb 10 2023 14:55:52) SOURCE_CODE_URL:github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:3D Printer EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff
Recv: Cap:SERIAL_XON_XOFF:0
Recv: Cap:BINARY_FILE_TRANSFER:0
Recv: Cap:EEPROM:1
Recv: Cap:VOLUMETRIC:1
Recv: Cap:AUTOREPORT_POS:0
Recv: Cap:AUTOREPORT_TEMP:1
Recv: Cap:PROGRESS:0
Recv: Cap:PRINT_JOB:1
Recv: Cap:AUTOLEVEL:1
Recv: Cap:RUNOUT:1
Recv: Cap:Z_PROBE:1
Recv: Cap:LEVELING_DATA:1
Recv: Cap:BUILD_PERCENT:0
Recv: Cap:SOFTWARE_POWER:0
Recv: Cap:TOGGLE_LIGHTS:1
Recv: Cap:CASE_LIGHT_BRIGHTNESS:1
Recv: Cap:EMERGENCY_PARSER:0
Recv: Cap:HOST_ACTION_COMMANDS:1
Recv: Cap:PROMPT_SUPPORT:1
Recv: Cap:SDCARD:1
Recv: Cap:MULTI_VOLUME:0
Recv: Cap:REPEAT:0
Recv: Cap:SD_WRITE:1
Recv: Cap:AUTOREPORT_SD_STATUS:0
Recv: Cap:LONG_FILENAME:1
Recv: Cap:LFN_WRITE:0
Recv: Cap:CUSTOM_FIRMWARE_UPLOAD:0
Recv: Cap:EXTENDED_M20:1
Recv: Cap:THERMAL_PROTECTION:1
Recv: Cap:MOTION_MODES:0
Recv: Cap:ARCS:1
Recv: Cap:BABYSTEPPING:1
Recv: Cap:CHAMBER_TEMPERATURE:0
Recv: Cap:COOLER_TEMPERATURE:0
Recv: Cap:MEATPACK:0
Recv: Cap:CONFIG_EXPORT:0
Recv: ok
Send: M155 S2
Recv: ok
Send: M876 P1
Recv: echo:M113 S2
Recv: ok
Recv:  T:45.31 /0.00 B:42.25 /0.00 @:0 B@:0
Recv:  T:45.22 /0.00 B:42.22 /0.00 @:0 B@:0
Recv:  T:45.13 /0.00 B:42.10 /0.00 @:0 B@:0
Recv:  T:44.98 /0.00 B:42.01 /0.00 @:0 B@:0
Recv:  T:44.79 /0.00 B:41.99 /0.00 @:0 B@:0

Update: it paused on the other print because I have OctoEverywhere installed and it thought it was a print failure.

You should not need a print job running but you do need to prepare the extruder to actually extrude filament.

I see the M115 and the M600 but I don't see the G28, M104, M140 (not really needed), or the G0 X140 Y140 Z20 (i.e. move the extruder somewhere over and away from the bed). Without some heat in the nozzle, Marlin may be smart enough to know that you can't extrude filament.

I just powered up my TAZ 6 and immediately entered an M600. My version of Marlin automagically did a G28 and heated the nozzle before the repositioning and filament removal, etc.

This leads me to believe that M600 on your printer isn't implemented (but why it answers with just a "Recv: ok" is a mystery to me. My TAZ 6 responds to unknown commands with:

Send: G83
Recv: echo:Unknown command: "G83"
Recv: ok P15 B3

In conclusion, we are back to the drawing board. Replace the pause and resume scripts with the corrected versions and insert an @pause instead of an M600. Run your print job with the serial log enabled and upload a bundle so we can see the results.

I would contact ELEGOO support and ask why the M600 command doesn't work. I found this question and answer on this page (scroll down to " Customer questions & answers")

How do I pause the printer midway through printing to change the filament color?
Trracie Wagner
Dec 28, 2024
ELEGOO US
Hi, thanks for your contact. You can use the M600 command. If you need any support, please contact us at 3dp@elegoo.com. Best regards
ELEGOO US
Dec 30, 2024
Shop owner

So you want me to do the following:
Put the correct G-Code scripts in the before pause and after resume section.
Start a print job.
When it's about halfway through, put @pause in the terminal and see if it pauses.
Upload a system info bundle as well as serial.log
Contact ELEGOO support on why it's not pausing at the M600 command.
Do I have to do this when I think it's an OctoPrint issue, and not a printer / ELEGOO issue, because if I print directly from my printer, it pauses it's only when I print from OctoPrint that it ignores the pause.

This may be a long shot, but do you think I should add M600 to Pausing commands?

We have discussed multiple ways to pause a print for a filament change. Pressing the OctoPrint "pause" button is the least desirable option because it may interrupt the gcode stream at a bad place. The preferred option is to edit the gcode file to insert a command at a good place (usually at a layer change).

We have discussed multiple options for commands to insert into the gcode. The Marlin command M600 and the OctoPrint command @pause. If the M600 command is used, the OctoPrint pause and resume scripts should be blank. If the @pause command is used, then the OctoPrint pause and resume scripts need to provide the necessary nozzle and filament movements as well as maintain the original gcode absolute and relative settings for X, Y, Z, and E.

I believe ELEGOO responded to the "how do I pause for a filament change" with "use the M600 command". Your attempts at doing so were unsuccessful. IMO, this should be addresssed with ELEGOO support. If you would prefer not to do so that is your call.

That leaves us with the option to insert an @pause command into the gcode file and use corrected pause and resume scripts in OctoPrint. I do not believe we can properly troubleshoot random presses of the "pause" button or random terminal input.

These are the steps I think are needed to troubleshoot this issue:

  1. Edit the OctoPrint pause and resume scripts and upload them here.
  2. Use your slicer to create a gcode file from a small object like a 5x5x5mm cube.
  3. Edit the gcode file to insert a @pause command at an early layer change, 1mm to 2mm in height.
  4. Upload the edited gcode file.
  5. Enable serial logging in OctoPrint.
  6. Load and print the edited gcode file.
  7. Report the outcome and upload a systeminfo bundle.

At this point, we can examine the uploaded files and bundle contents and make any recommendations.

Ok, I resliced the 5x5 calibration cube and edited the gcode, and added the @pause at the 2.5mm mark.
I put the g-code scripts that you recommended in the After Pause and Before Resume, but when I swapped filaments and resumed, it unfortunately didn't extrude.
System info bundle:
octoprint-systeminfo-20250409180318.zip (747.8 KB)
G-Code File:
CaliCube5x5.gcode (78.8 KB)
After Pause:

; (optional) disable stepper inactivity timeout - uncomment if you printer disables steppers during pause and supports this command
;M18 S0

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

Before Resume:

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

It's also retracting way too quickly, it makes this grinding noise when retracting.

I think I know the issue. You're switching to absolute extrusion, but looking at the gcode it appears to be doing relative extrusion and resetting to 0 every layer change or something.

;LAYER:0
G90
G21
M83 ; use relative distances for extrusion
...
;BEFORE_LAYER_CHANGE
;0.3
G92 E0

I would take out the M82 commands I think.

Because if you look at the extruder numbers being sent, they are real small.

G1 X116.714 Y116.714 E.17709
G1 X113.286 Y116.714 E.17709
G1 X113.286 Y113.286 E.17709
G1 X116.674 Y113.286 E.17503
1 Like

@jneilliii beat me to it...

Before Pause: coordinates absolute (G90), extruder relative (M83)
After Pause script: coordinates absolute (G90), extruder absolute (M82)
After Resume script: coordinates absolute (G90), extruder absolute (M82)

In the resume script, please remove:

; absolute E
M82

You could also remove the M82 from the pause script.

couple of unknown commands in the serial log. Apparently your firmware knows nothing of these.

M486 (cancel objects)
M73 (print progress)

Makes me wonder if there is a firmware update that the print profile has settings for but the printer doesn't understand...or just bad print profiles in general in their forked Orca.

Sorry, no dice. Still no extrusion. I also think it retracts way too much. 10mm, that's a lot! Also, there is an E5, and 5mm of filament didn't come out. I also think it retracts too quickly for my printer as there is a grinding noise. I just still don't quite understand why it still doesn't extrude anything even after removing the G82 commands from the pause and resume scripts.
If it helps, here are my updated g-code scripts for Pause / Resume:

Pause:

; (optional) disable stepper inactivity timeout - uncomment if your printer disables steppers during pause and supports this command
;M18 S0

{% 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
G90

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

Resume:

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

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

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

Ok, I went back and looked at serial.log and see some other things related to your pause script. Let's break down what's happening from that last system info bundle.

  1. get the position when pause was initiated.
2025-04-09 17:59:16,169 - Send: N887 M114*32
2025-04-09 17:59:16,220 - Recv: X:113.35 Y:113.95 Z:2.30 E:-1.50 Count X:9068 Y:9116 Z:929
2025-04-09 17:59:16,363 - Recv: ok
  1. initiate relative movement on all axes
2025-04-09 17:59:16,378 - Send: N888 G91*25
2025-04-09 17:59:16,392 - Recv: ok
  1. Set extruder to relative mode
2025-04-09 17:59:16,394 - Send: N889 M83*17
2025-04-09 17:59:16,430 - Recv: ok
  1. move z up and retract 5mm at 4500 mm/min
2025-04-09 17:59:16,433 - Send: N890 G1 Z+5 E-5 F4500*87
2025-04-09 17:59:16,489 - Recv: ok
  1. Set extruder to absolute mode (this was removed for last test)
2025-04-09 17:59:16,491 - Send: N891 M82*25
2025-04-09 17:59:16,528 - Recv: ok
  1. Set to Absolute Positioning
2025-04-09 17:59:16,535 - Send: N892 G90*19
2025-04-09 17:59:16,545 - Recv: ok
  1. move nozzle to front left corner of bed
2025-04-09 17:59:16,558 - Send: N893 G1 X0 Y0*43
2025-04-09 17:59:18,318 - Recv: ok
  1. octoprint recognizes pause here
2025-04-09 17:59:18,320 - Changing monitoring state from "Pausing" to "Paused"
  1. Set to Relative Positioning
2025-04-09 17:59:40,050 - Send: G91
2025-04-09 17:59:40,085 - Recv: ok
  1. Set extruder to relative mode
2025-04-09 17:59:40,091 - Send: M83
2025-04-09 17:59:40,121 - Recv: ok
  1. retract 100mm at 300 mm/min
2025-04-09 17:59:40,132 - Send: G1 E-100 F300
2025-04-09 17:59:40,155 - Recv: ok
  1. Set extruder to absolute mode
2025-04-09 17:59:40,167 - Send: M82
2025-04-09 17:59:40,216 - Recv: ok
  1. Set to Absolute Positioning
2025-04-09 17:59:40,218 - Send: G90
2025-04-09 17:59:40,261 - Recv: ok
  1. Set to Relative Positioning, Set extruder to relative mode, extrude 100mm at 300 mm/min, Set extruder to absolute mode, Set to Absolute Positioning
2025-04-09 18:01:54,309 - Send: G91
2025-04-09 18:01:54,345 - Recv: ok
2025-04-09 18:01:54,347 - Send: M83
2025-04-09 18:01:54,357 - Recv: ok
2025-04-09 18:01:54,368 - Send: G1 E100 F300
2025-04-09 18:01:54,384 - Recv: ok
2025-04-09 18:01:54,392 - Send: M82
2025-04-09 18:01:54,404 - Recv: ok
2025-04-09 18:01:54,416 - Send: G90
2025-04-09 18:01:54,440 - Recv: ok
  1. Set to Relative Positioning, Set extruder to relative mode, extrude 20mm at 300 mm/min, Set extruder to absolute mode, Set to Absolute Positioning
2025-04-09 18:02:27,518 - Send: G91
2025-04-09 18:02:27,535 - Recv: ok
2025-04-09 18:02:27,548 - Send: M83
2025-04-09 18:02:27,561 - Recv: ok
2025-04-09 18:02:27,572 - Send: G1 E20 F300
2025-04-09 18:02:27,625 - Recv: ok
2025-04-09 18:02:27,632 - Send: M82
2025-04-09 18:02:27,657 - Recv: ok
2025-04-09 18:02:27,664 - Send: G90
2025-04-09 18:02:27,706 - Recv: ok
  1. Set extruder to relative mode, retract 5mm at 4500 mm/min, extrude 5mm at 4500 mm/min, extrude another 5mm at 4500 mm/min, Set extruder to absolute mode, Set to Absolute Positioning. (I think this is where the grinding is because of trying to extrude too fast).
2025-04-09 18:02:40,451 - Changing monitoring state from "Paused" to "Resuming"
2025-04-09 18:02:40,657 - Send: N894 M83*29
2025-04-09 18:02:40,687 - Recv: ok
2025-04-09 18:02:40,698 - Send: N895 G1 E-5 F4500*54
2025-04-09 18:02:40,722 - Recv: ok
2025-04-09 18:02:40,733 - Send: N896 G1 E5 F4500*24
2025-04-09 18:02:40,764 - Recv: ok
2025-04-09 18:02:40,789 - Send: N897 G1 E5 F4500*25
2025-04-09 18:02:40,852 - Recv: ok
2025-04-09 18:02:40,877 - Send: N898 M82*16
2025-04-09 18:02:40,917 - Recv: ok
2025-04-09 18:02:40,930 - Send: N899 G90*24
2025-04-09 18:02:40,952 - Recv: ok
  1. reset extruder position to -1.50
2025-04-09 18:02:40,955 - Send: N900 G92 E-1.5*121
2025-04-09 18:02:41,003 - Recv: X:0.00 Y:0.00 Z:7.30 E:-1.50 Count X:0 Y:0 Z:2917
2025-04-09 18:02:41,011 - Recv: ok
  1. move to position on print where we left
2025-04-09 18:02:41,048 - Send: N901 G1 X113.35 Y113.95 Z2.3 F4500*25
2025-04-09 18:02:42,346 - Recv: ok
  1. set feedrate to 12000mm/min (this could be grinding related too, seems fast)
2025-04-09 18:02:42,354 - Send: N902 G1 F12000.0*104
2025-04-09 18:02:42,433 - Recv: ok
  1. resume script complete, printing resumes.
2025-04-09 18:02:42,436 - Changing monitoring state from "Resuming" to "Printing"

How would I slow down the retraction, eliminate the grinding, and adjust the feed rate to better accommodate my printer? Additionally, I want to ensure that it's it can extrude after resume. Sorry for all these requests, it's just getting frustrating on how I can't do a simple pause and have it resume properly, and extrude.

System info bundle (if it helps, updated version):
octoprint-systeminfo-20250410074025.zip (880.0 KB)

I examined the gcode around the @pause command (included below for reference).

Before the @pause, the E value is set to 0 and 1.5mm of filament is retracted, most at F1800 and the last little bit at F12000.

After the @pause, 1.5mm of filament is extruded at F1800 and then the next layer starts at F600.

Based on this I'd change all the F4500 in the scripts to F1800.

Only a couple of commands are executed with F12000 so I don't think that is a problem because the same commands are executed at that speed at every layer change.

From @jneilliii's analysis of the serial log, there is a retract E-100 at F300 and an extrude of E100 and then E20 between the pause and resume scripts. The resume script adds another E5, sets the E value to -1.5 so after another E1.5 is extruded after the resume script ends the E value has returned to 0 and the next layer starts.

Assuming the E-100 is enough to remove the filament from the extruder, E126.5 should be enough to leave some excess filament in a pile at X0 Y0.

If there is no pile of filament at X0 Y0, then something else is going wrong. Has the nozzle temperature changed?

;BEFORE_LAYER_CHANGE
;2.5
G92 E0

G1 E-1.34975 F1800
;WIPE_START
G1 F12000
G1 X113.36 Y113.36 E-.06135
G1 X113.347 Y113.953 E-.0889
;WIPE_END
M486 S-1
;LAYER:12

;_SET_FAN_SPEED_CHANGING_LAYER
;PAUSE_PRINT
@pause

M486 S0
;G17
G3 Z2.9 I.284 J1.183
G1 X116.898 Y113.102 Z2.9
M73 P50 R1
G1 Z2.5
G1 E1.5 F1800
;TYPE:Inner wall
;WIDTH:0.45
G1 F600
G1 X116.898 Y116.898 E.12214

What do you mean by this? Should I consider adding E126.5 to my resume script? If so, I would appreciate your guidance on where to include it. I have made the changes from F3500 to F1800 and am curious about the next steps. Thank you!

Sorry, I should have said E-100, E100, E20, E-5, E5, E5, E1.5 for a total of -100, +126.5. These are the filament movements involved in the pause and resume sequence. Since the end result is 26.5mm of filament extruded, this should be left on the bed at X0 Y0.

All you need to do is change all occurrences of F4500 to F1800 in your pause and resume scripts and run the experiment again, report the results, and upload another bundle.

If it fails again, a screenshot of the OctoPrint temperature tab might be useful.

A video of the process might also be useful so we can see (and hear) the grinding noise.

I don't think you can upload videos here but you can upload them to Youtube or any other media site and put a link here. Make sure you allow anyone with the link to view the video.

Here's a novel idea, let's simplify the commands...remove all changes to relative/absolute positioning of the extruder, remove all speed parameters from commands so as not to change the defaults being used by the print itself.

pause gcode script

; (optional) disable stepper inactivity timeout - uncomment if your printer disables steppers during pause and supports this command
;M18 S0

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

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

; absolute XYZ
G90

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

resume gcode script

{% if pause_position.x is not none %}
G92 0

; prime nozzle
G1 E-5
G1 E5
G1 E5

; absolute XYZ
G90

; reset E
G92 0

; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }}


{% endif %}

and wouldn't be a bad idea to attempt this running OctoPrint in safe mode, because no telling what your plugins like OctoEverywhere are adding to this issue.

I agree with the safe mode but I worry about removing all the speed settings as in this case, the speed going into the scripts is F12000.