Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Last active October 30, 2023 19:10
Show Gist options
  • Save peteristhegreat/3191f124d09754c59d76cd31a68a4501 to your computer and use it in GitHub Desktop.
Save peteristhegreat/3191f124d09754c59d76cd31a68a4501 to your computer and use it in GitHub Desktop.
Resume print, gcode, run out of filament

Run out of Filament halfway thru a print...

This is a gcode snippet after some editing:

;FLAVOR:Repetier
;TIME:72843
;MINX:-84.923
;MINY:-120.182
;MINZ:0.3
;MAXX:89.004
;MAXY:109.561
;MAXZ:209.25
;MKSPREVIEWPROCESSED
; Postprocessed by [MKS WiFi plugin](https://github.com/Jeredian/mks-wifi-plugin)
; simage=0
; gimage=0

;Generated with Cura_SteamEngine 5.2.1
M82 ;absolute extrusion mode
G21 ; units to mm
G90 ; bas pos
M82 ; extruder to abs mode
M107 T0 ; fan off
M190 S70 ; wait for bed temp
M109 S215 T0 ; wait for extruder temp
; G28 ; move to origin (home)
G92 E0 ; set to position (extruder)
G0 E3 F200 ; move, extruder at feedrate
G92 E0 ;
G92 E1876.45723 ; set initial extruder amount

G0 F600 X-50.577 Y27.487 Z72  ; manual move

M107 ; fan off
G0 F600 X-50.577 Y27.487 Z69.45
G0 F7200 X-38.06 Y31.35

Correct Steps

Stop the current printing in the air.

Keep the build plate heated, so it doesn't delaminate while fixing the gcode.

Replace the empty filament spool, and extrude some filament.

Jog the printer down to the current height of the print

Note the z value for the last printed layer

Open the gcode for the file

Leave the first 24 or so lines. They look like this:

;FLAVOR:Repetier
;TIME:72843
;MINX:-84.923
;MINY:-120.182
;MINZ:0.3
;MAXX:89.004
;MAXY:109.561
;MAXZ:209.25
;MKSPREVIEWPROCESSED
; Postprocessed by [MKS WiFi plugin](https://github.com/Jeredian/mks-wifi-plugin)
; simage=0
; gimage=0

;Generated with Cura_SteamEngine 5.2.1
M82 ;absolute extrusion mode
G21 ; units to mm
G90 ; bas pos
M82 ; extruder to abs mode
M107 T0 ; fan off
M190 S70 ; wait for bed temp
M109 S215 T0 ; wait for extruder temp
G28 ; move to origin (home)
G92 E0 ; set to position (extruder)
G0 E3 F200 ; move, extruder at feedrate
G92 E0 ;

Trim out Lines that start with

; LAYER 0
G0 F600 X-50.577 Y27.487 Z0
; ...
G0 F600 X-50.577 Y27.487 ZXXX

until you find the line that mentions zXXX where XXX is the height you jogged to earlier.

Consider going a layer higher than the jogged position.

Do a call to set the absolute extruder position before the first G0 or G1 line

G92 E0 ;
G92 E1876.45723 ; set initial extruder amount, do this on the line after G92 E0 ;

If you omit this step you will extrude for several minutes while waiting for the print to go, and make a spagetti mess.

Alternatives

Sit nearby and when you hear the spool run out, pause the print.

Install a filament runout sensor and feed into that before the extruder motor.
Note that you should have an active heating drybox inline before this, and let it move in a flexible way otherwise you will snap your filament.

G Code Reference

https://reprap.org/wiki/G-code

How to resume on a Tenlog Hands 2 printer

The top of the file initially looks like:

;BUNCH OF COMMENTS...
;Generated with Cura_SteamEngine 5.5.0-beta.1
T1
M140 S75
M105
M190 S75
M104 S215
M105
M109 S215
M82 ;absolute extrusion mode
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 ;Move to min endstops
G1 Z15.0 F9000 ;move the platform down 15mm
M117 Printing...
G92 E0
G92 E0
G1 F3600 E-6.5
;LAYER_COUNT:664
;LAYER:0
M117 INDICATOR-Layer0
M107
G0 F1800 X69.607 Y117.442 Z0.3
;TYPE:SKIRT
G1 F3600 E0
  1. Stop it from zeroing out the z axis at the start.
  2. Use G92 to set the current z value you want.
  3. Use G28XY to zero out the x and y positions.
  4. Use G92 to set the initial extruder position so you don't watch it make spagetti for an hour.
;G28 ;Move to min endstops
;G1 Z15.0 F9000 ;move the platform down 15mm
G92 Z60.3
G28XY
M117 Printing...
G92 E0
G92 E4122.61519 Z60.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment