# M600 command, how to purge?

**URL:** <https://klipper.discourse.group/t/m600-command-how-to-purge/6519>\
**Category:** General Discussion\
**Created:** [February 8, 2023, 6:47pm UTC](https://klipper.discourse.group/t/m600-command-how-to-purge/6519 "2023-02-08T18:47:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Hundsbuah](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hundsbuah](https://klipper.discourse.group/u/Hundsbuah)\
**Post date:** [February 14, 2023, 1:55pm UTC](https://klipper.discourse.group/t/m600-command-how-to-purge/6519/2 "2023-02-14T13:55:10Z")

</div>

I do it with the LOAD\_FILAMENT and UNLOAD\_FILAMENT macro ( for the filament ) and the klipper pause/resume macro:

M600, PAUSE, RESUME, CANCLE macros: ( M600 is at the end )

```auto
[pause_resume]
recover_velocity: 700

[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
variable_park: True
gcode:
  ## Move head and retract only if not already in the pause state and park set to true
  {% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
    _TOOLHEAD_PARK_PAUSE_CANCEL
  {% endif %}
  TURN_OFF_HEATERS
  CANCEL_PRINT_BASE

[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
  PAUSE_BASE
  _TOOLHEAD_PARK_PAUSE_CANCEL

[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
  ##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
  {% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
  #### get VELOCITY parameter if specified ####
  {% if 'VELOCITY' in params|upper %}
    {% set get_params = ('VELOCITY=' + params.VELOCITY) %}
  {%else %}
    {% set get_params = "" %}
  {% endif %}
  ##### end of definitions #####
  {% if printer.extruder.can_extrude|lower == 'true' %}
    M83
    G1 E{extrude} F2100
    {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
  {% else %}
    {action_respond_info("Extruder not hot enough")}
  {% endif %}  
  RESUME_BASE {get_params}

[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:
  ##### set park positon for x and y #####
  # default is your max posion from your printer.cfg
  {% set x_park = printer.toolhead.axis_minimum.x|float %}
  {% set y_park = printer.toolhead.axis_maximum.y|float %}
  {% set z_park_delta = 10.0 %}
  ##### calculate save lift position #####
  {% set max_z = printer.toolhead.axis_maximum.z|float %}
  {% set act_z = printer.toolhead.position.z|float %}
  {% if act_z < (max_z - z_park_delta) %}
    {% set z_safe = z_park_delta %}
  {% else %}
    {% set z_safe = max_z - act_z %}
  {% endif %}
  ##### end of definitions #####
  {% if printer.extruder.can_extrude|lower == 'true' %}
    M83
    G1 E-{extrude} F2100
    {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
  {% else %}
    {action_respond_info("Extruder not hot enough")}
  {% endif %}
  {% if "xyz" in printer.toolhead.homed_axes %}
    G91
    G1 Z{z_safe} F900
    G90
    G1 X{x_park} Y{y_park} F6000
    {% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
  {% else %}
    {action_respond_info("Printer not homed")}
  {% endif %}

[gcode_macro M600]
gcode:
    PAUSE

```

LOAD and UNLOAD macro:

```auto
[gcode_macro UNLOAD_FILAMENT]
gcode:
  M117 Filament wird ausgeworfen
  G91
  G92 E0
  G1 E15 F240
  G92 E0
  G1 E-10 F2100
  G92 E0
  G1 E-25 F1800
  G92 E0
  G1 E-10 F900
  G90

[gcode_macro LOAD_FILAMENT]
gcode:
  M117 Filament wird geladen
  G91
  G92 E0
  G1 E75 F120
  G92 E0
  G90

```

Settings in CURA:

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/8/8592143a2fe37dace525415eeff6ae232a1689be.png)

When the prints pauses at the specific height ( your M600 command ) you can use the macro UNLOAD\_FILAMENT or LOAD\_FILAMENT at the mainsail browser interface ( or purge / retract via the extruder control panel )  
 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/f/f4057e1d3ac9941ffe65211263c5fc96d65b0e5d.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/7/7557a71bc65d5b81ff5d8d922e76fa73891ea4b9.png)

or via klipperscreen: actions → extrude → unload / load ( to get unload and load work in klipperscreen you need the exact macro naming: LOAD\_FILAMENT and UNLOAD\_FILAMENT in your klipper config )

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/d/d8c179001e0240f7088dd01eeb6ac7b7f67f78a9.jpeg)

you can also purge additional filament via extrude or retract at the klipperscreen actions → extrude screen

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/6/67d140f48cbf041230de2dcd6d89e49848f51064.jpeg)

/edit: change the toolhead position to your needs where it should park the toolhead at PAUSE ( in the  
\_TOOLHEAD\_PARK\_PAUSE\_CANCEL macro )

```auto
  {% set x_park = printer.toolhead.axis_minimum.x|float %}
  {% set y_park = printer.toolhead.axis_maximum.y|float %}

```

you can also change how fast the toolhead should return to the print to minimize oozing:

```auto
[pause_resume]
recover_velocity: 700

```

/edit2:  
Works like a charm:

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/d/db010fdb1186b9a0aa3859c6a1e845faecfcac89.jpeg)

/edit3:  
When finished changing filament, of course hit the RESUME button on klipperscreen or in the webinterface 😉

---

_[View the full topic](https://klipper.discourse.group/t/m600-command-how-to-purge/6519)._
