Skip to content

Instantly share code, notes, and snippets.

@ChipCE
Last active November 23, 2024 12:55
Show Gist options
  • Save ChipCE/95fdbd3c2f3a064397f9610f915f7d02 to your computer and use it in GitHub Desktop.
Save ChipCE/95fdbd3c2f3a064397f9610f915f7d02 to your computer and use it in GitHub Desktop.
Klipper bed mesh on print area only macro install guide

READ THIS FIRST

Adaptive bed mesh is merged into klipper master branch. You can use this feature without this custom macro. Official klipper adaptive bed mesh

Klipper mesh on print area only install guide

What this macro do

  • This macro will dynamically changing the bed mesh area based on the size of the parts will be printed. The fw will only probe on the area that the part will be printed (plus mesh_area_offset value)

Setup guide

  • (1) Add the following macro to your printer config, this will replace the default BED_MESH_CALIBRATE command.
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: BED_MESH_CALIBRATE_BASE
; gcode parameters
variable_parameter_AREA_START : 0,0
variable_parameter_AREA_END : 0,0
; the clearance between print area and probe area 
variable_mesh_area_offset : 5.0
; number of sample per probe point
variable_probe_samples : 2
; minimum probe count
variable_min_probe_count : 4
; scale up the probe count, should be 1.0 ~ < variable_max_probe_count/variable_min_probe_count
variable_probe_count_scale_factor : 1.0
; enable preference index
variable_enable_reference_index : False
gcode:
    {% if params.AREA_START and params.AREA_END %}
        {% 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 %}

        {% 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 %}

	{% if bedMeshConfig.probe_count.split(",")|length == 2 %}
            {% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|int %}
            {% set meshPointY = bedMeshConfig.probe_count.split(",")[1]|int %}
        {% else %}
            {% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|int %}
            {% set meshPointY = bedMeshConfig.probe_count.split(",")[0]|int %}
        {% endif %}

	{% set meshMaxPointX = meshPointX %}
	{% set meshMaxPointY = meshPointY %}


        {% if (area_min_x < area_max_x) and (area_min_y < area_max_y) %}
            {% 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 meshPointX = (meshPointX * (area_max_x - area_min_x) / (safe_max_x - safe_min_x) * probe_count_scale_factor)|round(0)|int %}
            {% if meshPointX < min_probe_count %}
                {% set meshPointX = min_probe_count %}
            {% endif %}
	    {% if meshPointX > meshMaxPointX %}
                {% set meshPointX = meshMaxPointX %}
            {% endif %}

            {% set meshPointY = (meshPointY * (area_max_y -area_min_y ) / (safe_max_y - safe_min_y) * probe_count_scale_factor )|round(0)|int %}
            {% if meshPointY < min_probe_count %}
                {% set meshPointY = min_probe_count %}
            {% endif %}
	    {% if meshPointY > meshMaxPointY %}
                {% set meshPointY = meshMaxPointY %}
            {% endif %}

            {% set algorithm = "bicubic" %}
	    {% if "algorithm" in bedMeshConfig %}
	        {% set algorithm = bedMeshConfig.algorithm %}
            {% endif %}
            {% if meshPointX >=7 or meshPointY >=7 %}
                {% set algorithm = "bicubic" %}
            {% endif %}

            {% if enable_reference_index %}
                {% set referenceIndex = (meshPointX * meshPointY / 2 - 1 )|round(0)|int %}
                BED_MESH_CALIBRATE_BASE mesh_min={area_min_x},{area_min_y} mesh_max={area_max_x},{area_max_y} probe_count={meshPointX},{meshPointY} samples={probe_samples|int} algorithm={algorithm} relative_reference_index={referenceIndex}
            {% else %}
                BED_MESH_CALIBRATE_BASE mesh_min={area_min_x},{area_min_y} mesh_max={area_max_x},{area_max_y} probe_count={meshPointX},{meshPointY} samples={probe_samples|int} algorithm={algorithm}
            {% endif %}
        {% else %}
            BED_MESH_CALIBRATE_BASE
        {% endif %}
    {% else %}
        BED_MESH_CALIBRATE_BASE
    {% endif %}
  • (2) Go to slicer setting and replace the old bed mesh gcode the following command.

Prusa Slicer
BED_MESH_CALIBRATE AREA_START={first_layer_print_min[0]},{first_layer_print_min[1]} AREA_END={first_layer_print_max[0]},{first_layer_print_max[1]}

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

Cura slicer
BED_MESH_CALIBRATE AREA_START=%MINX%,%MINY% AREA_END=%MAXX%,%MAXY%

*(Cura slicer plugin) To make the macro to work in Cura slicer, you need to install the post process plugin click here to download (based on frankbags's script)
- In cura menu Help -> Show configuration folder.
- Copy the python script from the above link in to scripts folder.
- Restart Cura
- In cura menu Extensions -> Post processing -> Modify G-Code and select Klipper print area mesh

For user using single command START_PRINT

  • (*) If you use single command start gcode like START_PRINT BED_TEMP={material_bed_temperature_layer_0} EXTRUDER_TEMP={material_print_temperature_layer_0} .You might need to add parameter parsing to BED_MESH_CALIBRATE inside START_PRINT. This is an example, also check my macro sample
[gcode_macro START_PRINT]
variable_parameter_EXTRUDER_TEMP: 190
variable_parameter_BED_TEMP: 60
; gcode parameters for area bed mesh
variable_parameter_AREA_START : 0,0
variable_parameter_AREA_END : 0,0
gcode:
    # preheat, homing, etc
    BED_MESH_CALIBRATE AREA_START={params.AREA_START|default("0,0")} AREA_END={params.AREA_END|default("0,0")}
    # the rest of your start macro here

And you will need to change Slicer start gcode to this

  • Cura: START_PRINT EXTRUDER_TEMP={material_print_temperature_layer_0} BED_TEMP={material_bed_temperature_layer_0} AREA_START=%MINX%,%MINY% AREA_END=%MAXX%,%MAXY%
  • Prusa slicer: START_PRINT EXTRUDER_TEMP=[first_layer_temperature] BED_TEMP=[first_layer_bed_temperature] AREA_START={first_layer_print_min[0]},{first_layer_print_min[1]} AREA_END={first_layer_print_max[0]},{first_layer_print_max[1]}

change logs

  • 2022/07/21
    • Added force lagrange algorithm for mesh with lower than 3 points
    • Added enable_reference_index config flag

The code does not work?

  • I will try to help if possible, you will have to post ALL of your configs, your slicer start gcode and your sliced gcode.
  • If I'm cannot or too slow to respose, our discord members might help you. Check our discord here
@1yrik
Copy link

1yrik commented Mar 10, 2023

The script works great, mostly. I have one issue (more of a minor inconvenience) where the Klipper gives a "Must home axis first: 0.000 0.000 5.000 [0.000]" on 3 consecutive lines. I just have to manually home the printer and then it works great, it's still just an inconvenience. My though is just that a G28 (I have a G28 macro) needs to be thrown in somewhere, I'm just not sure where exactly...
Thanks in advance for any help!
8% Printing - ETA_ 21_12 - handletest gcode - Google Chrome 2023-03-09 8_36_18 PM

@ChipCE
Copy link
Author

ChipCE commented Mar 10, 2023

@1yrik I think you need to edit your start gcode. This override macro is the same as the original BED_MESH_CALIBRATE, it can be called without homed axis.

@1yrik
Copy link

1yrik commented Mar 10, 2023

@ChipCE I know I have to add in a "G28" somewhere, I'm just not sure where. I'll take another look and see if anything obvious needs changing.

@Matei-alt
Copy link

When I boot up my printer after doing said changes I get this error. How can I fix this?
image

@ChipCE
Copy link
Author

ChipCE commented Mar 14, 2023

@Matei-alt seem like you dont have [bed_mesh] enabled in your config.

@Matei-alt
Copy link

@ChipCE Oh, I tought "this will replace the default BED_MESH_CALIBRATE command." meant to just replace that whole thing. Sorry for bothering you.

@mattfox27
Copy link

I have a question when probing begins the probe almost drags across the bed, like it does not go up it stays on the bed moves to the left then goes up a little and back down, is that correct?

@frankbags
Copy link

frankbags commented Mar 25, 2023

That's normal behavior if you have the option under [bltouch] stow_on_each_sample: false

https://www.klipper3d.org/BLTouch.html#multi-probing-without-stowing

if you have no clearance issues then it shouldn't be a problem, it does save a lot of time when building a mesh

@mattfox27
Copy link

Ya the probe was actually touching the bed as it moved to the next point which was causing false readings. I have to add a line in mesh section like horizontal_Z_probe: 8. This wasn't the exact line but something similar

@screech24
Copy link

Anyone using Bambu Studio or Orcaslicer ? I cant seem to get this to work using either of those slicers.. using the prusaslicer settings ... "START_PRINT EXTRUDER_TEMP=[first_layer_temperature] BED_TEMP=[first_layer_bed_temperature] AREA_START={first_layer_print_min[0]},{first_layer_print_min[1]} AREA_END={first_layer_print_max[0]},{first_layer_print_max[1]}"

@FraLem89
Copy link

M190 S[bed_temperature_initial_layer_single]
M109 S[nozzle_temperature_initial_layer]
M117
PRINT_START EXTRUDER=[nozzle_temperature_initial_layer] BED=[bed_temperature_initial_layer_single] PRINT_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} PRINT_MAX={first_layer_print_max[0]},{first_layer_print_max[1]}

