Macro Introduction
Start Macro
- Set
PRINT_STARTas the macro for starting a print, customizing actions before printing - Note that the macro name can be customized, as long as it is referenced in the slicer's start G-code
[gcode_macro PRINT_START]
gcode:
G92 E0 # Reset extruder
BED_MESH_CLEAR # Clear bed mesh
G28 # Home all axes
#Z_TILT_ADJUST # Gantry leveling
#quad_gantry_level # Gantry leveling
#G28 # Home all axes
G1 Z20 F3000 # Move nozzle away from bed
BED_MESH_PROFILE LOAD=default # Load bed mesh
Leveling and Bed Mesh Configuration Guide
I. Leveling Method Selection
Z_TILT_ADJUSTandquad_gantry_levelare mutually exclusive leveling solutions- Choose one based on your hardware architecture; do not use both simultaneously
- If no corresponding leveling solution exists, delete or comment out the relevant configuration
- It is recommended to home again after performing leveling
II. Bed Mesh Configuration Specifications
BED_MESH_PROFILE LOAD=default
- Only a single bed mesh configuration can be loaded; multiple configurations cannot be enabled simultaneously
- In
BED_MESH_PROFILE LOAD=default,defaultis the preset configuration name - If no bed mesh has been created beforehand or if it is named differently, errors may occur
III. Standard Bed Mesh Probing Command
BED_MESH_CALIBRATE horizontal_move_z=2 METHOD=rapid_scan
horizontal_move_z=2: Nozzle lifting height during probing (unit: mm)METHOD=rapid_scan: Use rapid scan probing method
IV. Adaptive Probing Command
BED_MESH_CALIBRATE adaptive=1
- Simplified command specifically designed for automatic leveling sensors
- Suitable for sensor systems such as
TAP,klicky,PL08, etc. - Probing height and movement method are automatically controlled by the sensor, eliminating the need for manual parameters
End Macro
- Set
PRINT_ENDas the macro for ending a print, customizing actions after printing - Note that the macro name can be customized, as long as it is referenced in the slicer's end G-code
[gcode_macro PRINT_END]
gcode:
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Check end position to determine safe directions to move
{% if printer.toolhead.position.x < (max_x - 20) %}
{% set x_safe = 20.0 %}
{% else %}
{% set x_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 20) %}
{% set y_safe = 20.0 %}
{% else %}
{% set y_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.z < (max_z - 2) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
M400 # Wait for buffer to clear
G92 E0 # Reset extruder to zero
G1 E-10.0 F3600 # Retract filament
G91 # Relative positioning
G0 Z{z_safe} F3600 # Raise gantry
G0 X{x_safe} Y{y_safe} F20000 # Move nozzle to remove string
M104 S0 # Turn off extruder heater
M140 S0 # Turn off bed heater
M106 S0 # Turn off part cooling fan
G90 # Set absolute coordinate system
G0 X{max_x / 2} Y{max_y} F3600 # Park nozzle at the back
BED_MESH_CLEAR # Clear bed mesh
Slicer Macro Settings
- PrusaSlicer Example
- OrcaSlicer Example
- Select
Printer - Select
Beginner modein the upper right corner, change it toExpert mode - Finally, select
Custom G-codeLoading... - Once
Start G-codeappears, you can proceed to the next stepLoading...
- Click this icon in the upper left corner
Loading...
- Click
Machine G-code, ifMachine start G-codeappears, you can proceed to the next stepLoading...
Loading...