[SOLVED] GCode for Filament swap - M600

Hi, I am using Smoothieware, and Prusa Slicer. I want to use the Slicer’s ability to pause and change different filaments in same print (like this one which I did without pausing the print, manually cutting and feeding new filament)

Prusa Slicer has the ability to add multiple filament changes based on layers which basically adds M600 at those stages. Unfortunately I don’t have a LCD panel, so I can’t actually pull and inset the filament without Gcode, I am trying to get that done via following gcode.

However after the first 75mm extrusion (in same spot more like a glob) print head moves to previous position, and suddenly it reverses the extruder, and it kinda ejects the newly inserted filament. Can someone please help me troubleshoot the gcode?

;start of the file
; Filament gcode
G21 ; set units to millimeters
G90 ; use absolute coordinates
M82 ; use absolute distances for extrusion
G92 E0
;LAYER:0
G1 Z0.350 F7800.000
;Starting 0 z:0.35
G1 E-2.00000 F2400.00000
G92 E0
G1 X69.149 Y60.586 F7800.000
G1 E2.00000 F2400.00000

;;;;;;after many layers

echo Filament Change

G28 X0 Y0           			; Home X and Y
G91 | G1 Z10 F100 | G90 		; lift head by 10mm
G91 | G1 E-2 F400 | G90			; retract a bit to stop oozing
G92 E0 

M107 							;turn off part cooler
M400                			; Wait for command buffer to clear
M600							; pause, will be resumed by M601

echo heating up again
M104 S230 						; start heating again
M109 S230 						; Wait for Extruder Temp to Stabilise
G1 E-40		 					; take out the old filament
G92 E0 
M400                			; Wait for command buffer to clear
M600							; pause, will be resumed by M601

echo make sure to insert filament
M109 S230 						; Wait for Extruder Temp to Stabilise
G1 E75 		 					; take in new filament
G92 E0 							;Reset Extruder Origin
G28 X0 Y0
G4S30 ; wait 30 sec to finish all the cleanup
G91 | G1 Z-10 F100 | G90 ;comeback to old z height
echo Resuming print

;;;;;;;remaining gcode, first G1 E is ejecting the filament
G1 E4.21150 F2400.00000
G92 E0
G1 X94.357 Y92.140 F7800.000
G1 E2.00000 F2400.00000
G1 F900
G1 X94.357 Y94.357 E2.06122

Hey.

Sounds like you are in absolute and want to be in relative or vice-versa. Try inverting G90/G91 or removing one of the two altogether from your E lines.

Cheers.

1 Like

You were right… I ended up removing all G90/G91 for the extruder, (so leaving it in same mode) and it finally worked… I am getting consistent filament swaps now…

echo Filament Change
M104 S100                       ; start cooldown
G1 X160 Y20                     ; go to corner
M42|G4P1000|M43|G4P200|M42|G4P500|M43|G4P200|M42|G4P1000|M43;
G91 | G1 Z10 F100 | G90         ; lift head by 10mm
M109 S100                       ; Wait for Extruder to cooldown
G1 E-40 F2400                   ; take out the old filament, cold pull
M42|G4P1500|M43;
M400                            ; Wait for command buffer to clear
M600                            ; pause, will be resumed by M601
;;;;;;;;;;press M601;;;;;;;;;;;;;
echo make sure to insert filament
M42|G4P500|M43|G4P200|M42|G4P200|M43|G4P200|M42|G4P500|M43;
M109 S230                       ; Wait for Extruder Temp to Stabilize
M42|G4P750|M43|G4P500|M42|G4P750|M43;
G1 E40 F100                     ; take in new filament
G10 | G4S1 | G10                ; retract twice to stop oozing
G28 X0 Y0
G92 E0                          ;reset extruded length
G4S10 ; wait to finish all the cleanup
G91 | G1 Z-10 F100 | G90 ;comeback to old z height
echo Resuming print
2 Likes