@DaKlassiker
Copy link

DaKlassiker commented Apr 17, 2023

Unknown command:"AREA_START=158.387,158.396"

it does the full bed then. Any ideas? i´m using klicky probe

Superslicer:
PRINT_START BED=[first_layer_bed_temperature] EXTRUDER={first_layer_temperature[initial_extruder]+extruder_temperature_offset[initial_extruder]} CHAMBER=[chamber_temperature]
AREA_START={first_layer_print_min[0]},{first_layer_print_min[1]} AREA_END={first_layer_print_max[0]},{first_layer_print_max[1]}

[gcode_macro PRINT_START]
variable_parameter_AREA_START : 0,0
variable_parameter_AREA_END : 0,0

gcode:
{% set FILAMENT = params.FILAMENT|default('Default')|string %}
{% set MIN_TEMP = params.EXTRUDER|int * 0.9 %}
{% set BED_TEMP = params.BED|default(0)|int %}
{% set EXTRUDER_TEMP = params.EXTRUDER|default(0)|float %}
{% set chamber = params.CHAMBER|default(0)|int %}

SET_GCODE_VARIABLE MACRO=PRINT_START VARIABLE=chambertemp VALUE={chamber}

{% if params.FILAMENT == 'ABS' %}
	{% set nevermore_fan_speed = 0.70 %}
  
{% elif params.FILAMENT == 'ASA' %}
    {% set nevermore_fan_speed = 0.70 %}

{% elif params.FILAMENT == 'PETG' %}
	{% set nevermore_fan_speed = 0.40 %}
	
{% elif params.FILAMENT == 'PLA' %}
	{% set nevermore_fan_speed = 0 %}

{% elif params.FILAMENT == 'WOOD' %}
	{% set nevermore_fan_speed = 0 %}
	
{% else %} 
	{% set nevermore_fan_speed = 0 %}
{% endif %}

SET_FAN_SPEED FAN=Nevermore SPEED={nevermore_fan_speed}
#SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1
M107
M117 {params.FILAMENT}
M190 S{BED_TEMP} #M140
G28
G90
 {% if printer["temperature_sensor chamber"].temperature < chamber %}              
    HEATSOAK T={BED_TEMP} MOVE=1                                                         
    M190 S{BED_TEMP}                                                                    
    TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={chamber}          
{% else %}                                                                         
    {% if printer.heater_bed.temperature < (BED_TEMP-2) %}                               
        HEATSOAK T={BED_TEMP} MOVE=1                                                     
        M190 S{BED_TEMP}                                                                 
    {% else %}                                                                      
        HEATSOAK T={BED_TEMP} MOVE=0                                                   
    {% endif %}
{% endif %} 
M106 S0                                                                              
LEDWHITE 
ATTACH_PROBE_LOCK                                                              
QUAD_GANTRY_LEVEL                                                                  
G28 Z                                                                           
G90                                                                               
G0 Z20                                                                              
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} F19500 
BED_MESH_CALIBRATE AREA_START={params.AREA_START|default("0,0")} AREA_END={params.AREA_END|default("0,0")}
DOCK_PROBE_UNLOCK                                                                   
M109 S{EXTRUDER_TEMP}
SETACTUAL_ETMP
G1 E-1 F300
CALIBRATE_Z                                                                       
G92 E0                                                                             
PRIME_NOZZLE

@ChipCE
Copy link
Author

ChipCE commented Apr 18, 2023

@DaKlassiker your Prusa start gcode is splitted into 2 lines. They must be in the same line.

@HelioSG
Copy link

HelioSG commented May 3, 2023

@ChipCE
Dear, I'm trying to use the macro Klipper mesh on print area only, but I'm getting an error message:
"Internal error on command:"BED_MESH_CALIBRATE_BASE"
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software." Could you help me

@gtollini
Copy link

gtollini commented May 6, 2023

@ChipCE
Klipper has a minimum probe distance which isn't addressed by the current script. This can easily be solved by adding:

{% if (area_max_x - area_min_x) / meshMaxPointX < 1 %}
  {% set meshPointX = (area_max_x - area_min_x)|int %}
{% endif %}

And

{% if (area_max_y - area_min_y) / meshMaxPointY < 1 %}
  {% set meshPointY = (area_max_y - area_min_y)|int %}
{% endif %}

After the checks at lines 69-71 and 77-79.

@ChipCE
Copy link
Author

ChipCE commented May 7, 2023

@gtollini Thank for point out the bug!

I have some question about your fix code

{% if (area_max_x - area_min_x) / meshMaxPointX < 1 %}
  {% set meshPointX = (area_max_x - area_min_x)|int %}
{% endif %}
  • in the first line, we check if the probe distance is smaller than 1 or not, {% if (area_max_x - area_min_x) / meshMaxPointX < 1 %} should be {% if (area_max_x - area_min_x) / meshPointX < 1 %}
  • Why set {% set meshPointX = (area_max_x - area_min_x)|int %}? We set the mesh to 1mm distance with this?

@DocKuro
Copy link

DocKuro commented May 8, 2023

Hello, I'm trying to get this script to work, I added the macro and modified the START_PRINT line on superslicer; now the generated GCODE for my sample print looks like this:

START_PRINT EXTRUDER_TEMP=195 BED_TEMP=60 AREA_START=118.669,78.6702 AREA_END=231.35,191.33

The macro generate the points, but then fails calling the BED_MESH_CALIBRATE_BASE, so I made some try and generated a command that should cover my area, like this:

BED_MESH_CALIBRATE_BASE mesh_min=118.669,78.6702 mesh_max=231.35,191.33 probe_count=4,5 samples=5 algorithm=bicubic

The macro returns this output:

