Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################################################################################################################################################
- # Pause
- ######################################################################################################################################################
- [gcode_macro PAUSE]
- description: Pause running print
- rename_existing: PAUSE_BASE
- gcode:
- # set park position
- {% set x_park = printer.toolhead.axis_maximum.x|float %}
- {% set y_park = printer.toolhead.axis_maximum.y|float %}
- # calculate save lift position
- {% set max_z = printer.toolhead.axis_maximum.z|float %}
- {% set current_z = printer.toolhead.position.z|float %}
- {% if current_z < (max_z - 2.0) %}
- {% set z_safe = 2.0 %}
- {% else %}
- {% set z_safe = max_z - current_z %}
- {% endif %}
- # define variables
- {% set position_x = printer.toolhead.position.x|float %}
- {% set position_y = printer.toolhead.position.y|float %}
- {% set position_z = printer.toolhead.position.z|float %}
- {% set extruder_temp = printer[printer.toolhead.extruder].target if printer.toolhead.extruder != '' else 0|float %}
- SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=saved_x VALUE="{position_x}"
- SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=saved_y VALUE="{position_y}"
- SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=saved_z VALUE={position_z}
- SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=saved_extruder_temp VALUE={extruder_temp}
- PAUSE_BASE
- G91
- {% if printer.extruder.can_extrude|lower == 'true' %}
- G1 E-2 F2100
- {% else %}
- {action_respond_info("Extruder not hot enough")}
- {% endif %}
- M104 S{extruder_temp - 100}
- {% if "xyz" in printer.toolhead.homed_axes %}
- G1 Z{z_safe} F1200
- G90
- G1 X{x_park} Y{y_park} F6000
- {% else %}
- {action_respond_info("Printer not homed")}
- {% endif %}
- ######################################################################################################################################################
- # Resume
- ######################################################################################################################################################
- [gcode_macro RESUME]
- description: Resume the actual running print
- rename_existing: RESUME_BASE
- variable_saved_extruder_temp: 0
- variable_saved_x: 0.0
- variable_saved_y: 0.0
- variable_saved_z: 0.0
- variable_saved_e: 0.0
- gcode:
- # get VELOCITY parameter if specified
- {% if 'VELOCITY' in params|upper %}
- {% set get_params = ('VELOCITY=' + params.VELOCITY) %}
- {%else %}
- {% set get_params = "" %}
- {% endif %}
- # heat extruder
- M109 S{saved_extruder_temp}
- # go back to last position
- G90
- G0 X{saved_x} Y{saved_y} F6000
- G0 Z{saved_z} F1200
- G91
- RESUME_BASE {get_params}
- ######################################################################################################################################################
- # Cancel
- ######################################################################################################################################################
- [gcode_macro CANCEL_PRINT]
- description: Cancel the actual running print
- rename_existing: CANCEL_PRINT_BASE
- gcode:
- END_PRINT
- CANCEL_PRINT_BASE
Advertisement
Add Comment
Please, Sign In to add comment