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

    Only probe where the part will be printed

    Scheduled Pinned Locked Moved
    Gcode meta commands
    5
    26
    2.3k
    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.
    • OwenDundefined
      OwenD @Proschi3D
      last edited by

      @Proschi78

      This is how I do it.
      I have a macro to set my default probe points like you would normally do in config.g

      I have modified my mesh.g so if it's not called using specific parameters then it probes the whole bed as normal. This would happen if you did it from DWC for example.
      If the correct parameters are passed it just probes the print area.

      Prusa slicer start code

      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]} N60 ; set N to your desired distance between probe points
      G29 S1  ; load small mesh
      

      0:/sys/setDefaultProbePoints.g
      Modify this to suit your bed

      ;0:/sys/setDefaultProbePoints.g
      ;setDefaultProbePoints.g
      M557 X30:170 Y10:170 P6 ; set up as you would normally in config.g
      

      0:/sys/mesh.g
      You can comment out the echo's when you're happy it's working.

      ;mesh.g
      M98 P"setDefaultProbePoints.g"
      if (exists(param.A) && exists(param.B) && exists(param.C) && exists(param.D) && exists(param.N))
      	var xDistance = (param.B - param.A)
      	var yDistance = (param.D - param.C)
      	var smallestRequired = min(var.xDistance,var.yDistance)
      	var probeDistance = floor(min(var.smallestRequired,param.N))
      	echo "Probe distance used:", var.probeDistance,"mm"
      	var xMin = max(move.compensation.probeGrid.mins[0],param.A)
      	echo "xMin = max(", move.compensation.probeGrid.mins[0],param.A,")"
      	var xMax = min(move.compensation.probeGrid.maxs[0],param.B)
      	echo "xMax = min(",move.compensation.probeGrid.maxs[0],param.B,")"
      	var yMin = max(move.compensation.probeGrid.mins[1],param.C)
      	echo "yMin = max(" ,move.compensation.probeGrid.mins[1],param.C,")"
      	var yMax = min(move.compensation.probeGrid.maxs[1] ,param.D)
      	echo "yMax = min(",move.compensation.probeGrid.maxs[1] ,param.D,")"
      	M557 X{var.xMin,var.xMax} Y{var.yMin,var.yMax} S{var.probeDistance}
      	if result != 0
      		echo "Points used X",var.xMin,":",var.xMax,"Y",var.yMin,":",var.yMax, " Spacing:", var.probeDistance
      		abort "Invalid M557 parameters"
      
      G29 S0
      var ProbeCenterX = (move.compensation.probeGrid.maxs[0] - ((move.compensation.probeGrid.maxs[0] - move.compensation.probeGrid.mins[0])/2)) ; calculate centre point of probe area
      var ProbeCenterY = (move.compensation.probeGrid.maxs[1] - ((move.compensation.probeGrid.maxs[1] - move.compensation.probeGrid.mins[1])/2)) ; calculate centre point 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
      
      Proschi3Dundefined 3 Replies Last reply Reply Quote 3
      • Proschi3Dundefined
        Proschi3D @OwenD
        last edited by Proschi3D

        @OwenD Thank you for your help,
        i will try this afternoon

        did someone manage it already with S3D?

        1 Reply Last reply Reply Quote 0
        • Proschi3Dundefined
          Proschi3D @OwenD
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • Proschi3Dundefined
            Proschi3D @OwenD
            last edited by Proschi3D

            @OwenD the mesh works but printing is canceled

            	Extruder pressure advance: 0.065, 0.000
            Error: in file macro line 7 column 7: M140: expected number after 'S'
            Error: Bad command: mperature] 
            Error: in file macro line 8 column 11: M190: expected number after 'r'
            Error: Bad command: mperature] 
            Error: in file macro line 9 column 11: M109: expected number after 'r'
            Error: Bad command: mperature] T0 
            Error: in file macro line 4 column 39: meta command: expected numeric operands
            Cancelled printing file 0:/gcodes/Part 27 - Part 2.gcode, print time was 0h 2m
            20.12.2022, 17:17:40	4 points probed, min error -0.233, max error -0.025, mean -0.132, deviation 0.078
            Height map saved to file 0:/sys/heightmap.csv
            20.12.2022, 17:17:28	Probe distance used: 60 mm
            xMin = max( 15.0 121.681 )
            xMax = min( 325.0 213.662 )
            yMin = max( -15.0 75.8219 )
            yMax = min( 210.0 153.294 )
            20.12.2022, 17:14:32	Connected to 192.168.178.91
            
            OwenDundefined 1 Reply Last reply Reply Quote 0
            • OwenDundefined
              OwenD @Proschi3D
              last edited by

              @Proschi78
              The M140, M190 & M109 commands that are causing the errors are in your code, not mine.
              Most likely in your start G Code
              It looks like you're using incorrect place holders for the temps

              Please post the start GCode from Prusa Slicer

              Proschi3Dundefined 1 Reply Last reply Reply Quote 0
              • Proschi3Dundefined
                Proschi3D @OwenD
                last edited by

                @OwenD
                PS start code

                M703		; Load Filament specific config, including Temps
                M98 P"/sys/start/Prusalinks"
                
                

                Macro

                T0
                M572 D0 S0.065
                M572 D1 D0.065
                G90 ; set printer absolute mode
                M82 ; set extruder to absolute mode
                M106 S0 ; fan off
                ;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]} N60 ; set N to your desired distance between probe points
                G28 ; home all axes
                G28 Z0
                G29
                G29 s1
                T0 ; set first toolhead
                G1 Z3 F2000 ; Move to Z3 for height clearance before Intro line
                G92 E0 ; set position
                ; intro line
                T0
                G1 Z0.35 F6000 ;
                G1 X60 Y-2 F6000 ;
                G1 X140 Y-2 E20 F200 ;
                G1 x160 y-2 F5000
                G1 Z5 F2000 ; Move to Z5 to prevent dragging nozzle and scratching bed
                G1 x170 y-2 F2000
                G92 E0 ; set position
                G1 F9000.0 ;
                M117 Printing...
                
                
                OwenDundefined 1 Reply Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @Proschi3D
                  last edited by

                  @Proschi78
                  Where are you setting your temps?
                  If it's in your filament config.g then post that too.
                  If you don't put heater settings in PS start code, it will probably do it for you.
                  So if you want to set your temps in the filament config.g then put a dummy setting in your PS start code.

                  Proschi3Dundefined 1 Reply Last reply Reply Quote 0
                  • Proschi3Dundefined
                    Proschi3D @OwenD
                    last edited by Proschi3D

                    @OwenD

                    Extruder pressure advance: 0.065, 0.100
                    Error: in file macro line 6 column 59: meta command: expected numeric operands
                    Cancelled printing file 0:/gcodes/Part 27 - Part 1.gcode, print time was 0h 0m
                    20.12.2022, 20:56:33	M32 "0:/gcodes/Part 27 - Part 1.gcode"
                    File 0:/gcodes/Part 27 - Part 1.gcode selected for printing
                    
                    T0
                    M572 D0 S0.065
                    M572 D1 D0.065
                    G90 ; set printer absolute mode
                    M82 ; set extruder to absolute mode
                    M106 S0 ; fan off
                    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]} N60 ; set N to your desired distance between probe points
                    G28 ; home all axes
                    G28 Z
                    G29
                    G29 S1
                    T0 ; set second toolhead
                    G1 Z3 F2000 ; Move to Z3 for height clearance before Intro line
                    G92 E0 ; set position
                    ; intro line
                    G1 Z0.35 F6000 ;
                    G1 X60 Y-2 F6000 ;
                    G1 X140 Y-2 E20 F200 ;
                    G1 x160 y-2 F5000
                    G1 Z5 F2000 ; Move to Z5 to prevent dragging nozzle and scratching bed
                    G1 x170 y-2 F2000
                    G92 E0 ; set position
                    G1 F9000.0 ;
                    M106 P3 S33
                    M117 Printing...
                    
                    
                    OwenDundefined 1 Reply Last reply Reply Quote 0
                    • OwenDundefined
                      OwenD @Proschi3D
                      last edited by OwenD

                      @Proschi78
                      I'm unsure where the code you have posted is located.
                      Please try the following in your Prusa Start GCode.
                      Don't call any other macros from Prusa!

                      M118 S"Begin slicer start g code"
                      ;M104 S0 R0 P{current_extruder} ;Dummy  Set temps to zero to stop slicer adding them
                      T{current_extruder} ; select tool used on first layer
                      M703 ; load config file for [filament_type]
                      G90 ; Switch to using Absolute Coordinates
                      M82 ; set extruder to absolute mode
                      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
                      M118 S"Heating Bed"
                      G4 S1
                      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
                      M291 S0 T3  P"Homing..."
                      G28 ; Home all 
                      M400 ; wait for last move
                      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]} N60 ; set N to your desired distance between probe points
                      G29 S1  ; load small mesh
                      G1 Z3 F2000 ; Move to Z3 for height clearance before Intro line
                      G92 E0 ; set position
                      ; intro line
                      G1 Z0.35 F6000 ;
                      G1 X60 Y-2 F6000 ;
                      G1 X140 Y-2 E20 F200 ;
                      G1 x160 y-2 F5000
                      G1 Z5 F2000 ; Move to Z5 to prevent dragging nozzle and scratching bed
                      G1 x170 y-2 F2000
                      G92 E0 ; set position
                      G1 F9000.0 ;
                      M106 P3 S33
                      M117 Printing...
                      
                      Proschi3Dundefined 1 Reply Last reply Reply Quote 0
                      • Proschi3Dundefined
                        Proschi3D @OwenD
                        last edited by Proschi3D

                        @OwenD

                        Error: in file macro line 6 column 59: meta command: expected numeric operands
                        Cancelled printing file 0:/gcodes/Part 27 - Part 2.gcode, print time was 0h 2m
                        20.12.2022, 21:53:49	M32 "0:/gcodes/Part 27 - Part 2.gcode"
                        File 0:/gcodes/Part 27 - Part 2.gcode selected for printing
                        Begin slicer start g code
                        Heating Bed
                        

                        If I exclude M98 then normal mesh leveling and printing work.

                        M118 S"Begin slicer start g code"
                        ;M104 S0 R0 P{current_extruder} ;Dummy  Set temps to zero to stop slicer adding them
                        T{current_extruder} ; select tool used on first layer
                        M703 ; load config file for [filament_type]
                        G90 ; Switch to using Absolute Coordinates
                        M82 ; set extruder to absolute mode
                        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
                        M118 S"Heating Bed"
                        G4 S1
                        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
                        M291 S0 T3  P"Homing..."
                        G28 ; Home all 
                        M400 ; wait for last move
                        ;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]} N60 ; set N to your desired distance between probe points
                        G29
                        G29 S1  ; load small mesh
                        G1 Z3 F2000 ; Move to Z3 for height clearance before Intro line
                        G92 E0 ; set position
                        ; intro line
                        G1 Z0.35 F6000 ;
                        G1 X60 Y-2 F6000 ;
                        G1 X140 Y-2 E20 F200 ;
                        G1 x160 y-2 F5000
                        G1 Z5 F2000 ; Move to Z5 to prevent dragging nozzle and scratching bed
                        G1 x170 y-2 F2000
                        G92 E0 ; set position
                        G1 F9000.0 ;
                        M106 P3 S33
                        M117 Printing...
                        
                        danym21undefined 1 Reply Last reply Reply Quote 0
                        • danym21undefined
                          danym21 @Proschi3D
                          last edited by

                          @Proschi78
                          Hi, I use SuperSlicer, but I think in prusa Slicer it should also work.
                          in my startcode I added this line:

                          M557 X{first_layer_print_min[0]}:{first_layer_print_max[0]} Y{first_layer_print_min[1]}:{first_layer_print_max[1]}
                          

                          maybe this will help you too.

                          Proschi3Dundefined 1 Reply Last reply Reply Quote 0
                          • Proschi3Dundefined
                            Proschi3D @danym21
                            last edited by Proschi3D

                            @danym21 Error: in GCode file line 182 column 7: M221: expected number after 'S'
                            Extruder pressure advance: 0.065, 0.000
                            Error: in file macro line 8 column 8: M557: unknown value 'first_layer_print_min^'

                            can you give me your whole start code ?
                            and mesh.g ?

                            danym21undefined 1 Reply Last reply Reply Quote 0
                            • danym21undefined
                              danym21 @Proschi3D
                              last edited by

                              @Proschi78
                              start G-Code:

                              G90 ; use absolute coordinates
                              ;M83  ; extruder relative mode
                              ;BED_MESH_CALIBRATE AREA_START={first_layer_print_min[0]},{first_layer_print_min[1]} AREA_END={first_layer_print_max[0]},{first_layer_print_max[1]}
                              ;MINX:{first_layer_print_min[0]}
                              ;MINY:{first_layer_print_min[1]}
                              ;MAXX:{first_layer_print_max[0]}
                              ;MAXY:{first_layer_print_max[1]}
                              M557 X{first_layer_print_min[0]}:{first_layer_print_max[0]} Y{first_layer_print_min[1]}:{first_layer_print_max[1]}
                              M82 ; absolute extrusion mode
                              M104 S140 T0
                              M140 S[first_layer_bed_temperature] ; set bed temp
                              M190 S[first_layer_bed_temperature] ; wait for bed temp
                              G32 ; home all
                              G1 X-14 Y-10 F10000
                              ; Reset speed and extrusion rates
                              M200 D0 ; disable volumetric e
                              M220 S100 ; reset speed
                              M221 S100 D0 ; reset extrusion rate
                              M109 S{first_layer_temperature[initial_extruder]+extruder_temperature_offset[initial_extruder]} ; wait for extruder temp
                              G92 E0.0
                              
                              ;G1 X150.0 E20  F1000.0 ; intro line
                              G1 E20  F1000.0 ; intro line
                              G1 X0.0 Y0.0 Z0.1 F1000.0 ; go outside print area
                              ;G1 X5 Y0
                              G92 E0.0
                              G1 X2 Y2 Z0.2 E0 F18000 ; new
                              G1 X60 Y2 E9.0 F1800 ;intro Line
                              ;G1 X200.0 E30 F500 ; second Part intro Line
                              G92 E0.0
                              G1 Z5 E-{retract_length[0]} F{retract_speed *60}
                              G1 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} Z{first_layer_height} F30000
                              G1 E{retract_length[0]} F{retract_speed*60}
                              G92 E0.0
                              
                              

                              I do not use a mesh.g this does not exists on my system
                              my bed.g:

                              ; bed.g
                              ; called to perform automatic bed compensation via G32
                              ;
                              ; generated by RepRapFirmware Configuration Tool v2.1.8 on Sun Feb 09 2020 01:08:02 GMT+0100 (Mitteleuropäische Normalzeit)
                              M561 ; clear any bed transform
                              G4 P100
                              G28 ; home
                              G0 Z10 F4200
                              
                              G0 F60000
                              G30 P0 X5 Y155 Z-99999						;Orbiter
                              G30 P1 X302 Y155 Z-99999 S2					;Orbiter
                              G30 P0 X5 Y155 Z-99999						;Orbiter
                              G30 P1 X302 Y155 Z-99999 S2					;Orbiter
                              G91 										;Relative positioning
                              G1 Z5 F1500 								;Raise Z 5mm
                              G90 										;Absolute positioning
                              
                              G0 X45 Y-5 F60000
                              G29 										;Probe the heatbed and generate heightmap
                              
                              G91 										;Relative positioning
                              G1 Z5 F1500 								;Raise Z 5mm
                              G90 										;Absolute positioning
                              
                              G4 P100
                              G0 X0 Y0 F60000 						;Go to Parking Position
                              
                              

                              some settings in config.g that maybe relevant for:

                              ...
                              M671 X-52:377 Y155:155 S2.5 					   ; leadscrews at left (connected to Z) and right
                              ...
                              M557 X10:300 Y10:300 P6:6; S40                     ; define mesh grid ( the normal full size mesh config)
                              
                              Proschi3Dundefined 2 Replies Last reply Reply Quote 1
                              • Proschi3Dundefined
                                Proschi3D @danym21
                                last edited by Proschi3D

                                jetzt gehts 🙂
                                now it works 🙂

                                danym21undefined 1 Reply Last reply Reply Quote 0
                                • danym21undefined
                                  danym21 @Proschi3D
                                  last edited by

                                  @Proschi78
                                  🙂

                                  Proschi3Dundefined 1 Reply Last reply Reply Quote 1
                                  • Proschi3Dundefined
                                    Proschi3D @danym21
                                    last edited by

                                    @danym21 Do you also have start codes for other slicers?

                                    danym21undefined 1 Reply Last reply Reply Quote 0
                                    • danym21undefined
                                      danym21 @Proschi3D
                                      last edited by

                                      @Proschi78
                                      no, sorry
                                      but on S3d maybe have a look to this variables:
                                      I do not know what is in, but you can test with a smal object and check then the gcode file

                                      [build_size_x]
                                      [build_size_y]
                                      [build_size_z]
                                      ....
                                      [next_position_x]
                                      [next_position_y]
                                      [next_position_z] 
                                      

                                      they are mentioned here:
                                      https://community.ultimaker.com/topic/11328-simplify3d-hidden-undocumented-placeholders-for-post-processing-scripts/

                                      Proschi3Dundefined 1 Reply Last reply Reply Quote 1
                                      • Proschi3Dundefined
                                        Proschi3D @danym21
                                        last edited by

                                        @danym21 thanks I'll test that tomorrow

                                        1 Reply Last reply Reply Quote 0
                                        • Proschi3Dundefined
                                          Proschi3D @danym21
                                          last edited by Proschi3D

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

                                          @Proschi78
                                          start G-Code:

                                          G90 ; use absolute coordinates
                                          ;M83  ; extruder relative mode
                                          ;BED_MESH_CALIBRATE AREA_START={first_layer_print_min[0]},{first_layer_print_min[1]} AREA_END={first_layer_print_max[0]},{first_layer_print_max[1]}
                                          ;MINX:{first_layer_print_min[0]}
                                          ;MINY:{first_layer_print_min[1]}
                                          ;MAXX:{first_layer_print_max[0]}
                                          ;MAXY:{first_layer_print_max[1]}
                                          M557 X{first_layer_print_min[0]}:{first_layer_print_max[0]} Y{first_layer_print_min[1]}:{first_layer_print_max[1]}
                                          M82 ; absolute extrusion mode
                                          M104 S140 T0
                                          M140 S[first_layer_bed_temperature] ; set bed temp
                                          M190 S[first_layer_bed_temperature] ; wait for bed temp
                                          G32 ; home all
                                          G1 X-14 Y-10 F10000
                                          ; Reset speed and extrusion rates
                                          M200 D0 ; disable volumetric e
                                          M220 S100 ; reset speed
                                          M221 S100 D0 ; reset extrusion rate
                                          M109 S{first_layer_temperature[initial_extruder]+extruder_temperature_offset[initial_extruder]} ; wait for extruder temp
                                          G92 E0.0
                                          
                                          ;G1 X150.0 E20  F1000.0 ; intro line
                                          G1 E20  F1000.0 ; intro line
                                          G1 X0.0 Y0.0 Z0.1 F1000.0 ; go outside print area
                                          ;G1 X5 Y0
                                          G92 E0.0
                                          G1 X2 Y2 Z0.2 E0 F18000 ; new
                                          G1 X60 Y2 E9.0 F1800 ;intro Line
                                          ;G1 X200.0 E30 F500 ; second Part intro Line
                                          G92 E0.0
                                          G1 Z5 E-{retract_length[0]} F{retract_speed *60}
                                          G1 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} Z{first_layer_height} F30000
                                          G1 E{retract_length[0]} F{retract_speed*60}
                                          G92 E0.0
                                          
                                          

                                          I do not use a mesh.g this does not exists on my system
                                          my bed.g:

                                          ; bed.g
                                          ; called to perform automatic bed compensation via G32
                                          ;
                                          ; generated by RepRapFirmware Configuration Tool v2.1.8 on Sun Feb 09 2020 01:08:02 GMT+0100 (Mitteleuropäische Normalzeit)
                                          M561 ; clear any bed transform
                                          G4 P100
                                          G28 ; home
                                          G0 Z10 F4200
                                          
                                          G0 F60000
                                          G30 P0 X5 Y155 Z-99999						;Orbiter
                                          G30 P1 X302 Y155 Z-99999 S2					;Orbiter
                                          G30 P0 X5 Y155 Z-99999						;Orbiter
                                          G30 P1 X302 Y155 Z-99999 S2					;Orbiter
                                          G91 										;Relative positioning
                                          G1 Z5 F1500 								;Raise Z 5mm
                                          G90 										;Absolute positioning
                                          
                                          G0 X45 Y-5 F60000
                                          G29 										;Probe the heatbed and generate heightmap
                                          
                                          G91 										;Relative positioning
                                          G1 Z5 F1500 								;Raise Z 5mm
                                          G90 										;Absolute positioning
                                          
                                          G4 P100
                                          G0 X0 Y0 F60000 						;Go to Parking Position
                                          
                                          

                                          some settings in config.g that maybe relevant for:

                                          ...
                                          M671 X-52:377 Y155:155 S2.5 					   ; leadscrews at left (connected to Z) and right
                                          ...
                                          M557 X10:300 Y10:300 P6:6; S40                     ; define mesh grid ( the normal full size mesh config)
                                          

                                          what can I do with this start code so that it is probing in mesh like A5 in normal mesh?
                                          Best off five ?

                                          danym21undefined 1 Reply Last reply Reply Quote 0
                                          • danym21undefined
                                            danym21 @Proschi3D
                                            last edited by

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

                                            ke A5 in no

                                            the A5 needs to be in the config.g where you configure the probe type
                                            look for M558
                                            https://docs.duet3d.com/User_manual/Reference/Gcodes#m558-set-z-probe-type

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