Only probe where the part will be printed
-
@dc42
Roger that..
That makes that section of code superfluous.
Does it turn off the bed heater as well? -
@ratrig0331 said in Only probe where the part will be printed:
You can remove these lines in your slicer as you have set your temps elsewhere in your start code.
M568 P{current_extruder} R{"{heat.coldExtrudeTemperature+5}"} S{first_layer_temperature[current_extruder]} A2 ; (set standby and active temperatures for active tool. Standby is 5 degrees above cold extrude temp ) M116 ; Wait for all temps to stabilise
This version removes all the code related to heating from mesh.g
;0:/sys/mesh.g ; run when G29 with no paramters is called. ; if this file not found G29 S0 will run var SafeZone = 3 ; safety margin for probing near edge. var MinSpace = 20 ; put default minimum spacing var MaxSpace = 60 ; put default maximum spacing ; these values are place holders aand will be calculated later var m557MinX = 40; ; put your default here var m557MaxX = 180; ; put your default here var m557MinY = 20; ; put your default here var m557MaxY = 180; ; put your default here var ProbeCenterX = 90 ; will be updated to probe centre of print var ProbeCenterY = 90 ; will be updated to probe centre of print var ProbeNumX = 8 ; put default number of probe points var ProbeNumY = 8 ; put default number probe points. var MaxProbePoints = max(floor(move.axes[0].max / var.MaxSpace),floor(move.axes[1].max / var.MaxSpace)) ; maximum points in either axis ;echo "Maximum allowed probe points is " ^ var.MaxProbePoints ^ " using max space of " ^ var.MaxSpace if exists(global.minProbeX) if global.minProbeX < max(0,sensors.probes[0].offsets[0]) + var.SafeZone echo "minProbeX (" ^ global.minProbeX ^ ") unreachable - reset to " ^ (sensors.probes[0].offsets[0] + var.SafeZone) set global.minProbeX = max(0,sensors.probes[0].offsets[0]) + var.SafeZone set var.m557MinX = global.minProbeX if exists(global.maxProbeX) if global.maxProbeX < (global.minProbeX + (var.MinSpace*2)) set global.maxProbeX = (global.minProbeX + (var.MinSpace*2)) if global.maxProbeX > (move.axes[0].max - abs(sensors.probes[0].offsets[0]) - var.SafeZone) echo "maxProbeX (" ^ global.maxProbeX ^ ") unreachable - reset to " ^ (move.axes[0].max - sensors.probes[0].offsets[0] - var.SafeZone) set global.maxProbeX = move.axes[0].max - abs(sensors.probes[0].offsets[0]) - var.SafeZone set var.m557MaxX = global.maxProbeX if exists(global.minProbeY) if global.minProbeY < max(0,sensors.probes[0].offsets[1]) + var.SafeZone echo "minProbeY (" ^ global.minProbeY ^ ") unreachable - reset to " ^ (sensors.probes[0].offsets[1] + var.SafeZone) set global.minProbeY = max(0,sensors.probes[0].offsets[1]) + var.SafeZone set var.m557MinY = global.minProbeY if exists(global.maxProbeY) if global.maxProbeY < (global.minProbeY + (var.MinSpace*2)) set global.maxProbeY = (global.minProbeY + (var.MinSpace*2)) if global.maxProbeY > (move.axes[1].max - abs(sensors.probes[0].offsets[1]) - var.SafeZone) echo "maxProbeY (" ^ global.maxProbeY ^ ") unreachable - reset to " ^ (move.axes[1].max - sensors.probes[0].offsets[1] - var.SafeZone) set global.maxProbeY = (move.axes[1].max - abs(sensors.probes[0].offsets[1]) - var.SafeZone) set var.m557MaxY = global.maxProbeY echo "Probing grid - X" ^ var.m557MinX ^ ":" ^ var.m557MaxX ^ " Y" ^ var.m557MinY ^ ":" ^ var.m557MaxY var MinProbesX = floor((var.m557MaxX - var.m557MinX) / var.MaxSpace) ;echo "Min Probes X is " ^ var.MinProbesX var MaxProbesX = floor((var.m557MaxX - var.m557MinX) / var.MinSpace) ;echo "Max Probes X is " ^ var.MaxProbesX set var.ProbeNumX = min(var.MaxProbePoints,var.MaxProbesX) var MinProbesY = floor((var.m557MaxY - var.m557MinY) / var.MaxSpace) ;echo "Min Probes Y is " ^ var.MinProbesY var MaxProbesY = floor((var.m557MaxY - var.m557MinY) / var.MinSpace) ;echo "Max Probes Y is " ^ var.MaxProbesY set var.ProbeNumY = min(var.MaxProbePoints,var.MaxProbesY) ; sanity check probe points if var.ProbeNumX<2 set var.ProbeNumX=2 if var.ProbeNumY<2 set var.ProbeNumY=2 if var.ProbeNumX > var.MaxProbePoints set var.ProbeNumX = var.MaxProbePoints if var.ProbeNumY > var.MaxProbePoints set var.ProbeNumY = var.MaxProbePoints if (var.ProbeNumX * var.ProbeNumY) > 441 if var.ProbeNumX > 21 set var.ProbeNumX = 21 echo "Too many X points - reduced to 21" if var.ProbeNumY > 21 set var.ProbeNumY = 21 echo "Too many Y points - reduced to 21" echo "Probing " ^ var.ProbeNumX ^ " points in X direction & " ^ var.ProbeNumY ^ " points in Y direction" ; do probing set var.ProbeCenterX = (global.maxProbeX - ((global.maxProbeX - global.minProbeX)/2)) ; calculate centre point of probe area set var.ProbeCenterY = (global.maxProbeY - ((global.maxProbeY - global.minProbeY)/2)) ; calculate centre point of probe area echo "Setting Z datum point at X" ^ var.ProbeCenterX ^ " Y" ^ var.ProbeCenterY ; set Z = 0 to centre of probe area G1 X{var.ProbeCenterX- sensors.probes[0].offsets[0]} Y{var.ProbeCenterY- sensors.probes[0].offsets[1]} Z{sensors.probes[0].diveHeight+2} F3600 G30 echo "Mesh probing" M557 X{var.m557MinX,var.m557MaxX} Y{var.m557MinY,var.m557MaxY} P{var.ProbeNumX,var.ProbeNumY} if result != 0 abort "ERROR: could not create mesh" else G29 S0 if result != 0 abort "ERROR: Mesh probing failed" else echo "Mesh probing successful. Loading mesh.." ; set Z = 0 to centre of probe area echo "Reset Z datum in mesh centre" G1 X{var.ProbeCenterX - sensors.probes[0].offsets[0]} Y{var.ProbeCenterY - sensors.probes[0].offsets[1]} Z{sensors.probes[0].diveHeight+2} F3600 G30
-
While I was thinking about how to make these macros "universal" to suit all sorts of configurations, it occurred to me that they had, over time, grown ever more complicated with little benefit.
Bed sizes and the probe positions don't tend to change after all.I have therefore decided to simplify things.
I still call "setDefaultProbePoints.g" from config.g and anywhere else I might want to set the mesh for the entire bed.
Rather than me trying to calculate the area that can be probed, you just enter your M557 just as you would normally do in config.g;setDefaultProbePoints.g M557 X10:470 Y10:470 P6 ; set values as you would normally do in config.g
In superslicer, rather than call G29, I call mesh.g using M98, but pass the parameters for the min/max print values and the distance between probe points
A=xMin of print area
B=xMax of print area
C=yMin of print area
D=yMax of print area
N=distance between probe points (equivalent to S parameter in M557)M98 P"0:/sys/mesh.g" A{first_layer_print_min[0]} B{first_layer_print_max[0]} C{first_layer_print_min[1]} D{first_layer_print_max[1]} N30 ; set N to your desired distance between points G29 S1 ; load small mesh
In mesh.g I check if all those parameters have been passed.
If they have, I do the small mesh.
If they haven't I reload the defaults and probe the full bed.
Therefore if you send G29 or select mesh probing in DWC it will do the entire bed even if you forget to reset the defaults.;mesh.g M98 P"setDefaultProbePoints.g" if (exists(param.A) && exists(param.B) && exists(param.C) && exists(param.D) && exists(param.N)) M557 X{max(move.compensation.probeGrid.mins[0],param.A),min(move.compensation.probeGrid.maxs[0],param.B)} Y{max(move.compensation.probeGrid.mins[1],param.C),min(move.compensation.probeGrid.maxs[1] ,param.D)} S{param.N} if result != 0 abort "Invalid M557 parameters" G29 S0
If you wanted to set the number of probe points rather than the distance between them just change
S{param.N}
toP{param.N}
in the M557 line in mesh.g -
This might be useful: https://forum.duet3d.com/topic/29647/you-down-with-opp-oozebot-post-processor
-
@owend said in Only probe where the part will be printed:
@dc42
Roger that..
That makes that section of code superfluous.
Does it turn off the bed heater as well?Yes, it turns all heaters off. In the past it's been the bed heater that causes most of the problems for Z probes, however I suspect that with Revo and similar hot ends the hot end heater might affect Z probes too because of the higher magnetic field they are likely to produce.
-
@owend I’m getting some mix results with the bed mesh either works out great or works out horrible with driving my nozzle right into the bed I don’t know is doing a 3 point axis bed level is messing with the bed mesh or the last z offset probe touch
-
@ratrig0331
There's nothing in the code which can cause intermittent faults such as that you describe.
The problem is either wiring related, electrical interference , or a faulty BlTouch.
You can check if the BlTouch is in an error state or already deployed using the object model, but this only serves to allow you to cancel the process.
You need to find the root cause.
You need to provide details of what is happening exactly. What lights are on the BlTouch. What messages appear in DWC
It's probably better to start a new thread. -
@owend I have a Theory to why it’s crashing. My 3 point bed leveling before the new smaller mesh on my 500x500mm bed is just too much of a difference from the outter most points of the bed level to the new inner smaller point bed mesh. I manually moved the three probe points much closer the the center and the mesh looks quite a bit better as well as flatter with less extreams. My z changed quite a bit with this new bed level as well by almost .45mm.
Is there a way to auto ajust the bed level points to be in the same area of the auto bed mesh?
-
What you're describing doesn't sound right to me.
I suggest you study this page
https://docs.duet3d.com/User_manual/Connecting_hardware/Z_probe_auto_levelling
To get your 3 point levelling right.
The probe points must be near the lead screws. -
@owend changing my bed.g to this seems to have helped
M561 ; clear any bed transform
G30 P0 X10 Y30 Z-99999 ; probe near leadscrew 1
G30 P1 X60 Y80 Z-99999 ; probe near leadscrew 1
G30 P2 X110 Y130 Z-99999 ; probe near leadscrew 1
G30 P3 X160 Y180 Z-99999 ; probe near leadscrew 1
G30 P4 X240 Y480 Z-99999 ; probe near leadscrew 2
G30 P5 X240 Y430 Z-99999 ; probe near leadscrew 2
G30 P6 X240 Y380 Z-99999 ; probe near leadscrew 2
G30 P7 X240 Y330 Z-99999 ; probe near leadscrew 2
G30 P8 X470 Y30 Z-99999 ; probe near leadscrew 3
G30 P9 X420 Y80 Z-99999 ; probe near leadscrew 3
G30 P10 X370 Y130 Z-99999 ; probe near leadscrew 3
G30 P11 X320 Y180 Z-99999 S3 ; probe near leadscrew 3 and calibrate 3 motorsM280 P0 S160 ; clear and reset BL touch
G1 Z10 F300
G29 S1 ; probe the bed and enable compensation -
@OwenD so I had things working well with your help last using a bl touch I switched to a euclid probe and I started having odd issues all I did was add probe undock at the start and dock at the end. When I run a g29 out of program for the default bed mesh it gets the probe moves to bed center pauses than starts to move to the right rear corner well coming up with the bed driving it into the probe giving it a false trigger that going down to the front left corner and starts to bed mesh as it should. The new probe location is center on x from the nozzle and 35mm behind it on y. This seems to be the last bug I need to fix before I can test run a print. I debuged g28, homez, and my auto teach nozzle offset macro, I just need to fix the auto mesh
-
@RatRig0331
I suggest you start a new thread and post all the related files
config.g
bed.g
mesh.g
start.gI have no experience with a Euclid probe but it sounds like something isn't configured correctly
-
@OwenD i think i kinda figured it out i changed a few things in your mesh.g, it still acts odd at the end but it works without crashing the probe now. after the mesh it wants to go to the center of the bed, than dock the probe, than center of the bed, than undock the probe, than probe datum z, than dock the probe.
; set Z = 0 to centre of probe area
; echo "Call deployprobe.g macro"
M401 P0 ; This runs macro file deployprobe
G1 X{var.ProbeCenterX- sensors.probes[0].offsets[0]} Y{var.ProbeCenterY- sensors.probes[0].offsets[1]} Z{sensors.probes[0].diveHeight+5} F600
G30
echo "Mesh probing"
M557 X{var.m557MinX,var.m557MaxX} Y{var.m557MinY,var.m557MaxY} P{var.ProbeNumX,var.ProbeNumY} F9000
if result != 0
abort "ERROR: could not create mesh"
else
G29 S0
if result != 0
abort "ERROR: Mesh probing failed"
else
echo "Mesh probing successful. Loading mesh.."
G1 H2 Z30 F2000 ; lift Z relative to current position to clear any obstructions
; set Z = 0 to centre of probe area
echo "Reset Z datum in mesh centre"
G1 X{var.ProbeCenterX - sensors.probes[0].offsets[0]} Y{var.ProbeCenterY - sensors.probes[0].offsets[1]} Z{sensors.probes[0].diveHeight+5} F600
G1 H2 Z30 F2000 ; lift Z relative to current position to clear any obstructions
; echo "Call retractprobe.g macro"
M402 P0 ; retract probe
G30 -
@RatRig0331 I suggest you put the final G30 command before the M402 command to avoid the extra docking/undocking.
-
So I have created a solution for this which will work on the V-core3 but should also work on any other printers
What I've done is create a separate macro for it so you can leave your mesh.g as is to allow you to also probe the entire bed if you want to.
The macro will change the probing settings and restore them after having done so.
To start off create a new file called
print_area_mesh.g
and paste the following in the newly created file; This command will only create a mesh of the print area ; This will reduce the printing time considerably by only probing what is needed var deviationFromOriginal = 20 var probeGridMinX = move.compensation.probeGrid.mins[0] var probeGridMaxX = move.compensation.probeGrid.maxs[0] var probeGridMinY = move.compensation.probeGrid.mins[1] var probeGridMaxY = move.compensation.probeGrid.maxs[1] var pamMinX = {var.probeGridMinX} ; Default the pamMinX value to the min x that is set for the mesh in M557. Originally coming from sys/printer_size_config.g var pamMaxX = {var.probeGridMaxX} ; Default the pamMaxX value to the min x that is set for the mesh in M557. Originally coming from sys/printer_size_config.g var pamMinY = {var.probeGridMinY} ; Default the pamMinY value to the min x that is set for the mesh in M557. Originally coming from sys/printer_size_config.g var pamMaxY = {var.probeGridMaxY} ; Default the pamMaxY value to the min x that is set for the mesh in M557. Originally coming from sys/printer_size_config.g var meshSpacing = {move.compensation.probeGrid.spacings[0]} ; Grabbing the spacing of the current M557 settings var minMeshPoints = 3 ; The minimal amount of probing points for both X & Y. var maxMeshPoints = 10 ; The max amount of probing points for both X & Y if exists(param.A) set var.pamMinX = {param.A} ; The min X position of the print job if exists(param.B) set var.pamMaxX = {param.B} ; The max X position of the print job if exists(param.C) set var.pamMinY = {param.C} ; The min Y position of the print job if exists(param.D) set var.pamMaxY = {param.D} ; The max Y position of the print job if (var.probeGridMinX + var.deviationFromOriginal) >= var.pamMinX ; Check if the difference between the min X and the print job min X is smaller than the set deviation set var.pamMinX = {var.probeGridMinX} ; The difference is smaller than the set deviation so set minX to the minimal of the printer's X if (var.probeGridMaxX - var.deviationFromOriginal) <= var.pamMaxX ; Check if the difference between the max X and the print job max X is smaller than the set devation set var.pamMaxX = {var.probeGridMaxX} ; The difference is smaller than the set devation so set maxX to the max of the printer's X if (var.probeGridMinY + var.deviationFromOriginal) >= var.pamMinY ; Check if the difference between the min Y and the print job min Y is smaller than the set devation set var.pamMinY = {var.probeGridMinY} ; the difference is smaller than the set devation so set minY to the minimal of the printer's Y if (var.probeGridMaxY - var.deviationFromOriginal) <= var.pamMaxY ; Check if the difference between the max X and the print job max X is smaller than the set devation set var.pamMaxY = {var.probeGridMaxY} ; The difference is smaller than the set devation so set maxY to the max of the printer's Y var meshX = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxX - var.pamMinX) / var.meshSpacing) + 1))) ; Get the number of probes for X taking minMeshPoints and maxMeshPoints into account var meshY = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxY - var.pamMinY) / var.meshSpacing) + 1))) ; Get the number of probes for Y taking minMeshPoints and maxMeshPoints into account var consoleMessage = "Set probe grid to use X-min: " ^ var.pamMinX ^ "; X-max: " ^ var.pamMaxX ^ "; Y-min: " ^ var.pamMinY ^ "; Y-max: " ^ var.pamMaxY "; Probing points: " ^ var.meshX ^ ";" ^ var.meshY ; Set the console message M118 P2 S{var.consoleMessage} ; send used probe grid to paneldue M118 P3 S{var.consoleMessage} ; send average to DWC console M557 X{var.pamMinX, var.pamMaxX} Y{var.pamMinY, var.pamMaxY} P{var.meshX, var.meshY} ; Set the probing mesh G0 X{var.pamMinX + ((var.pamMaxX - var.pamMinX)/2) - sensors.probes[0].offsets[0]} Y{var.pamMinY + ((var.pamMaxY - var.pamMinY)/2) - sensors.probes[0].offsets[1]} ; Move to the center of the print area G30 ; Set the z height for the center of the print area G29 ; Probe the print area ; Restore the probing mesh to the original settings set var.meshX = floor((var.probeGridMaxX - var.probeGridMinX) / var.meshSpacing + 1) set var.meshY = floor((var.probeGridMaxY - var.probeGridMinY) / var.meshSpacing + 1) M557 X{var.probeGridMinX, var.probeGridMaxX} Y{var.probeGridMinY, var.probeGridMaxY} P{var.meshX, var.meshY}
The script has a few things you could change if you wanted to like the minimum&maximum probe points to use and when it should just probe the entire bed or when it should probe the specified print area. this is what the
deviationFromOriginal
variable is forNow on to how to use it.
in your slicer find the custom g-code section and specifically the custom print start g-code section.In there make the following changes (based on slicer you are using) IMPORTANT, remove any G29 calls by replacing it with the command below
PrusaSlicer/SuperSlicer
M98 P"sys/print_area_mesh.g" A{first_layer_print_min[0]} B{first_layer_print_max[0]} C{first_layer_print_min[1]} D{first_layer_print_max[1]}
Ideamaker
M98 P"sys/print_area_mesh.g" A{print_pos_min_x} B{print_pos_max_x} C{print_pos_min_y} D{print_pos_max_y}
Cura
M98 P"sys/print_area_mesh.g" A%MINX% B%MAXX% C%MINY% D%MAXY%
To make cura work some additional steps are needed which can be found in the repo here:
https://github.com/MaikoHermans/RRF-PAMin general any updates I'll make can be found in the repo
EDIT: 16-11-22
Updated the script a bit. changes:- Removed echo's and opted for M118 instead
- Probing center of print area before creating mesh
-
Great work you've done here, i've adapted your script a little bit. And made the adaptive probing something one can turn on/off by a variable.
I've also opted to define the X/Y min/max with globals rather than parameters and local variables since these also get used in a adpative purging script i've made.
; /sys/print/print_a_mesh.g (v1.1) ; Called when "M98 P"/sys/lib/print/print_a_mesh.g" is sent ; Used to probe a new bed mesh at the start of a print ;-------------------------------------------------------------------------------------------------------------------------------------- ; This macro will only create a mesh of the print area, if the criteria are met ; This will reduce the printing time considerably by only probing what is needed ; For successful adaptive purging, you may need to configure: ; Declare global.Adpative_Probing,and set it true ; Declared globals for X/Y min/max, and have these to defined in your slicer ;-------------------------------------------------------------------------------------------------------------------------------------- ; ====================--------------------------------------------------------- ; Settings for adaptive mesh ; ==================== ; Minimum deviation from default mesh var deviationFromOriginal = 20 ; The minimum deviation between the default mesh points before an adaptive mesh is generated. ; Probing points for adaptive mesh var minMeshPoints = 3 ; The minimum amount of probing points for both X & Y. var maxMeshPoints = 10 ; The maximum amount of probing points for both X & Y ; ====================--------------------------------------------------------- ; Setup default probing area ; ==================== ; Grab default probing grid var m557MinX = move.compensation.probeGrid.mins[0] ; grabs your default x min var m557MaxX = move.compensation.probeGrid.maxs[0] ; grabs your default x max var m557MinY = move.compensation.probeGrid.mins[1] ; grabs your default y min var m557MaxY = move.compensation.probeGrid.maxs[1] ; grabs your default y max ; Grab the default mesh spacing var meshSpacing_X = {move.compensation.probeGrid.spacings[0]} ; Grabbing the spacing of the current M557 settings var meshSpacing_Y = {move.compensation.probeGrid.spacings[1]} ; Grabbing the spacing of the current M557 settings ; Define a variable to represent the min/max mesh coordinates var pamMinX = {var.m557MinX} ; Default the pamMinX value to the min x that is set for the mesh in M557 var pamMaxX = {var.m557MaxX} ; Default the pamMaxX value to the min x that is set for the mesh in M557 var pamMinY = {var.m557MinY} ; Default the pamMinY value to the min x that is set for the mesh in M557 var pamMaxY = {var.m557MaxY} ; Default the pamMaxY value to the min x that is set for the mesh in M557 ; ====================--------------------------------------------------------- ; Setup print area ; ==================== ; Check if global.Adaptive_Probing is defined and true if exists(global.Adaptive_Probing) if global.Adaptive_Probing ; Check that the print area has been defined or not if global.minPrintX = "N/A" || global.maxPrintX = "N/A" || global.minPrintY = "N/A" || global.maxPrintY = "N/A" echo "Adaptive probing grid not correctly defined" var something_wrong = true var consoleMessage = "Print area not correctly defined, default probing mesh will be used!" ; Set the console message ; With the print area defined grab the coordinates else set var.pamMinX = global.minPrintX ; The min X position of the print job set var.pamMaxX = global.maxPrintX ; The max X position of the print job set var.pamMinY = global.minPrintY ; The min Y position of the print job set var.pamMaxY = global.maxPrintY ; The max Y position of the print job else var consoleMessage = "Adaptive mesh disabled!" ; Set the console message var disabled = true else var something_wrong = true echo "global.Adaptive_Probing not defined!" ; ====================--------------------------------------------------------- ; Check if adaptive mesh is needed ; ==================== if !exists(var.something_wrong) || !exists(var.disabled) ; Check if the print area is small enough to create an adaptive mesh if (var.m557MinX + var.deviationFromOriginal) >= var.pamMinX ; Check if the difference between the min X and the print job min X is smaller than the set deviation set var.pamMinX = {var.m557MinX} ; The difference is smaller than the set deviation so set minX to the minimal of the printer's X if (var.m557MaxX - var.deviationFromOriginal) <= var.pamMaxX ; Check if the difference between the max X and the print job max X is smaller than the set devation set var.pamMaxX = {var.m557MaxX} ; The difference is smaller than the set devation so set maxX to the max of the printer's X if (var.m557MinY + var.deviationFromOriginal) >= var.pamMinY ; Check if the difference between the min Y and the print job min Y is smaller than the set devation set var.pamMinY = {var.m557MinY} ; The difference is smaller than the set devation so set minY to the minimal of the printer's Y if (var.m557MaxY - var.deviationFromOriginal) <= var.pamMaxY ; Check if the difference between the max X and the print job max X is smaller than the set devation set var.pamMaxY = {var.m557MaxY} ; The difference is smaller than the set devation so set maxY to the max of the printer's Y ; Check if an adaptive mesh will be used or not if var.m557MinX = var.pamMinX && var.m557MaxX = var.pamMaxX && var.m557MinY = var.pamMinY && var.m557MaxY = var.pamMaxY var consoleMessage = "Print area bellow deviation threshold, default probing mesh will be used!" ; Set the console message var meshX = var.meshSpacing_X var meshY = var.meshSpacing_Y ; If a adaptive mesh will be used, do the final calculations else var meshX = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxX - var.pamMinX) / var.meshSpacing_X) + 1))) ; Get the number of probes for X taking minMeshPoints and maxMeshPoints into account var meshY = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxY - var.pamMinY) / var.meshSpacing_Y) + 1))) ; Get the number of probes for Y taking minMeshPoints and maxMeshPoints into account ; Inform of the Adaptive mesh that's been created var consoleMessage = "Adaptive probing mesh, X-min: " ^ var.pamMinX ^ "; X-max: " ^ var.pamMaxX ^ "; Y-min: " ^ var.pamMinY ^ "; Y-max: " ^ var.pamMaxY "; Probing points: " ^ var.meshX ^ ";" ^ var.meshY ; Set the console message ; Send message about what's going to happen M118 P2 S{var.consoleMessage} ; send used probe grid to paneldue M118 P3 S{var.consoleMessage} ; send average to DWC console ; ====================--------------------------------------------------------- ; Define mesh probing grid ; ==================== if !exists(var.something_wrong) || !exists(var.disabled) M557 X{var.pamMinX, var.pamMaxX} Y{var.pamMinY, var.pamMaxY} P{var.meshX, var.meshY} ; Set the probing mesh G0 X{var.pamMinX + ((var.pamMaxX - var.pamMinX)/2) - sensors.probes[0].offsets[0]} Y{var.pamMinY + ((var.pamMaxY - var.pamMinY)/2) - sensors.probes[0].offsets[1]} ; Move to the center of the print area G30 ; Set the z height for the center of the print area G29 ; Probe the print area if !exists(var.something_wrong) || !exists(var.disabled) ; Restore the probing mesh to the original settings set var.meshX = floor((var.m557MaxX - var.m557MinX) / var.meshSpacing_X + 1) set var.meshY = floor((var.m557MaxY - var.m557MinY) / var.meshSpacing_Y + 1) M557 X{var.m557MinX, var.m557MaxX} Y{var.m557MinY, var.m557MaxY} P{var.meshX, var.meshY}
I haven't had time to test this out yet though, since the printer is working atm!
If this works i plan to add another global to flat out turn on/off the probe before print feature totally.
-
Nice!
I've been using the script for about 2 weeks now and has been working perfectly for me so far.
So I hope it does for you as well! -
@mher
I bet it will once I iron out the bugs i've introduced Don't know if you're also encountering this, but one issue i keep having in several of the macros I make is that variables don't get declared / remebered. So I have started to declare all variables with placeholders early in the scripts. And set the values where its needed. Rather than declarinhmg and setning them at the same time if they get made -
-
-
@mher can you explain a little more about what deviationFromOriginal does? thanks in advance
-
-