Macro Introduction
Start Macro
- Set
PRINT_START
as the macro when starting print, customize actions before printing - Note that the macro name can be customized as long as it is referenced in the start slicing code
[gcode_macro PRINT_START]
gcode:
G92 E0 # Reset extruder
BED_MESH_CLEAR # Unload bed mesh
G28 # Home all axes
#Z_TILT_ADJUST # Gantries leveling
#quad_gantry_level # Gantries leveling
#G28 # Home all axes
G1 Z20 F3000 # Move nozzle away from heated bed
BED_MESH_PROFILE LOAD=default # Load bed mesh
Leveling and Bed Mesh Configuration Guide
I. Leveling Method Selection
Z_TILT_ADJUST
andquad_gantry_level
are mutually exclusive leveling solutions- Please choose one according to the equipment architecture, do not use both simultaneously
- Delete or comment out the corresponding configuration if not needed
- It is recommended to home the axes once after completing leveling
II. Bed Mesh Configuration Standards
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
,default
is the preset configuration name - Errors may occur if no bed mesh has been created or if it is named differently
III. Standard Bed Mesh Calibration Command
BED_MESH_CALIBRATE horizontal_move_z=2 METHOD=rapid_scan
horizontal_move_z=2
: Nozzle lift height during calibration (unit: mm)METHOD=rapid_scan
: Use fast scanning calibration method
IV. Adaptive Calibration Command
BED_MESH_CALIBRATE adaptive=1
- Simplified command specifically designed for auto-leveling sensors
- Applicable for sensor systems such as
TAP
,klicky
,PL08
- Probe height and movement are automatically controlled by the sensor, no manual parameters required
End Macro
- Set
PRINT_END
as the macro when ending print, customize actions after printing - Note that the macro name can be customized as long as it is referenced in the end slicing 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
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 stringing
M104 S0 # Turn off extruder
M140 S0 # Turn off heated bed
M106 S0 # Turn off model fan
G90 # Set absolute positioning
G0 X{max_x / 2} Y{max_y} F3600 # Park nozzle at the back
BED_MESH_CLEAR # Unload bed mesh
Slicer Macro Settings
- Example: PrusaSlicer
- Example: OrcaSlicer
- Select
Printer
- Change
Beginner mode
toExpert mode
at the top right corner - Finally select
Custom G-code
- If
Start G-code
appears, proceed to the next step
- Click on the icon at the top left
- Click
Machine G-code
, ifMachine start G-code
appears, you can proceed to the next step
Loading...