Cold Pull G-code (for us lazy bastards)

Here’s a Cold Pull G-code I tried out today. I ran it many times, it didn’t fail a single time. This version doesn’t retract the blob back to the AMS, I ran it with the tubing disconnected from the toolhead.

; Cold pull G-code for Bambu, the Raz, v2024-02-16
; Some observations from the X1C:
; 35 mm from top of toolhead to the extruder gears.
; 50 mm from cutter to nozzle tip.
; 1 mm of filament is 2.41 mm³.
; One push of extrude button is 5 mm (12 mm³).
; 11 pushes (55 mm, 132 mm³) from empty hotend to
; extruding from nozzle.  You get about 85 mm of
; thinned filament up/out with the cold pull.
; Original in Prusa forum with following credits:
; use at your own risk.
; modified by C. Rajek
; ESUN Cleaning filament: Heat to 255, cool to 95.
; ABS: Heat to 255, cool to 170.
; PLA: Heat to 255, cool to 90.
; PA:  Heat to 240, cool to 140.

M1002 gcode_claim_action : 14 ; "Cleaning nozzle tip"

G28 X Y        ; Home XY
G91            ; Relative positioning
G0 Z10         ; Lower bed a little
G90            ; Absolute positioning
M83            ; ...but extruder relative
G0 X128 Y128   ; Position toolhead in the center
M302 S70 P1    ; Allow cold extrusion

M1002 gcode_claim_action : 7 ; "Heating hotend"
M109 S255      ; Heat/wait until 255°C reached
M1002 gcode_claim_action : 14 ; "Cleaning nozzle tip"

G1 E50 F100    ; Extrude 50 mm to fill the nozzle
M106 P1 S255   ; 100% part fan to cool faster
M106 P2 S255   ; 100% aux fan as well
M109 S190      ; Cool/wait to 190°C
G1 E10 F100    ; Extrude another 10 mm in case some oozed out
M109 S70       ; Cool/wait to 70°C
M106 P1 S0     ; Turn off part fan
M106 P2 S0     ; Turn off aux fan

G1 E-200 F1800 ; Retract 20 mm at max. speed (user should pull too)

M104 S0        ; Turn hotend off

M1002 gcode_claim_action : 0 ; Clear message

M84            ; disable steppers - done!

Save this to a file, eg. “Cold_Pull.gcode” and put it in the root directory of the SD card. This way it will always be available for “printing” from the touch screen (I keep a copy of hotbed_tramming.gcode there as well).

It’s easy enough to do this manually but given this seems reliable, I’ll be using it. I assume this would work on P1/A1 series as well but I only tested on X1C.

Decreased retraction speed to F1800 (30 mm/s) which is the spec. max. speed for X1C.
Added XY homing for good measure.
Lowered cold temperature to 70°C for better strength of pull.