Skip to content

Instantly share code, notes, and snippets.

@brandon3055
Last active January 6, 2024 11:46
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandon3055/f5297f191fa576d2228e700ac6857abc to your computer and use it in GitHub Desktop.
Save brandon3055/f5297f191fa576d2228e700ac6857abc to your computer and use it in GitHub Desktop.
# In order to use this you need to increase max_extrude_cross_section in your extruder config or klipper will complain. I set mine to 30
[gcode_macro PURGE_BLOB]
gcode:
# This is for a 300mm bed. If you have a diferent bed size you may want to adjust the line below
{% set rand_pos = (105 + ( printer.system_stats.cputime * 1000 ) % 60) %} ; Generate pseudo random start pos so we dont wear out that one spot on the bed.
M117 Purging at X{ rand_pos }
# The start pos will be within the "handle" of the flex plate where there is some extra Y space available so we can go all the way to Y0
# If your setup does not have this extra space then just increase the y valie in the line "G1 X{ rand_pos } Y0 Z1 F18000"
G92 E0 ; zero the extruder
G90 ; absolute positioning
G1 X{ rand_pos } Y0 Z1 F18000 ; Go to start pos for perge line
G1 Z0.4 F600 ; Lower to purge height
G91 ; relative positioning
G1 X5 E40 F40 ; Extrude blob of filament on the bed
M106 P0 ; Enable Cooling Fan
G1 X20 Z5 F100 ; Slow drag away from the blob with fans helping cool and break strings. Also raiz z zo the blob clears the fan duct
G1 X5 Z-5.1 F9000 ; Now that the blob has cleared the duct we go back down for a short 0.3mm height extrusion
G1 X5 E2 F180 ; Slow 5mm extrude move to help with stringing
G1 X30 E-1 F6000 ; Fast move and retract to break strings and reduce ooze
G1 Z1 F100 ; Lift
M106 P0 S0 ; Disable Cooling Fan
G92 E0 ; zero the extruder
G90 ; absolute positioning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment