Advertisement
BobaQPE

Untitled

Jun 10th, 2021
2,811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [gcode_macro CANCEL_PRINT]
  2. rename_existing: BASE_CANCEL_PRINT
  3. gcode:
  4.     TURN_OFF_HEATERS
  5.     CLEAR_PAUSE
  6.     SDCARD_RESET_FILE
  7.     BASE_CANCEL_PRINT
  8.  
  9. [gcode_macro PAUSE]
  10. rename_existing: BASE_PAUSE
  11. # change this if you need more or less extrusion
  12. variable_extrude: 1.0
  13. gcode:
  14.     ##### read E from pause macro #####
  15.     {% set E = printer["gcode_macro PAUSE"].extrude|float %}
  16.     ##### set park positon for x and y #####
  17.     # default is your max posion from your printer.cfg
  18.     {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
  19.     {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
  20.     ##### calculate save lift position #####
  21.     {% set max_z = printer.toolhead.axis_maximum.z|float %}
  22.     {% set act_z = printer.toolhead.position.z|float %}
  23.     {% if act_z < (max_z - 2.0) %}
  24.         {% set z_safe = 2.0 %}
  25.     {% else %}
  26.         {% set z_safe = max_z - act_z %}
  27.     {% endif %}
  28.     ##### end of definitions #####
  29.     SAVE_GCODE_STATE NAME=PAUSE_state
  30.     BASE_PAUSE
  31.     G91
  32.     G1 E-{E} F2100
  33.     G1 Z{z_safe} F900
  34.     G90
  35.     G1 X{x_park} Y{y_park} F6000
  36.  
  37. [gcode_macro RESUME]
  38. rename_existing: BASE_RESUME
  39. gcode:
  40.     ##### read E from pause macro #####
  41.     {% set E = printer["gcode_macro PAUSE"].extrude|float %}
  42.     ##### end of definitions #####
  43.     G91
  44.     G1 E{E} F2100
  45.     RESTORE_GCODE_STATE NAME=PAUSE_state
  46.     BASE_RESUME
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement