Only probe where the part will be printed
-
@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
-
-