- This macro will dymanic change the bed_mesh area based on the size of the printed part. The fw will only probe on the area that the part will be printed (plus mesh_area_offset value)
- (1) Add the following macrro to your printer config and set the parameters to match you bed_mesh setting
[gcode_macro BED_MESH_PRINT_AREA]
; gcode parameters
variable_parameter_AREA_START_X : 0
variable_parameter_AREA_START_Y : 0
variable_parameter_AREA_END_X : 150
variable_parameter_AREA_END_Y : 180
; the "safe" area that the probe can reach, use value in config->[bed_mesh]
variable_mesh_min_x :0
variable_mesh_min_y :0
variable_mesh_max_x :150
variable_mesh_max_y :180
; the clearance between print area and probe area
variable_mesh_area_offset : 5
variable_probe_samples : 2
variable_mesh_size : 6
gcode:
{% if (params.AREA_START_X|default(0)|float < params.AREA_END_X|default(0)|float) and (params.AREA_START_Y|default(0)|float < params.AREA_END_Y|default(0)|float) %}
{% if params.AREA_START_X|default(0)|float - mesh_area_offset >= mesh_min_x %}
{% set mesh_min_x = params.AREA_START_X|default(0)|float - mesh_area_offset %}
{% endif %}
{% if params.AREA_START_Y|default(0)|float - mesh_area_offset >= mesh_min_y %}
{% set mesh_min_y = params.AREA_START_Y|default(0)|float - mesh_area_offset %}
{% endif %}
{% if params.AREA_END_X|default(0)|float + mesh_area_offset <= mesh_max_x %}
{% set mesh_max_x = params.AREA_END_X|default(0)|float + mesh_area_offset %}
{% endif %}
{% if params.AREA_END_Y|default(0)|float + mesh_area_offset <= mesh_max_y %}
{% set mesh_max_y = params.AREA_END_Y|default(0)|float + mesh_area_offset %}
{% endif %}
PRINT MSG="Set custom mesh area to ({mesh_min_x},{mesh_min_y}),({mesh_max_x},{mesh_max_y})"
{% if (params.AREA_END_X|float - params.AREA_START_X|float)*(params.AREA_END_Y|float - params.AREA_START_Y|float) < 20250.0 %}
{% set mesh_size = 4 %}
{% elif (params.AREA_END_X|float - params.AREA_START_X|float)*(params.AREA_END_Y|float - params.AREA_START_Y|float) < 13500.0 %}
{% set mesh_size = 3 %}
{% endif %}
PRINT MSG="Set custom mesh matrix to {mesh_size}x{mesh_size}"
BED_MESH_CALIBRATE mesh_min={mesh_min_x|float},{mesh_min_y|float} mesh_max={mesh_max_x|float},{mesh_max_y|float} probe_count={mesh_size|int},{mesh_size|int} samples={probe_samples|int}
{% else %}
PRINT MSG="Invalid custom mesh parameters, probe using default setting"
BED_MESH_CALIBRATE
{% endif %}
- (2) Edit your START_PRINT macro and add the following parameter under [gcode_macro START_PRINT]. The start and end xy position should match the bed_mesh setting
variable_parameter_AREA_START_X : 0 variable_parameter_AREA_START_Y : 0 variable_parameter_AREA_END_X : 150 variable_parameter_AREA_END_Y : 180
- (3) Add the following line into you START_MACRO print. The position should be after G28 and Z_TILT_ADJUST/QUAD_GANTRY_LEVEL
BED_MESH_PRINT_AREA AREA_START_X={params.AREA_START_X|float} AREA_START_Y={params.AREA_START_Y|float} AREA_END_X={params.AREA_END_X|float} AREA_END_Y={params.AREA_END_Y|float} - (4) Go to slicer setting and change the start gcode to
Prusa Slicer
START_PRINT T_BED=[first_layer_bed_temperature] T_EXTRUDER=[first_layer_temperature] AREA_START_X={first_layer_print_min[0]} AREA_START_Y={first_layer_print_min[1]} AREA_END_X={first_layer_print_max[0]} AREA_END_Y={first_layer_print_max[1]}
Ideal maker
START_PRINT T_BED=[first_layer_bed_temperature] T_EXTRUDER=[first_layer_temperature] AREA_START_X={print_pos_min_x} AREA_START_Y={print_pos_min_y} AREA_END_X={print_pos_max_x} AREA_END_Y={print_pos_max_y}
- (5) You might need to adjust your START_PRINT macro if it not in the same style as mine. This is an example example macro
- (optional) In the macro, there is a section to auto scale down the number of probe points based on the size of the print. You can change the number
20250.0and13500.0to match your need. The value is in mm^2