Bed_mesh_profile load

How can I change the macro APPLY_BUILD_SHEET_ADJUSTMENT to load a specific bed mesh profile?

I would like to BED_MESH_PROFILE LOAD of a specific sheet when apply build sheet adjustment.

[gcode_macro APPLY_BUILD_SHEET_ADJUSTMENT]
description: Applies the sheet offset adjustment for the installed build sheet, call from your PRINT_START macro
gcode:
    # get the offset from saved variables
    {% set svv = printer.save_variables.variables %}
    {% set sheet_key = (svv["build_sheet installed"] | string) %}
    {% set sheet = (svv[sheet_key] | default(None)) %}
    {% if sheet %}
        # log this to the console so if there is an issue with the print the user can see which sheet the printer thought it had installed
        {action_respond_info("Applying offset: %.3fmm for build sheet: %s" % (sheet.offset, sheet.name))}
        _BUILD_SHEETS__SET_GCODE_OFFSET Z_ADJUST={sheet.offset} MOVE=1
    {% else %}
        {action_respond_info("No build sheet installed, offset adjustment: 0.000mm") }
    {% endif %}

Hello @Jura !

Is there a reason you deleted the template?

Please read this:

1 Like

Excuse mee.### Basic Information:
Printer Model: Custom COREXY
MCU / Printerboard: SKR mini E3 V3.0
Host / SBC CB1
klippy.zip (1.0 MB)
klippy.log

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:

Excuse me.

How can I change the macro APPLY_BUILD_SHEET_ADJUSTMENT to load a specific bed mesh profile?
I would like to BED_MESH_PROFILE LOAD of a specific sheet when apply build sheet adjustment.

[gcode_macro APPLY_BUILD_SHEET_ADJUSTMENT]
description: Applies the sheet offset adjustment for the installed build sheet, call from your PRINT_START macro
gcode:

get the offset from saved variables

{% set svv = printer.save_variables.variables %}
{% set sheet_key = (svv[“build_sheet installed”] | string) %}
{% set sheet = (svv[sheet_key] | default(None)) %}
{% if sheet %}

log this to the console so if there is an issue with the print the user can see which sheet the printer thought it had installed

{action_respond_info(“Applying offset: %.3fmm for build sheet: %s” % (sheet.offset, sheet.name))}
_BUILD_SHEETS__SET_GCODE_OFFSET Z_ADJUST={sheet.offset} MOVE=1
{% else %}
{action_respond_info(“No build sheet installed, offset adjustment: 0.000mm”) }
{% endif %}

Already solved.
According to the selected sheet, the parameters of the sheet are loaded from Variables.cfg
I solved it with the help of ChatGPT. It is a great helper.

My macro:

[gcode_macro LOAD_BED_PROFILE]
gcode:
    {% set svv = printer.save_variables.variables %}
    {% if svv["build_sheet installed"] == "build_sheet smooth_sheet_1" %}
        {action_respond_info("Build sheet is Smooth_sheet_1")}
        BED_MESH_PROFILE LOAD=Smooth_sheet_1
    {% elif svv["build_sheet installed"] == "build_sheet textured_sheet_1" %}
        {action_respond_info("Build sheet is Textured_sheet_1")}
        BED_MESH_PROFILE LOAD=Textured_sheet_1    
    {% else %}
        {action_respond_info("Non sheet")}
    {% endif %}

Obviously you did not read the link entirely.

Code snippets are supposed to be formatted as Preformatted Text

Format

Please edit your posts accordingly. Without that format, the code is useless.

2 Likes

Thank you :grinning:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.