Notes »

Filament Swap Failure

How To: Recover from a failed filament change

A few days ago I was printing more of the Japanese family crests with the filament swaps to create different layers with different colored filament. I didn't notice that the filament didn't feed through the extruder stepper at a filament swap step until it was too late, and the printer was printing air over the base layer!

In order to save the base layer and restart the print at the color swap procedure I edited the gcode file which wasn't as easy as I thought it would be, but found success. First thing I did was look up the gcode for filament swap (M600) and find where the swap locations were, there were 2 swaps so I basically knew I had to delete all the printing code up to that 2nd swap and make sure the printer head didn't "home" on z-axis (which would smash the print head into the base that was already on the bed).

GCode files can be extremely large which is a problem for text editors that load the whole file into memory. That's why I ended up using sed to edit the gcode file after finding the line numbers I needed to remove with vim. I specifically used: sed '247,32732d' crest2.gcode which translates to: Stream edit lines 247 to 32732 with operation delete on file crest2.gcode. After I did that, I found the commands that moved the printer head down to 0.2 on the z-axis in the initialization code (above line 247) and deleted them. This is what I was most worried about, leaving a homing command gcode that I wouldn't recognize and have the head ram the base print.

TL;DR:

  1. Find the M600 command that had the filament fail to feed
  2. Delete gcode between the initialization gcode and the M600 gcode
  3. In the init gcode find move commands (g1, g0) in the z axis that move the print head down near 0 -- AND DELETE!
  4. Hope you didn't forget anything, load the gcode onto the printer and have it print!

edit SideBar

Page last modified on April 25, 2021, at 04:42 pm

^