// Generating new points...
// bed_mesh: generated points
// Index | Tool Adjusted | Probe
// 0 | (129.3, 34.1) | (118.7, 78.7)
// 1 | (166.8, 34.1) | (156.2, 78.7)
// 2 | (204.4, 34.1) | (193.8, 78.7)
// 3 | (241.9, 34.1) | (231.3, 78.7)
// 4 | (241.9, 62.2) | (231.3, 106.8)
// 5 | (204.4, 62.2) | (193.8, 106.8)
// 6 | (166.8, 62.2) | (156.2, 106.8)
// 7 | (129.3, 62.2) | (118.7, 106.8)
// 8 | (129.3, 90.4) | (118.7, 135.0)
// 9 | (166.8, 90.4) | (156.2, 135.0)
// 10 | (204.4, 90.4) | (193.8, 135.0)
// 11 | (241.9, 90.4) | (231.3, 135.0)
// 12 | (241.9, 118.6) | (231.3, 163.2)
// 13 | (204.4, 118.6) | (193.8, 163.2)
// 14 | (166.8, 118.6) | (156.2, 163.2)
// 15 | (129.3, 118.6) | (118.7, 163.2)
// 16 | (129.3, 146.7) | (118.7, 191.3)
// 17 | (166.8, 146.7) | (156.2, 191.3)
// 18 | (204.4, 146.7) | (193.8, 191.3)
// 19 | (241.9, 146.7) | (231.3, 191.3)
// Klipper state: Shutdown
!! Internal error on command:"BED_MESH_CALIBRATE_BASE"

and the Fluidd UI error message says list index out of range
The points look all valid to me (print area is 350x310), could you point me to something else to look at?

@DocKuro
Copy link

DocKuro commented May 8, 2023

Well, it was easier than expected, I just had to enable the reference_index calculation in your macro
variable_enable_reference_index : True

@HelioSG check if this helps you too since your error looked very similar to mine.
Basically if you set a relative_reference_index in your [bed_mesh] configuration section, you have to enable its dynamic calculation, otherwise the index will not be relevant and its index could be outside the number of points generated, giving the aforementioned error.

@louispires
Copy link

Got it working good on my 400³ V-Core 3 - However 1 thing I noticed was the default BED MESH is saved as RATOS, this now saves it under DEFAULT, which during each layer change, causes these two log entries:
image

Not a BIG deal but if I could save this as RATOS, then it shouldn't load the BED mesh multiple times...

@ChipCE
Copy link
Author

ChipCE commented May 11, 2023

@louispires you can add BED_MESH_PROFILE LOAD= SAVE= REMOVE= to set the profile name you want to save to or load from.

@borolo222
Copy link

borolo222 commented Jun 27, 2023

I get no error messages, however it uses the normal calibration procedure for the print.

Cura settings:
START_PRINT T_BED={material_bed_temperature_layer_0} T_EXTRUDER={material_print_temperature_layer_0}
AREA_START=%MINX%,%MINY% AREA_END=%MAXX%,%MAXY%

In the gcode, the variables are sent:
AREA_START=96.5,96.5 AREA_END=138.5,138.5

printer.cfg:
[bed_mesh]
speed: 120
mesh_min: 10, 10
mesh_max: 200, 219
probe_count: 7,7
algorithm: bicubic
mesh_pps: 2,2
fade_start: 1
fade_end: 10
fade_target: 0

Macros:
calibrate same as example

`Start print:
[gcode_macro START_PRINT]

; gcode parameters for area bed mesh
variable_parameter_AREA_START : 0,0
variable_parameter_AREA_END : 0,0

gcode:
M117 Starting
# Get params
{% set T_BED = params.T_BED|default(50) %}
{% set T_EXTRUDER = params.T_EXTRUDER|default(205) %}
M117 Homing
# Use absolute coordinates
# G92

M117 Waiting for temperature
# Start bed heating and continue
M140 S{T_BED}
{% if printer.heater_bed.temperature > params.T_BED|float*0.85 %}
    M140 S{T_BED}
    M109 S{T_EXTRUDER} 
    M190 S{T_BED}
{% else %}
    M190 S{params.T_BED|float*0.85} # wait till 0.85 of bed temp is reached, then continue
    M140 S{T_BED} 
    M109 S{T_EXTRUDER}
    M190 S{T_BED}
{% endif %}

#BUILD MESH
M117 Homing
G28 ; Home all axes

;BED_MESH_CALIBRATE
BED_MESH_CALIBRATE AREA_START={params.AREA_START|default("0,0")} AREA_END={params.AREA_END|default("0,0")}
M117 Bed mesh

#Load Mesh
# M117 Loading Mesh
# BED_MESH_PROFILE LOAD="bed1b"

# Prime line
M117 Priming
PRIME_LINE

# Load Skew Profile
SKEW_PROFILE LOAD=my_skew_profile

M117 Printing...`

+++++

thanks for your help

@pradeep1080
Copy link

Hey,

Will it work in Delta printers? I made the changes as instructed in this page but I get the following error:
Error evaluating 'gcode_macro BED_MESH_CALIBRATE:gcode': jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'mesh_min'

@SlattyMatty
Copy link

You don't really need to be probing your bed before every print with a delta since it's static. Any variation between meshes you create will most likely be negligible.

@rwaspe
Copy link

rwaspe commented Aug 25, 2023

Has anyone figured out how to do this on Simplify3d or can't it be done?

@riva03
Copy link

riva03 commented Aug 30, 2023

Hello!

I'm getting this error:

!! Error evaluating 'gcode_macro BED_MESH_CALIBRATE:gcode': jinja2.exceptions.UndefinedError: 'extras.gcode_macro.GetStatusWrapper object' has no attribute 'gcode_macro _KAMP_Settings'

Thanks in advance

@jf2615
Copy link

jf2615 commented Aug 30, 2023

I keep getting the following error.
gcode command BED_MESH_CALIBRATE already registered Once the underlying issue is corrected, use the "RESTART" command to reload the config and restart the host software. Printer is halted

I have the BED_MESH_CALIBRATE renamed to BED_MESH_CALIBRATE_BASE in printer.cfg
I am calling a marcros.cfg where I have this script placed as a separate macro.

@frankbags
Copy link

are you including the macros.cfg twice by chance?
and are you renaming the original macro like this or simply rename the actual macro?

[gcode_macro BED_MESH_CALIBRATE] rename_existing: BED_MESH_CALIBRATE_BASE

@Nathan22211
Copy link

ok so I just copy pasted that macro into my config on my 350 siboor trident. It seems this macro doesn't work with Klicky. it didn't go and pick up my probe. I might modify the macro to fix that.

@Shaneweston
Copy link

I know I have done something stupid, but my brain has decided to take a holiday without me so i can't work out where I am wrong.

Two issues. The auto bed mesh seems to do the whole bed not just the print area. Also it leaves blobs of filament that slowly reduce in size as it probes the bed.


CURA START CODE
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
M300 S1318 P266
G28 Z0 ;move Z to min endstops
G0 Z0.2
G92 E0 ;zero the extruded length
G1 X40 E25 F400 ; Extrude 25mm of filament in a 4cm line. Reduce speed (F) if you have a nozzle smaller than 0.4mm!
G92 E0 ;zero the extruded length again
G1 E-1 F500 ; Retract a little
G1 X80 F4000 ; Quickly wipe away from the filament line
BED_MESH_CALIBRATE AREA_START=%MINX%,%MINY% AREA_END=%MAXX%,%MAXY%
M117 ; Printing…
G5


POST PLUGIN SCRIPT
C:\Users\shane\AppData\Roaming\cura\5.4\plugins\PostProcessingPlugin\Scripts\MeshPrintSize.py
import re #To perform the search and replace.

from ..Script import Script

class MeshPrintSize(Script):

def getSettingDataString(self):
    return """{
        "name": "Mesh Print Size",
        "key": "MeshPrintSize",
        "metadata": {},
        "version": 2,
        "settings":{}
    }"""

