Only probe where the part will be printed
-
@owend I think I figured it out but I’m getting a error massage: unknown variable ‘global.minprobex’
-
@ratrig0331
You need to put this line in config.g in place of your normal M557M98 P"0:/sys/setDefaultProbePoints.g"
Then set all your default probe settings in the areas at the start of the macro.
In superslicer put all the code provided in your start gcode
-
@owend said in Only probe where the part will be printed:
set global.minProbeX = {first_layer_print_min[0]} set global.maxProbeX = {first_layer_print_max[0]} set global.minProbeY = {first_layer_print_min[1]} set global.maxProbeY = {first_layer_print_max[1]} T[current_extruder] ; select tool M568 P[current_extruder] R{"{heat.coldExtrudeTemperature+5}"} S[first_layer_temperature_0] A1 ; (set extruder to stanby to soften any protruding filament before probing ) M106 P[current_extruder] S0 ;Start with fan off
You appear to be using a mixture of { } and [ ] to surround named values that you want PrusaSlicer to substitute for. Which is correct?
-
@dc42
The square brackets are legacy place holders, so should probably be replaced by curly brackets.
I just tried changing them all to curly brackets.
However in Superslicer at least, [first_layer_temperature_0] only seems to work with a square bracket.EDIT
It seems things like [first_layer_temperature_0] have been replaced by {first_layer_temperature[0]}I've revised the start Gcode related to probing to this (there are of course other commands need in the start code)
set global.minProbeX = {first_layer_print_min[0]} set global.maxProbeX = {first_layer_print_max[0]} set global.minProbeY = {first_layer_print_min[1]} set global.maxProbeY = {first_layer_print_max[1]} T{current_extruder} ; select tool 1 M568 P{current_extruder} R{"{heat.coldExtrudeTemperature+5}"} S{first_layer_temperature[current_extruder]} A1 ; (set extruder to stanby to soften any protruding filament before probing ) M106 P{current_extruder} S0 ;Start with fan off M140 S{first_layer_bed_temperature[current_extruder]} R{bed_temperature[0]-20}; Set fast bed temp & standby - Standby is 20 degrees less than normal. M116 ; Wait for bed before doing mesh probe. M561 ; clear any bed transform G29 ; do mesh for printed area G29 S1 ; load small mesh G01 X0 Y{"{move.axes{1}.max}"} Z0.6 F1500 ; Move to back corner while heating 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
-
@owend when I restart I get this
Error: (sensors.probes[0].offsets[0] + var.SafeZone)array index out of bounds of setDefaultProbePoints.g
And if I try to start a print I get this
Error: unknown variable 'global.minProbeX'
-
@ratrig0331 have you opened the GCode file in a text editor, to see what the slicer has actually generated?
-
@dc42 not yet I’ll take a look
-
@dc42 it looks like its all there in the gcode
; external perimeters extrusion width = 0.40mm
; perimeters extrusion width = 0.40mm
; infill extrusion width = 0.40mm
; solid infill extrusion width = 0.40mm
; top infill extrusion width = 0.40mm
; first layer extrusion width = 0.45mmM73 P0 R8
M107
M104 S205 ; set temperature
;TYPE:Custom
set global.minProbeX = 183.982
set global.maxProbeX = 316.018
set global.minProbeY = 188.982
set global.maxProbeY = 311.018
T0 ; select tool 1
M568 P0 R{heat.coldExtrudeTemperature+5} S205 A1 ; (set extruder to stanby to soften any protruding filament before probing )
M106 P0 S0 ;Start with fan off
M140 S68 R45; Set fast bed temp & standby - Standby is 20 degrees less than normal.
M116 ; Wait for bed before doing mesh probe.
M561 ; clear any bed transform
G29 ; do mesh for printed area
G29 S1 ; load small mesh
G01 X0 Y{move.axes{1}.max} Z0.6 F1500 ; Move to back corner while heating
M568 P0 R{heat.coldExtrudeTemperature+5} S205 A2 ; (set standby and active temperatures for active tool. Standby is 5 degrees above cold extrude temp )
M116 ; Wait for all temps to stabilise
M109 S205 ; set temperature and wait for it to be reached
G21 ; set units to millimeters
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion
; Filament gcode
SET_GCODE_OFFSET Z=0
SET_PRESSURE_ADVANCE ADVANCE=0.05
M107
;LAYER_CHANGE
;Z:0.2
;HEIGHT:0.2
;BEFORE_LAYER_CHANGE
;0.2
G92 E0
;this is what i changed in the mesh.g for my 500x500mm xycore
;0:/sys/mesh.g
; run when G29 with no paramters is called.
; if this file not found G29 S0 will run
var m557MinX = 25; ; put your default here
var m557MaxX = 450; ; put your default here
var m557MinY = 25; ; put your default here
var m557MaxY = 450; ; put your default here
var MinSpace = 10 ; put default minimum spacing
var MaxSpace = 30 ; put default maximum spacing
var ProbeNumX = 8 ; put default probe points
var ProbeNumY = 8 ; put default probe points.
var ProbeCenterX = 285 ; will be updated to probe centre of print
var ProbeCenterY = 270 ; will be updated to probe centre of printvar 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
var SafeZone = 3 ; safety margin for probing near edge. -
@ratrig0331
Sounds like it's not finding a sensors.probe[0] when you run the initial setup from config.g
As that line is at the start of the macro, it never gets to the lines that set the global variables up.
Make sure your probe is configured before calling the macro.
Maybe post you config.g so we can see how your probe(s) are configured -
-
-
@ratrig0331
Make sure
M98 P"0:/sys/setDefaultProbePoints.g"
Comes after your G31 in your BlTouch section -
@owend ok I’ll move it and give it a shot
-
@owend that did the trick but now i need to turn down the amount of probe points
var MinSpace = 10 ; put default minimum spacing
var MaxSpace = 30 ; put default maximum spacing
var ProbeNumX = 8 ; put default probe points
var ProbeNumY = 8 ; put default probe points.
var ProbeCenterX = 285 ; will be updated to probe centre of print
var ProbeCenterY = 270 ; will be updated to probe centre of printwith my 100x100mm print its trying to do a 13x13 grid what do i tweak to lower that?
-
@owend ok after letting it 100% there were more errors
8/14/2022, 10:15:03 PM Error: M557: bad grid definition: Spacing too small
8/14/2022, 10:14:19 PM Error: in GCode file line 773: G1: expected '}'line 773 is your
G01 X0 Y{move.axes{1}.max} Z0.6 F1500 ; Move to back corner while heating -
@ratrig0331
Change your minSpace and maxSpace in the macro to reduce number of probe points
Try 50 & 100The G1 is my bad
I did a search and replace when I was changing the braces, but changed one that should remain a square bracketChange this line in superslicer
G01 X0 Y{"{move.axes{1}.max}"} Z0.6 F1500 ; Move to back corner while heating
To
G01 X0 Y{"{move.axes[1].max}"} Z0.6 F1500 ; Move to back corner while heatingOr delete the line if you don't want to move there while heating
-
One down one to go I’m still getting the m557 error with the 50/100 spacing will this be normal a normal error from down sizing the bed mesh or is there a fix
Error: M557: bad grid definition: Spacing too small
——-Error: in GCode file line 773: G1: expected '}'———- is now fixed
-
@ratrig0331 the most probe points you can have on a duet 2 are 121 and on a duet 3 are 441
-
@jay_s_uk too many points isn’t the issue I think, it must be too few points? With the settings first told to me it wanted to do a 13x12 grid on a 100mmx100mm print 156 points total, than I changed the min max to 50/100 and it only probed the middle and 4 conners and gave the same error
-
I believe the problem you are having is that I didn't allow for a probe that was offset to the other side of the extruder to mine.
Try these files.
I think it should sort it out.;setDefaultProbePoints.g - to be called from config.g after Z probe configuration section and any time defaults need to be reset. var SafeZone = 10 ; probing won't be done closer than this amount from bed edge - adjust as required var defaultProbeSpacing = 50 ; default mesh grid spacing in mm - adjust as required ; shouldn't need to edit after here var MinReachableX = max(0,sensors.probes[0].offsets[0]) + var.SafeZone var MaxReachabeX = move.axes[0].max - abs(sensors.probes[0].offsets[0]) - var.SafeZone var MinReachableY = max(0,sensors.probes[0].offsets[1]) + var.SafeZone var MaxReachabeY = move.axes[1].max - abs(sensors.probes[0].offsets[1]) - var.SafeZone M557 X{var.MinReachableX,var.MaxReachabeX} Y{var.MinReachableY,var.MaxReachabeY} S{var.defaultProbeSpacing}; define mesh grid ;echo "M557 X"^{var.MinReachableX}^","^{var.MaxReachabeX}, "Y"^{var.MinReachableY}^","^{var.MaxReachabeY}, "S"^{var.defaultProbeSpacing} if !exists(global.minProbeX) global minProbeX = move.compensation.probeGrid.mins[0] else set global.minProbeX = move.compensation.probeGrid.mins[0] if !exists(global.minProbeY) global minProbeY = move.compensation.probeGrid.mins[1] else set global.minProbeY = move.compensation.probeGrid.mins[1] if !exists(global.maxProbeX) global maxProbeX = move.compensation.probeGrid.maxs[0] else set global.maxProbeX = move.compensation.probeGrid.maxs[0] if !exists(global.maxProbeY) global maxProbeY = move.compensation.probeGrid.maxs[1] else set global.maxProbeX = move.compensation.probeGrid.maxs[1]
revised 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" ;check state of heaters var bedState = heat.heaters[0].state var bedActiveTemp = heat.heaters[0].active var bedStandbyTemp = heat.heaters[0].standby var nozzleState = heat.heaters[1].state M140 P0 S-276 ; turn off bed heater M568 P0 A0 ; turn off nozzle heater ; 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 ; turn the heaters back on if needed if var.bedState != "off" M140 S{var.bedActiveTemp} R{var.bedStandbyTemp} if var.bedState="active" M144 P0 S1 ; put bed on active temp else M144 P0 S0 ; put bed on standby temp if var.nozzleState != "off" if var.nozzleState = "active" M568 P0 A2 ; set nozzle to active else M568 P0 A1 ; set nozzle to standby