Klipper mesh on print area only seting

Share your successful printing settings with others here. If you have any question about the parameters or printing skills of some filament, please find here.
lungkao
Posts: 8
Joined: Mon Jul 25, 2022 1:39 am

Klipper mesh on print area only seting

Postby lungkao » Mon Jul 25, 2022 1:49 am

add

Code: Select all

BED_MESH_CALIBRATE AREA_START={print_pos_min_x},{print_pos_min_y} AREA_END={print_pos_max_x},{print_pos_max_y}

to start gcode after G28


add gcode_macro to printer.cfg

Code: Select all

[gcode_macro BED_MESH_CALIBRATE]
rename_existing: BED_MESH_CALIBRATE_BASE
variable_mesh_delta : 25                   ## distance between points
variable_x_mesh_max : 7                    ## max points on x-axis
variable_y_mesh_max : 7                    ## max points on y-axis
variable_mesh_area_offset : 5              ## the clearance between print area and probe area
gcode=
   {% if params.AREA_START and params.AREA_END %}
   ## get [bed_mesh] config parameters
      {% set bedMeshConfig = printer["configfile"].config["bed_mesh"] %}
      {% set safe_min_x = bedMeshConfig.mesh_min.split(",")[0]|float %}
      {% set safe_min_y = bedMeshConfig.mesh_min.split(",")[1]|float %}
      {% set safe_max_x = bedMeshConfig.mesh_max.split(",")[0]|float %}
      {% set safe_max_y = bedMeshConfig.mesh_max.split(",")[1]|float %}
   ## get print area min/max from slicer gcode
      {% set area_min_x = params.AREA_START.split(",")[0]|float %}
      {% set area_min_y = params.AREA_START.split(",")[1]|float %}
      {% set area_max_x = params.AREA_END.split(",")[0]|float %}
      {% set area_max_y = params.AREA_END.split(",")[1]|float %}
   ## set probing area
      {% if area_min_x - mesh_area_offset >=  safe_min_x %}
         {% set area_min_x = area_min_x - mesh_area_offset %}
         {% else %}
         {% set area_min_x = safe_min_x %}
         {% endif %}
      {% if area_min_y - mesh_area_offset >=  safe_min_y %}
         {% set area_min_y = area_min_y - mesh_area_offset %}
         {% else %}
         {% set area_min_y = safe_min_y %}
         {% endif %}
      {% if area_max_x + mesh_area_offset <=  safe_max_x %}
         {% set area_max_x = area_max_x + mesh_area_offset %}
         {% else %}
         {% set area_max_x = safe_max_x %}
         {% endif %}
      {% if area_max_y + mesh_area_offset <=  safe_max_y %}
         {% set area_max_y = area_max_y + mesh_area_offset %}
         {% else %}
         {% set area_max_y = safe_max_y %}
         {% endif %}
   ## set probe counts
      {% set meshPointX = ((area_max_x - area_min_x) / mesh_delta + 1)|round(0)|int %}
      {% if meshPointX < 3 %}
         {% set meshPointX = 3 %}
         {% elif meshPointX > x_mesh_max %}
         {% set meshPointX = x_mesh_max %}
         {% endif %}
      {% set meshPointY = ((area_max_y - area_min_y) / mesh_delta + 1)|round(0)|int %}
      {% if meshPointY < 3 %}
         {% set meshPointY = 3 %}
         {% elif meshPointY > y_mesh_max %}
         {% set meshPointY = y_mesh_max %}
         {% endif %}
   ## check for invalid mesh
      {% if meshPointX > 5 %}
         {% if meshPointY == 3 %}  # 7x3 mesh invlaid for bicubic
         {% set meshPointY = 5 %}  # set 7x5 mesh
         {% endif %}
         {% endif %}
      {% if meshPointY > 5 %}
         {% if meshPointX == 3 %}  # 3x7 mesh invlaid for bicubic
         {% set meshPointX = 5 %}  # set 5x7 mesh
         {% endif %}
         {% endif %}
   ## set new reference index point
      {% set referenceIndex = (meshPointX * meshPointY / 2 - 1 )|round(0)|int %}
   ## send bed mesh parameters
      M117 probe_count={meshPointX},{meshPointY}
      BED_MESH_CALIBRATE_BASE mesh_min={area_min_x},{area_min_y} mesh_max={area_max_x},{area_max_y} probe_count={meshPointX},{meshPointY} relative_reference_index={referenceIndex}
   {% else %}
   BED_MESH_CALIBRATE_BASE
   {% endif %}
Attachments
Screen Shot 2565-07-25 at 08.43.48.png

Return to “Printing Settings”

Who is online

Users browsing this forum: No registered users and 3 guests