def execute(self, data):
        minMaxXY = {'MAXY':0,'MAXX':0, 'MINY':0,'MINX':0}
        lineData = ''

        for layer_number, layer in enumerate(data):
            for k,v in minMaxXY.items():
                result = re.search(str(k)+":(\d*\.?\d*)",layer)
                if result is not None:
                    minMaxXY[k] = result.group(1)

            if re.search('START_PRINT.*', layer) is not None:
                lineData = layer
                for k, v in minMaxXY.items():
                    pattern = re.compile('START_PRINT ')
                    replace = 'START_PRINT {variable}={value} '.format(variable = k, value = v)
                    lineData = re.sub(pattern, replace, lineData)

                data[layer_number] = lineData

        return data

******************************************************************8
BED_MESH_CALIBRATE.CFG
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: BED_MESH_CALIBRATE_BASE
; gcode parameters
variable_parameter_AREA_START : 0,0
variable_parameter_AREA_END : 0,0
; the clearance between print area and probe area
variable_mesh_area_offset : 5.0
; number of sample per probe point
variable_probe_samples : 2
; minimum probe count
variable_min_probe_count : 8
; scale up the probe count, should be 1.0 ~ < variable_max_probe_count/variable_min_probe_count
variable_probe_count_scale_factor : 1.0
; enable preference index
variable_enable_reference_index : False
gcode:
{% if params.AREA_START and params.AREA_END %}
{% 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 %}

    {% 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 %}

{% if bedMeshConfig.probe_count.split(",")|length == 2 %}
        {% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|int %}
        {% set meshPointY = bedMeshConfig.probe_count.split(",")[1]|int %}
    {% else %}
        {% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|int %}
        {% set meshPointY = bedMeshConfig.probe_count.split(",")[0]|int %}
    {% endif %}

{% set meshMaxPointX = meshPointX %}
{% set meshMaxPointY = meshPointY %}


    {% if (area_min_x < area_max_x) and (area_min_y < area_max_y) %}
        {% 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 meshPointX = (meshPointX * (area_max_x - area_min_x) / (safe_max_x - safe_min_x) * probe_count_scale_factor)|round(0)|int %}
        {% if meshPointX < min_probe_count %}
            {% set meshPointX = min_probe_count %}
        {% endif %}
    {% if meshPointX > meshMaxPointX %}
            {% set meshPointX = meshMaxPointX %}
        {% endif %}

        {% set meshPointY = (meshPointY * (area_max_y -area_min_y ) / (safe_max_y - safe_min_y) * probe_count_scale_factor )|round(0)|int %}
        {% if meshPointY < min_probe_count %}
            {% set meshPointY = min_probe_count %}
        {% endif %}
    {% if meshPointY > meshMaxPointY %}
            {% set meshPointY = meshMaxPointY %}
        {% endif %}

        {% set algorithm = "bicubic" %}
    {% if "algorithm" in bedMeshConfig %}
        {% set algorithm = bedMeshConfig.algorithm %}
        {% endif %}
        {% if meshPointX >=7 or meshPointY >=7 %}
            {% set algorithm = "bicubic" %}
        {% endif %}

        {% if enable_reference_index %}
            {% set referenceIndex = (meshPointX * meshPointY / 2 - 1 )|round(0)|int %}
            BED_MESH_CALIBRATE_BASE mesh_min={area_min_x},{area_min_y} mesh_max={area_max_x},{area_max_y} probe_count={meshPointX},{meshPointY} samples={probe_samples|int} algorithm={algorithm} relative_reference_index={referenceIndex}
        {% else %}
            BED_MESH_CALIBRATE_BASE mesh_min={area_min_x},{area_min_y} mesh_max={area_max_x},{area_max_y} probe_count={meshPointX},{meshPointY} samples={probe_samples|int} algorithm={algorithm}
        {% endif %}
    {% else %}
        BED_MESH_CALIBRATE_BASE
    {% endif %}
{% else %}
    BED_MESH_CALIBRATE_BASE
{% endif %}

PRINTER.CFG
###Anycubic Vyper Klipper Config###

[include mainsail.cfg]
[include BED_MESH_CALIBRATE.cfg]

