Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Only probe where the part will be printed

    Scheduled Pinned Locked Moved
    General Discussion
    8
    51
    3.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dc42undefined
      dc42 administrators @OwenD
      last edited by dc42

      @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?

      Duet WiFi hardware designer and firmware engineer
      Please do not ask me for Duet support via PM or email, use the forum
      http://www.escher3d.com, https://miscsolutions.wordpress.com

      OwenDundefined 1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @dc42
        last edited by OwenD

        @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
        
        RatRig0331undefined 1 Reply Last reply Reply Quote 0
        • RatRig0331undefined
          RatRig0331 @OwenD
          last edited by

          @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'

          dc42undefined OwenDundefined 2 Replies Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators @RatRig0331
            last edited by

            @ratrig0331 have you opened the GCode file in a text editor, to see what the slicer has actually generated?

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            RatRig0331undefined 2 Replies Last reply Reply Quote 0
            • RatRig0331undefined
              RatRig0331 @dc42
              last edited by

              @dc42 not yet I’ll take a look

              1 Reply Last reply Reply Quote 0
              • RatRig0331undefined
                RatRig0331 @dc42
                last edited by

                @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.45mm

                M73 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 print

                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
                var SafeZone = 3 ; safety margin for probing near edge.

                1 Reply Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @RatRig0331
                  last edited by OwenD

                  @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

                  RatRig0331undefined 3 Replies Last reply Reply Quote 0
                  • RatRig0331undefined
                    RatRig0331 @OwenD
                    last edited by

                    @owend

                    ​
                    ;;; BLTouch ;;;
                    M950 S0 C"io2.out" ; Create a servo pin on io2
                    M558 P9 C"io2.in" H5 F240 T10800 A5 ; set Z probe type to unmodulated and the dive height + speeds
                    G31 P25 X-29.00 Y-2.00 Z2.471

                    OwenDundefined 1 Reply Last reply Reply Quote 0
                    • RatRig0331undefined
                      RatRig0331 @OwenD
                      last edited by

                      @owend

                      ​

                      ;;; Endstops ;;;
                      M574 X1 S1 P"io1.in" ; configure active high endstops
                      M574 Y2 S1 P"io0.in" ; configure active high endstops
                      M574 Z1 S2

                      1 Reply Last reply Reply Quote 0
                      • OwenDundefined
                        OwenD @RatRig0331
                        last edited by

                        @ratrig0331
                        Make sure
                        M98 P"0:/sys/setDefaultProbePoints.g"
                        Comes after your G31 in your BlTouch section

                        RatRig0331undefined 3 Replies Last reply Reply Quote 0
                        • RatRig0331undefined
                          RatRig0331 @OwenD
                          last edited by

                          @owend ok I’ll move it and give it a shot

                          1 Reply Last reply Reply Quote 0
                          • RatRig0331undefined
                            RatRig0331 @OwenD
                            last edited by

                            @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 print

                            with my 100x100mm print its trying to do a 13x13 grid what do i tweak to lower that?

                            1 Reply Last reply Reply Quote 0
                            • RatRig0331undefined
                              RatRig0331 @OwenD
                              last edited by

                              @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

                              OwenDundefined 1 Reply Last reply Reply Quote 0
                              • OwenDundefined
                                OwenD @RatRig0331
                                last edited by OwenD

                                @ratrig0331
                                Change your minSpace and maxSpace in the macro to reduce number of probe points
                                Try 50 & 100

                                The G1 is my bad
                                I did a search and replace when I was changing the braces, but changed one that should remain a square bracket

                                Change 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 heating

                                Or delete the line if you don't want to move there while heating

                                RatRig0331undefined 1 Reply Last reply Reply Quote 0
                                • RatRig0331undefined
                                  RatRig0331 @OwenD
                                  last edited by

                                  @owend

                                  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

                                  jay_s_ukundefined 1 Reply Last reply Reply Quote 0
                                  • jay_s_ukundefined
                                    jay_s_uk @RatRig0331
                                    last edited by

                                    @ratrig0331 the most probe points you can have on a duet 2 are 121 and on a duet 3 are 441

                                    Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                    RatRig0331undefined 1 Reply Last reply Reply Quote 0
                                    • RatRig0331undefined
                                      RatRig0331 @jay_s_uk
                                      last edited by

                                      @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

                                      OwenDundefined dc42undefined 2 Replies Last reply Reply Quote 0
                                      • OwenDundefined
                                        OwenD @RatRig0331
                                        last edited by OwenD

                                        @ratrig0331

                                        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
                                        
                                        1 Reply Last reply Reply Quote 1
                                        • dc42undefined
                                          dc42 administrators @RatRig0331
                                          last edited by dc42

                                          @ratrig0331 the minimum spacing between points allowed is 0.1mm in each of X and Y. "Spacing too small" means you have tried to specify a smaller spacing than that.

                                          Duet WiFi hardware designer and firmware engineer
                                          Please do not ask me for Duet support via PM or email, use the forum
                                          http://www.escher3d.com, https://miscsolutions.wordpress.com

                                          OwenDundefined 1 Reply Last reply Reply Quote 1
                                          • OwenDundefined
                                            OwenD @dc42
                                            last edited by

                                            @dc42 said in Only probe where the part will be printed:

                                            the minimum spacing between points allowed is 0.1mm in each of X and Y. "Spacing too small" means you have tried to specify a smaller spacing than that.

                                            In that case I'm at a bit of a loss how @RatRig0331 is getting that error using my code.
                                            It's early morning here (Australia) and I have to go to work, so I can't look at till I get home.
                                            @RatRig0331 Can you please un-comment all the lines in the mesh.g that show the calculations and post the output from the console.

                                            At the start I work out the maximum possible number of probes if a full bed was done using maxSpace.
                                            Later I use the object size to recalculate the number of probes also using maxSpacing.
                                            The lesser of these two numbers is used (or should be).

                                            There must be a fundamental flaw in my logic (at least with your bed size and probe configuration). 😕

                                            It also occurs to me that I haven't catered for deltas or printers where X0, Y0 is in the center of the bed.

                                            RatRig0331undefined 2 Replies Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA