Skip to main content

Macro Introduction

Start Macro

  • Set PRINT_START as the macro for the start of printing to customize actions before printing.
  • Note: The macro name can be customized, as long as it is referenced in the slicer's start code.
[gcode_macro PRINT_START]
gcode:
G92 E0 # Reset extruder
BED_MESH_CLEAR # Clear bed mesh
G28 # Home all axes
#Z_TILT_ADJUST # Z-tilt adjust
#quad_gantry_level # Quad 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

1. Leveling Method Selection

  • Z_TILT_ADJUST and quad_gantry_level are mutually exclusive leveling solutions.
  • Choose one based on your device architecture; they cannot be used simultaneously.
  • If not present, delete or comment out the corresponding configuration.
  • It is recommended to home once after performing leveling.

2. Bed Mesh Configuration Specification

BED_MESH_PROFILE LOAD=default
  • Only a single bed mesh configuration can be loaded; multiple configurations cannot be enabled at the same time.
  • In BED_MESH_PROFILE LOAD=default, default is the preset configuration name.
  • If no bed mesh has been created in advance or if it is named differently, an error may occur.

3. Standard Bed Mesh Probing Command

BED_MESH_CALIBRATE horizontal_move_z=2 METHOD=rapid_scan
  • horizontal_move_z=2: Nozzle lift height during probing (unit: mm).
  • METHOD=rapid_scan: Use rapid scan probing method.

4. Adaptive Probing Command

BED_MESH_CALIBRATE adaptive=1
  • Simplified command specifically designed for auto-leveling sensors.
  • Suitable for sensor systems like TAP, klicky, PL08, etc.
  • Probing height and movement method are automatically controlled by the sensor; no manual parameters needed.

End Macro

  • Set PRINT_END as the macro for the end of printing to customize actions after printing.
  • Note: The macro name can be customized, as long as it is referenced in the slicer's end 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 # Zero the 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 hotend
M140 S0 # Turn off heatbed
M106 S0 # Turn off part cooling fan
G90 # Set to absolute positioning
G0 X{max_x / 2} Y{max_y} F3600 # Park nozzle at the rear
BED_MESH_CLEAR # Clear bed mesh

Slicer Macro Settings

  • Select Printer.
  • Change Beginner mode to Expert mode in the top right corner.
  • Finally, select Custom G-code.
    Loading...
  • If Start G-code appears, proceed to the next step.
    Loading...
Loading...