[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: !PA7
position_min: -3
position_endstop: -3
position_max: 245
homing_speed: 30.0

[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC13
microsteps: 16
rotation_distance: 32
endstop_pin: !PC5
position_min: -17
position_endstop: -17
position_max: 245
homing_speed: 30.0

[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC14
microsteps: 16
rotation_distance: 8
endstop_pin: PB2
#position_endstop: 0.0
position_max: 260
position_min: -5
homing_speed: 5.0

[stepper_z1]
step_pin: PC0
dir_pin: !PC1
enable_pin: !PC15
microsteps: 16
rotation_distance: 8
#endstop_pin: PC6

[extruder]
step_pin: PB4
dir_pin: !PB3
enable_pin: !PA15
microsteps: 16
rotation_distance: 22.185
gear_ratio: 50:17
full_steps_per_rotation: 200
nozzle_diameter: 0.400
filament_diameter: 1.750
max_extrude_cross_section: 5.0
heater_pin: PA1
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC4
#control: pid
#pid_kp = 28.937
#pid_ki = 1.295
#pid_kd = 161.688
min_temp: 0
max_temp: 260
pressure_advance = 0.34

[heater_fan extruder_fan]
pin: PB1

[heater_bed]
heater_pin: PA4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PB0
#control: pid
#pid_kp = 67.648
#pid_ki = 1.044
#pid_kd = 1095.893
min_temp: 0
max_temp: 110

[fan]
pin: PA0

[probe]
pin: !PB12
#z_offset: 0
activate_gcode:
probe_reset

[output_pin LED]
pin: mcu:PA13
pwm: False
value: 0

[output_pin probe_reset_pin]
pin: PB13

[filament_switch_sensor runout]
pause_on_runout: True
switch_pin: PA5

[mcu]
serial: /dev/ttyUSB0
restart_method: command

[temperature_sensor Raspberry Pi]
sensor_type: temperature_host
min_temp: 0
max_temp: 100

[safe_z_home]
home_xy_position: -3,-17
z_hop: 10

[input_shaper]

#shaper_freq_x: 62.2

#shaper_type_x: ei

#shaper_freq_y: 36.8

#shaper_type_y: mzv

[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 4000
max_accel_to_decel: 3000
max_z_velocity: 5
max_z_accel: 100

[bed_mesh]
mesh_min: 15,15
mesh_max: 230, 230
probe_count: 6,6
mesh_pps: 2,3
algorithm: bicubic
speed: 5400
horizontal_move_z: 5

[gcode_macro probe_reset]
gcode:
SET_PIN PIN=probe_reset_pin VALUE=0
G4 P300
SET_PIN PIN=probe_reset_pin VALUE=1
G4 P100

[display_status]

[pause_resume]

[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
##### set defaults #####
{% set x = params.X|default(230) %} #edit to your park position
{% set y = params.Y|default(230) %} #edit to your park position
{% set z = params.Z|default(10)|float %} #edit to your park position
{% set e = params.E|default(1) %} #edit to your retract length
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% set lift_z = z|abs %}
{% if act_z < (max_z - lift_z) %}
{% set z_safe = lift_z %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{e} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe}
G90
G1 X{x} Y{y} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}

[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### set defaults #####
{% set e = params.E|default(1) %} #edit to your retract length
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E{e} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}

[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE

## <---------------------- SAVE_CONFIG ---------------------->
#
# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
##
#
# [input_shaper]
## shaper_type_x = ei
#
# shaper_freq_x = 61.0
## shaper_type_y = mzv
#
# shaper_freq_y = 58.0
##
#
# [bed_mesh default]
## version = 1
#
# points =
## -0.235000, -0.242500, -0.200000, -0.037500, 0.005000, -0.080000, 0.000000, 0.080000, 0.210000, 0.280000, 0.175000, 0.172500, 0.172500, 0.332500, 0.327500
#
# -0.232500, -0.227500, -0.190000, -0.067500, 0.087500, -0.330000, 0.027500, 0.085000, 0.235000, 0.357500, 0.245000, 0.225000, 0.260000, 0.330000, 0.122500
## -0.145000, -0.275000, -0.185000, -0.037500, -0.125000, 0.032500, -0.052500, 0.005000, 0.240000, 0.340000, 0.327500, 0.255000, 0.242500, 0.362500, 0.370000
#
# -0.155000, -0.247500, -0.200000, -0.015000, 0.122500, 0.090000, 0.005000, 0.077500, 0.215000, 0.147500, 0.287500, 0.197500, 0.240000, 0.295000, 0.327500
## -0.202500, -0.275000, -0.147500, -0.035000, 0.045000, 0.045000, -0.047500, 0.042500, 0.267500, 0.367500, 0.222500, 0.022500, 0.275000, 0.260000, 0.322500
#
# -0.065000, -0.352500, -0.230000, -0.077500, 0.005000, 0.090000, 0.037500, 0.047500, 0.160000, 0.370000, 0.325000, 0.200000, 0.297500, 0.370000, 0.370000
## -0.240000, -0.220000, -0.160000, -0.025000, 0.122500, 0.045000, 0.082500, -0.090000, 0.250000, 0.322500, 0.317500, 0.240000, 0.280000, 0.340000, 0.402500
#
# -0.052500, -0.200000, -0.130000, 0.005000, 0.005000, -0.485000, -0.040000, -0.050000, 0.247500, 0.362500, 0.182500, 0.242500, 0.297500, 0.400000, 0.432500
## -0.035000, -0.325000, -0.152500, -0.037500, 0.120000, -0.015000, 0.032500, 0.087500, 0.125000, 0.210000, 0.280000, 0.120000, 0.082500, 0.330000, 0.295000
#
# -0.065000, -0.315000, -0.155000, -0.055000, -0.202500, -0.035000, 0.090000, 0.125000, 0.260000, 0.245000, 0.160000, 0.167500, 0.240000, 0.012500, 0.327500
## -0.112500, -0.122500, -0.120000, 0.012500, 0.120000, 0.172500, 0.137500, 0.135000, 0.282500, 0.287500, 0.242500, 0.247500, 0.295000, 0.405000, 0.345000
#
# -0.112500, -0.307500, -0.127500, -0.035000, 0.127500, 0.187500, 0.115000, 0.080000, 0.160000, 0.407500, 0.342500, 0.250000, 0.317500, 0.120000, 0.395000
## -0.147500, -0.152500, -0.107500, -0.037500, 0.120000, 0.052500, 0.125000, 0.207500, 0.335000, 0.325000, 0.372500, 0.112500, 0.295000, 0.365000, 0.357500
#
# -0.112500, -0.357500, -0.077500, 0.005000, -0.045000, 0.147500, 0.127500, 0.037500, 0.330000, 0.450000, 0.267500, 0.227500, 0.302500, 0.365000, 0.407500
## -0.142500, -0.150000, -0.147500, 0.005000, 0.165000, 0.167500, 0.160000, 0.195000, 0.367500, -0.245000, 0.140000, 0.330000, 0.182500, 0.355000, 0.407500
#
# x_count = 15
## y_count = 15
#
# mesh_x_pps = 2
## mesh_y_pps = 2
#
# algo = bicubic
## tension = 0.2
#
# min_x = 15.0
## max_x = 229.9
#
# min_y = 15.0
## max_y = 229.9
#
#
## [probe]
#
# z_offset = -0.170
##
#
# [stepper_z]
## position_endstop = 2.760
#
#
## [extruder]
#
# control = pid
## pid_kp = 32.303
#
# pid_ki = 1.976
## pid_kd = 132.037
#
#
## [heater_bed]
#
# control = pid
## pid_kp = 68.901
#
# pid_ki = 1.215
## pid_kd = 976.672
#
#
## [bed_mesh 15x15]
#
# version = 1
## points =
#
# -0.777500, -0.850000, -0.895000, -0.792500, -0.632500, -0.932500, -0.637500, -0.665000, -0.592500, -0.460000, -0.537500, -0.682500, -0.715000, -0.640000, -1.017500
## -1.085000, -1.102500, -0.887500, -0.755000, -0.582500, -0.615000, -0.662500, -0.777500, -0.562500, -0.485000, -0.512500, -0.717500, -0.755000, -0.647500, -0.665000
#
# -0.795000, -0.805000, -0.827500, -0.730000, -0.632500, -0.565000, -0.645000, -0.687500, -0.650000, -0.477500, -0.517500, -0.632500, -0.672500, -0.572500, -0.982500
## -0.890000, -0.807500, -0.935000, -0.687500, -0.677500, -0.522500, -0.762500, -0.677500, -0.677500, -0.422500, -0.487500, -0.682500, -0.715000, -0.627500, -0.902500
#
# -0.802500, -0.722500, -0.825000, -0.735000, -0.555000, -0.545000, -1.007500, -0.645000, -0.557500, -0.430000, -0.485000, -0.625000, -0.650000, -0.542500, -0.950000
## -0.647500, -0.647500, -0.732500, -0.665000, -0.490000, -0.467500, -0.542500, -0.605000, -0.545000, -0.392500, -0.602500, -0.652500, -0.710000, -0.632500, -0.905000
#
# -0.685000, -0.835000, -0.747500, -0.750000, -0.547500, -0.472500, -0.592500, -0.617500, -0.437500, -0.352500, -0.427500, -0.595000, -0.662500, -0.515000, -0.867500
## -0.642500, -0.655000, -0.765000, -0.655000, -0.447500, -0.520000, -0.547500, -0.637500, -0.480000, -0.362500, -0.422500, -0.625000, -0.642500, -0.550000, -0.725000
#
# -0.565000, -0.680000, -0.912500, -0.667500, -0.472500, -0.477500, -0.552500, -0.552500, -0.440000, -0.287500, -0.362500, -0.500000, -0.550000, -0.437500, -0.850000
## -0.487500, -0.625000, -0.680000, -0.575000, -0.417500, -0.390000, -0.690000, -0.527500, -0.392500, -0.285000, -0.382500, -0.510000, -0.580000, -0.475000, -0.505000
#
# -0.512500, -0.595000, -0.642500, -0.565000, -0.400000, -0.357500, -0.435000, -0.490000, -0.340000, -0.250000, -0.360000, -0.635000, -0.540000, -0.550000, -0.782500
## -0.477500, -0.517500, -0.777500, -0.542500, -0.330000, -0.295000, -0.410000, -0.432500, -0.320000, -0.265000, -0.320000, -0.490000, -0.630000, -0.420000, -0.757500
#
# -0.762500, -0.962500, -0.797500, -0.680000, -0.377500, -0.305000, -0.595000, -0.470000, -0.280000, -0.192500, -0.197500, -0.545000, -0.517500, -0.517500, -0.675000
## -1.185000, -0.660000, -0.600000, -0.435000, -0.280000, -0.320000, -0.345000, -0.525000, -0.227500, -0.157500, -0.227500, -0.435000, -0.562500, -0.667500, -0.805000
#
# -0.605000, -0.525000, -0.607500, -0.475000, -0.320000, -0.252500, -0.357500, -0.427500, -0.230000, -0.112500, -0.215000, -0.440000, -0.600000, -0.405000, -0.510000
## x_count = 15
#
# y_count = 15
## mesh_x_pps = 2
#
# mesh_y_pps = 2
## algo = bicubic
#
# tension = 0.2
## min_x = 15.0
#
# max_x = 229.9
## min_y = 15.0
#
# max_y = 229.9
##
#
# [bed_mesh 15 hot]
## version = 1
#
# points =
## -0.452500, -0.550000, -0.380000, -0.170000, -0.135000, -0.372500, -0.127500, 0.037500, 0.150000, 0.125000, 0.015000, 0.030000, 0.225000, 0.160000, 0.012500
#
# -0.487500, -0.505000, -0.300000, -0.127500, -0.142500, -0.160000, -0.170000, 0.102500, 0.172500, 0.110000, 0.020000, 0.130000, 0.157500, 0.095000, 0.012500
## -0.460000, -0.525000, -0.297500, -0.082500, -0.092500, -0.125000, -0.065000, 0.012500, 0.222500, 0.177500, 0.055000, 0.147500, 0.265000, 0.212500, 0.012500
#
# -0.502500, -0.537500, -0.292500, -0.090000, -0.070000, -0.120000, -0.292500, 0.137500, 0.230000, 0.140000, 0.137500, 0.195000, 0.312500, 0.260000, 0.092500
## -0.497500, -0.540000, -0.547500, -0.100000, -0.055000, -0.117500, -0.047500, 0.195000, 0.250000, 0.262500, 0.115000, 0.227500, 0.330000, 0.310000, 0.105000
#
# -0.452500, -0.412500, -0.225000, -0.067500, -0.032500, -0.077500, 0.002500, 0.202500, 0.262500, 0.255000, 0.055000, 0.245000, 0.337500, 0.310000, 0.105000
## -0.417500, -0.562500, -0.365000, -0.047500, 0.000000, -0.062500, -0.025000, 0.192500, 0.317500, 0.270000, 0.172500, 0.237500, 0.355000, 0.327500, 0.167500
#
# -0.400000, -0.420000, -0.227500, -0.010000, 0.020000, -0.037500, 0.022500, 0.260000, 0.337500, 0.295000, 0.227500, 0.295000, 0.380000, 0.257500, 0.217500
## -0.412500, -0.415000, -0.227500, -0.012500, 0.015000, -0.040000, 0.037500, 0.260000, 0.375000, 0.322500, 0.275000, 0.332500, 0.442500, 0.200000, 0.222500
#
# -0.380000, -0.382500, -0.180000, 0.017500, 0.050000, -0.017500, 0.090000, 0.287500, 0.415000, 0.360000, 0.257500, 0.360000, 0.460000, 0.385000, 0.257500
## -0.377500, -0.367500, -0.137500, 0.040000, 0.092500, 0.030000, 0.117500, 0.300000, 0.425000, 0.375000, 0.285000, 0.332500, 0.455000, 0.327500, 0.252500
#
# -0.397500, -0.390000, -0.145000, 0.057500, 0.105000, -0.117500, 0.157500, 0.377500, 0.432500, 0.417500, 0.337500, 0.410000, 0.500000, 0.467500, 0.292500
## -0.462500, -0.362500, -0.177500, 0.032500, -0.067500, 0.065000, 0.150000, 0.375000, 0.502500, 0.420000, 0.357500, 0.177500, 0.550000, 0.475000, 0.307500
#
# -0.417500, -0.377500, -0.147500, 0.062500, 0.105000, 0.097500, 0.175000, 0.377500, 0.507500, 0.460000, 0.385000, 0.257500, 0.557500, 0.537500, 0.385000
## -0.425000, -0.375000, -0.217500, 0.085000, 0.152500, 0.105000, 0.220000, 0.295000, 0.502500, 0.435000, 0.365000, 0.425000, 0.540000, 0.462500, 0.312500
#
# x_count = 15
## y_count = 15
#
# mesh_x_pps = 2
## mesh_y_pps = 2
#
# algo = bicubic
## tension = 0.2
#
# min_x = 15.0
## max_x = 229.9
#
# min_y = 15.0
## max_y = 229.9
#
#
## [bed_mesh 25 hot]
#
# version = 1
## points =
#
# -0.722500, -0.252500, -0.117500, -0.047500, -0.055000, 0.010000, 0.020000, 0.050000, 0.177500, 0.360000, 0.435000, 0.490000, 0.492500, 0.495000, 0.445000, 0.560000, 0.607500, 0.732500, 0.732500, 0.762500, 0.737500, 0.602500, 0.587500, 0.592500, 0.582500
## -0.325000, -0.200000, -0.070000, 0.017500, 0.030000, 0.030000, 0.052500, 0.100000, 0.200000, 0.242500, 0.432500, 0.487500, 0.497500, 0.470000, 0.455000, 0.490000, 0.637500, 0.720000, 0.765000, 0.725000, 0.750000, 0.645000, 0.582500, 0.607500, 0.680000
#
# -0.365000, -0.150000, -0.005000, 0.010000, 0.050000, 0.052500, -0.017500, 0.115000, 0.225000, 0.352500, 0.425000, 0.315000, 0.525000, 0.507500, 0.480000, 0.517500, 0.527500, 0.750000, 0.755000, 0.770000, 0.442500, 0.622500, 0.600000, 0.650000, 0.585000
## -0.385000, -0.282500, -0.022500, 0.017500, 0.075000, -0.155000, 0.112500, 0.125000, 0.240000, 0.355000, 0.480000, 0.550000, 0.507500, 0.482500, 0.515000, 0.505000, 0.647500, 0.620000, 0.792500, 0.707500, 0.742500, 0.657500, 0.600000, 0.255000, 0.642500
#
# -0.362500, -0.190000, -0.097500, 0.025000, 0.060000, -0.190000, 0.082500, 0.110000, 0.270000, 0.397500, 0.477500, 0.505000, 0.552500, 0.520000, 0.507500, 0.587500, 0.682500, 0.617500, 0.820000, 0.822500, 0.802500, 0.712500, 0.395000, 0.497500, 0.692500
## -0.510000, -0.402500, -0.095000, -0.047500, -0.132500, -0.092500, 0.097500, 0.142500, 0.255000, 0.405000, 0.437500, 0.512500, 0.522500, 0.542500, 0.550000, 0.577500, 0.682500, 0.785000, 0.745000, 0.790000, 0.765000, 0.710000, 0.657500, 0.662500, 0.722500
#
# -0.495000, -0.167500, -0.142500, 0.002500, -0.040000, 0.007500, 0.082500, 0.105000, 0.212500, 0.395000, 0.472500, 0.567500, 0.530000, 0.472500, 0.562500, 0.627500, 0.727500, 0.830000, 0.725000, 0.875000, 0.785000, 0.750000, 0.757500, 0.755000, 0.802500
## -0.287500, -0.142500, -0.002500, 0.072500, 0.080000, 0.085000, 0.107500, 0.102500, 0.257500, 0.390000, 0.520000, 0.592500, 0.610000, 0.560000, 0.580000, 0.620000, 0.750000, 0.852500, 0.885000, 0.812500, 0.837500, 0.762500, 0.747500, 0.755000, 0.805000
#
# -0.485000, -0.155000, -0.005000, 0.050000, 0.087500, 0.087500, 0.080000, -0.027500, 0.277500, 0.157500, 0.520000, 0.560000, 0.595000, 0.540000, 0.555000, 0.735000, 0.757500, 0.842500, 0.872500, 0.547500, 0.820000, 0.777500, 0.700000, 0.457500, 0.817500
## -0.232500, -0.070000, -0.107500, 0.080000, 0.115000, 0.080000, 0.120000, 0.000000, 0.287500, 0.427500, 0.555000, 0.612500, 0.615000, 0.565000, 0.605000, 0.630000, 0.727500, 0.820000, 0.910000, 0.877500, 0.852500, 0.647500, 0.677500, 0.767500, 0.817500
#
# -0.397500, -0.167500, -0.237500, 0.092500, 0.092500, 0.107500, 0.110000, 0.182500, 0.315000, 0.457500, 0.600000, 0.577500, 0.600000, 0.587500, 0.610000, 0.657500, 0.755000, 0.867500, 0.900000, 0.872500, 0.867500, 0.795000, 0.470000, 0.755000, 0.802500
## -0.235000, -0.080000, 0.012500, 0.112500, 0.125000, 0.122500, -0.345000, 0.235000, 0.335000, 0.482500, 0.562500, 0.625000, 0.615000, 0.572500, 0.612500, 0.400000, 0.602500, 0.877500, 0.905000, 0.915000, 0.842500, 0.455000, 0.780000, 0.787500, 0.825000
#
# -0.245000, -0.085000, -0.177500, 0.027500, 0.097500, -0.010000, 0.170000, 0.230000, 0.265000, 0.472500, 0.530000, 0.610000, 0.620000, 0.580000, 0.470000, 0.697500, 0.787500, 0.900000, 0.907500, 0.932500, 0.890000, 0.822500, 0.802500, 0.855000, 0.885000
## -0.212500, -0.117500, 0.042500, 0.135000, 0.170000, 0.127500, 0.162500, 0.237500, 0.362500, 0.485000, 0.597500, 0.610000, 0.665000, 0.617500, 0.642500, 0.707500, 0.837500, 0.912500, 0.957500, 0.910000, 0.910000, 0.867500, 0.830000, 0.840000, 0.877500
#
# -0.215000, -0.075000, 0.045000, 0.115000, 0.157500, 0.145000, 0.105000, 0.197500, 0.242500, 0.507500, 0.607500, 0.585000, 0.672500, 0.640000, 0.640000, 0.705000, 0.697500, 0.920000, 0.965000, 0.975000, 0.897500, 0.885000, 0.810000, 0.865000, 0.947500
## -0.160000, -0.165000, -0.272500, 0.100000, 0.132500, 0.172500, 0.192500, 0.255000, 0.395000, 0.545000, 0.627500, 0.667500, 0.685000, 0.667500, 0.682500, 0.750000, 0.567500, 0.957500, 0.995000, 1.000000, 0.937500, 0.842500, 0.837500, 0.655000, 0.920000
#
# -0.187500, -0.055000, 0.087500, 0.162500, 0.145000, -0.072500, 0.202500, 0.277500, 0.402500, 0.557500, 0.647500, 0.717500, 0.652500, 0.647500, 0.652500, 0.735000, 0.837500, 0.965000, 0.962500, 0.995000, 0.920000, 0.885000, 0.865000, 0.875000, 0.762500
## -0.130000, -0.032500, 0.080000, 0.037500, 0.207500, 0.210000, 0.187500, 0.292500, 0.407500, 0.515000, 0.670000, 0.717500, 0.722500, 0.667500, 0.677500, 0.740000, 0.637500, 0.925000, 1.007500, 1.007500, 0.952500, 0.872500, 0.865000, 0.910000, 0.952500
#
# -0.285000, -0.412500, 0.030000, 0.067500, 0.232500, 0.192500, 0.162500, 0.192500, 0.430000, 0.592500, 0.667500, 0.725000, 0.732500, 0.515000, 0.722500, 0.797500, 0.910000, 0.792500, 1.007500, 1.027500, 0.947500, 0.907500, 0.880000, 0.885000, 0.955000
## -0.207500, -0.035000, 0.020000, 0.165000, 0.040000, 0.227500, 0.227500, 0.317500, 0.482500, 0.567500, 0.710000, 0.727500, 0.630000, 0.735000, 0.740000, 0.760000, 0.902500, 0.830000, 1.017500, 1.037500, 0.985000, 0.920000, 0.907500, 0.897500, 0.970000
#
# -0.227500, -0.077500, 0.075000, 0.197500, 0.170000, 0.197500, 0.245000, 0.325000, 0.445000, 0.610000, 0.482500, 0.760000, 0.752500, 0.745000, 0.732500, 0.822500, 0.895000, 1.030000, 1.065000, 1.082500, 1.000000, 0.957500, 0.940000, 0.595000, 0.930000
## -0.210000, -0.032500, 0.045000, 0.120000, 0.110000, 0.202500, 0.255000, 0.330000, 0.435000, 0.600000, 0.702500, 0.770000, 0.750000, 0.732500, 0.747500, 0.832500, 0.930000, 0.905000, 1.040000, 1.057500, 1.015000, 0.870000, 0.915000, 0.957500, 1.007500
#
# -0.242500, -0.032500, -0.377500, -0.077500, 0.000000, 0.200000, 0.265000, 0.350000, 0.482500, 0.605000, 0.725000, 0.777500, 0.767500, 0.722500, 0.760000, 0.735000, 0.960000, 0.875000, 1.075000, 1.072500, 1.002500, 0.952500, 0.790000, 0.950000, 1.022500
## -0.200000, -0.042500, 0.082500, 0.027500, 0.235000, 0.227500, 0.272500, 0.352500, 0.485000, 0.640000, 0.715000, 0.757500, 0.777500, 0.750000, 0.740000, 0.465000, 0.962500, 1.050000, 1.047500, 0.787500, 0.997500, 0.535000, 0.945000, 0.945000, 1.032500
#
# -0.240000, -0.050000, 0.055000, 0.100000, 0.272500, 0.200000, 0.082500, 0.362500, 0.502500, 0.637500, 0.715000, 0.795000, 0.787500, 0.762500, 0.787500, 0.870000, 0.542500, 1.137500, 1.067500, 1.065000, 1.000000, 0.945000, 0.527500, 0.625000, 0.960000
## x_count = 25
#
# y_count = 25
## mesh_x_pps = 2
#
# mesh_y_pps = 2
## algo = bicubic
#
# tension = 0.2
## min_x = 15.0
#
# max_x = 229.8
## min_y = 15.0
#
# max_y = 229.8
##
#
# [bed_mesh new]
## version = 1
#
# points =
## -0.342500, -0.135000, -0.162500, -0.137500, -0.345000, 0.042500, 0.235000, 0.050000, 0.130000, 0.280000, 0.192500, 0.317500, 0.395000, 0.400000, 0.560000, 0.530000, 0.565000, 0.585000, 0.512500, 0.467500, 0.477500, -0.377500, 0.475000, 0.617500, 0.572500
#
# -0.132500, -0.042500, -0.167500, -0.175000, -0.067500, 0.072500, 0.200000, 0.290000, 0.155000, 0.275000, 0.240000, 0.242500, 0.262500, 0.397500, 0.422500, 0.552500, 0.582500, 0.520000, 0.372500, 0.427500, 0.390000, -0.302500, 0.587500, 0.565000, 0.592500
## -0.090000, -0.090000, -0.037500, -0.255000, -0.002500, 0.072500, 0.205000, 0.270000, 0.287500, 0.322500, 0.257500, 0.242500, 0.277500, 0.400000, 0.480000, 0.552500, 0.550000, 0.562500, 0.397500, 0.425000, 0.437500, 0.485000, 0.572500, 0.547500, 0.572500
#
# -0.127500, -0.085000, -0.122500, -0.145000, -0.020000, 0.000000, 0.157500, 0.292500, 0.310000, 0.310000, 0.192500, 0.245000, 0.312500, 0.360000, 0.482500, 0.567500, 0.590000, 0.527500, 0.527500, 0.460000, 0.437500, 0.490000, 0.582500, 0.490000, 0.442500
## -0.040000, -0.085000, -0.165000, -0.040000, -0.035000, 0.082500, 0.230000, 0.305000, 0.287500, 0.270000, 0.207500, 0.240000, 0.280000, 0.362500, 0.485000, 0.192500, 0.592500, 0.442500, 0.442500, 0.480000, 0.395000, 0.452500, 0.562500, 0.602500, 0.532500
#
# -0.077500, -0.100000, -0.137500, -0.205000, 0.000000, 0.060000, 0.167500, 0.215000, 0.315000, 0.310000, 0.192500, 0.280000, 0.277500, 0.415000, 0.480000, 0.542500, 0.602500, 0.545000, 0.432500, 0.447500, 0.495000, 0.550000, 0.515000, 0.550000, 0.562500
## -0.110000, -0.167500, -0.092500, -0.037500, -0.047500, 0.037500, 0.195000, 0.200000, 0.265000, 0.277500, 0.272500, 0.277500, 0.282500, 0.375000, 0.475000, 0.600000, 0.555000, 0.555000, 0.500000, 0.457500, 0.475000, 0.547500, 0.530000, 0.455000, 0.622500
#
# -0.075000, -0.130000, -0.070000, -0.090000, -0.087500, 0.112500, 0.115000, 0.267500, 0.347500, 0.325000, 0.285000, 0.277500, 0.067500, 0.440000, 0.520000, 0.537500, 0.557500, 0.552500, 0.472500, 0.480000, 0.442500, 0.527500, 0.615000, 0.632500, 0.620000
## -0.030000, -0.040000, -0.160000, -0.075000, -0.045000, -0.040000, 0.202500, 0.247500, 0.300000, 0.282500, 0.245000, 0.232500, 0.282500, 0.430000, 0.450000, 0.600000, 0.497500, 0.582500, 0.460000, 0.495000, 0.475000, 0.522500, 0.562500, 0.550000, 0.562500
#
# -0.070000, -0.077500, -0.147500, -0.082500, -0.085000, 0.082500, 0.225000, 0.307500, 0.327500, 0.250000, 0.260000, 0.275000, 0.310000, 0.455000, 0.497500, 0.550000, 0.577500, 0.555000, 0.437500, 0.482500, 0.440000, 0.527500, 0.555000, 0.635000, 0.557500
## -0.080000, -0.075000, -0.130000, -0.127500, -0.032500, -0.142500, 0.200000, 0.312500, 0.325000, 0.315000, 0.285000, 0.232500, 0.310000, 0.405000, 0.537500, 0.522500, 0.610000, 0.557500, 0.472500, 0.445000, 0.472500, 0.555000, 0.607500, 0.622500, 0.550000
#
# -0.032500, -0.040000, -0.122500, -0.082500, 0.000000, 0.122500, 0.237500, 0.312500, 0.112500, 0.285000, 0.230000, 0.247500, 0.290000, 0.425000, 0.547500, 0.607500, 0.582500, 0.577500, 0.517500, 0.497500, 0.487500, 0.545000, 0.617500, 0.430000, 0.605000
## -0.095000, -0.012500, -0.022500, -0.005000, -0.012500, 0.122500, 0.205000, 0.320000, 0.350000, 0.305000, 0.200000, 0.295000, 0.280000, 0.315000, 0.557500, 0.595000, 0.562500, 0.547500, 0.462500, 0.422500, 0.467500, 0.442500, 0.620000, 0.547500, 0.630000
#
# -0.042500, -0.087500, -0.210000, -0.067500, 0.032500, 0.130000, 0.242500, 0.315000, 0.320000, 0.310000, 0.312500, 0.160000, 0.320000, 0.422500, 0.515000, 0.600000, 0.632500, 0.477500, 0.555000, 0.430000, 0.480000, 0.537500, 0.617500, 0.645000, 0.530000
## -0.010000, -0.037500, -0.065000, -0.127500, 0.000000, 0.120000, 0.245000, 0.315000, 0.360000, 0.332500, 0.322500, 0.252500, 0.325000, 0.445000, 0.560000, 0.275000, 0.637500, 0.570000, 0.517500, 0.427500, 0.522500, 0.627500, 0.685000, 0.642500, 0.545000
#
# 0.005000, -0.082500, -0.040000, -0.370000, 0.035000, 0.167500, 0.227500, 0.275000, 0.232500, 0.355000, 0.315000, 0.265000, 0.385000, 0.480000, -0.070000, 0.590000, 0.655000, 0.610000, 0.470000, 0.470000, 0.552500, 0.597500, 0.670000, 0.660000, 0.667500
## -0.077500, -0.140000, -0.077500, -0.077500, -0.042500, 0.157500, 0.282500, 0.267500, 0.385000, 0.377500, 0.237500, 0.355000, 0.385000, 0.487500, 0.592500, 0.672500, 0.550000, 0.535000, 0.520000, 0.485000, 0.517500, 0.552500, 0.582500, 0.565000, 0.625000
#
# -0.085000, -0.182500, -0.122500, -0.085000, 0.075000, 0.190000, 0.272500, 0.375000, 0.307500, 0.400000, 0.225000, 0.262500, 0.407500, 0.517500, 0.472500, 0.677500, 0.647500, 0.557500, 0.560000, 0.497500, 0.550000, 0.595000, 0.632500, 0.707500, 0.680000
## -0.085000, -0.172500, -0.072500, -0.087500, 0.082500, 0.167500, 0.330000, 0.355000, 0.437500, 0.390000, 0.392500, 0.325000, 0.437500, 0.530000, 0.517500, 0.722500, 0.692500, 0.500000, 0.565000, 0.550000, 0.562500, 0.590000, 0.685000, 0.722500, 0.532500
#
# -0.005000, -0.402500, -0.020000, 0.030000, 0.042500, 0.195000, 0.285000, 0.387500, 0.432500, 0.417500, 0.407500, 0.397500, 0.392500, 0.272500, 0.567500, 0.685000, 0.725000, 0.622500, 0.562500, 0.572500, 0.605000, 0.705000, 0.682500, 0.585000, 0.640000
## 0.035000, 0.002500, -0.002500, -0.047500, 0.080000, 0.127500, 0.325000, 0.440000, 0.470000, 0.407500, 0.392500, 0.432500, 0.472500, 0.555000, 0.680000, 0.720000, 0.717500, 0.670000, 0.650000, 0.590000, 0.607500, 0.670000, 0.715000, 0.757500, 0.687500
#
# -0.005000, -0.035000, 0.002500, -0.002500, -0.005000, 0.220000, 0.325000, 0.432500, 0.480000, 0.440000, 0.440000, 0.380000, 0.480000, 0.582500, 0.567500, 0.727500, 0.755000, 0.695000, 0.675000, 0.547500, 0.582500, 0.627500, 0.727500, 0.775000, 0.765000
## -0.047500, -0.042500, -0.040000, 0.035000, 0.037500, 0.215000, 0.292500, 0.435000, 0.477500, 0.455000, 0.380000, 0.357500, 0.440000, 0.562500, 0.700000, 0.712500, 0.727500, 0.637500, 0.602500, 0.550000, 0.602500, 0.672500, 0.597500, 0.757500, 0.710000
#
# -0.005000, 0.007500, -0.080000, -0.165000, 0.120000, 0.245000, 0.342500, 0.432500, 0.485000, 0.475000, 0.397500, 0.400000, 0.477500, 0.605000, 0.687500, 0.705000, 0.705000, 0.557500, 0.667500, 0.637500, 0.627500, 0.637500, 0.722500, 0.755000, 0.722500
## -1.887500, 0.032500, -0.027500, 0.002500, 0.037500, 0.157500, 0.290000, 0.395000, 0.397500, 0.400000, 0.440000, 0.475000, 0.440000, 0.597500, 0.672500, 0.702500, 0.715000, 0.717500, 0.625000, 0.637500, 0.590000, 0.710000, 0.630000, 0.755000, 0.795000
#
# x_count = 25
## y_count = 25
#
# mesh_x_pps = 2
## mesh_y_pps = 2
#
# algo = bicubic
## tension = 0.2
#
# min_x = 15.0
## max_x = 229.8
#
# min_y = 15.0
#*# max_y = 229.8

@ChipCE
Copy link
Author

ChipCE commented Oct 21, 2023

@Shaneweston seem like you use the wrong version of the post processcing script.

use this https://raw.githubusercontent.com/ChipCE/Slicer-profile/master/cura-slicer/scripts/KlipperPrintArea.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment