Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login
    1. Home
    2. mher
    3. Best
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 31
    • Best 8
    • Controversial 0
    • Groups 0

    Best posts made by mher

    • RE: Only probe where the part will be printed

      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 for

      Now 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-PAM

      in 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
      posted in General Discussion
      mherundefined
      mher
    • Dockable Probe Configurator Macro

      My current printer is a V-Core 3 500 powered by a Duet 6HC with 1LC running RRF 3.4.4 in SBC mode.
      I'm running a klicky probe and wanted to write something that would help people in setting up the probes location as well as the command for docking and undocking.

      So what I did is created a macro which will run through some steps to determine the dock position as well as the "dock" and "load" position.

      During these steps the macro will run some validations to make sure the set positions actually work when done multiple times.

      When everything succeeds the deployprobe.g and retractprobe.g files will be overwritten with values that correspond for loading and docking the probe.

      deployprobe.g is written in such a way that you should be able to move to a position you'd want to probe, send G30. The current position will be remembered, probe will then be picked up and after picking up it'll move back to the original position to actually probe for Z

      This script should work with any and all printers that support dockable probes

      Please let me know if you come across hints for improvements and/or bugs!

      ; This file will help you set the location for the klicky probe.
      
      ; Warn the user about the retract & deploy files being overwritten
      M291 P"Continuing will overwrite deployprobe.g & retractprobe.g" R"Are you sure you want to continue?" S3
      
      var deployFile = "/sys/deployprobe.g"
      var retractFile = "/sys/retractprobe.g"
      if exists(global.ratRepFirmwareVersion) ; Check if the user is running RatRepFirmware
          set var.deployFile = {global.probeKlickyDeploy} ; Set the file to klicky specific location to support switching between multiple probe types
          set var.retractFile = {global.probeKlickyRetract} ; Set the file to klicky specific location to support switching between multiple probe types
          if global.probe_type == 0 ; Probe type is set to something that doesn't need to be loaded
              abort "The probe is set to a type that doesn't support loading. Change the probe_type in 'sys/lib/globals/printer_specific_config.g"
      
      M564 H0	; Allow movement without homing in order to move Z
       
      ; If the printer hasn't been homed, home it
      if !move.axes[0].homed || !move.axes[1].homed
      	G28 XY
       
      G91 ; Set to relative mode
      G1 Z10 ; if axes homed move the bed out of the way
      G90 ; Set to absolute mode
       
      M561    ; Clear any bed transform
      M290 R0 S0 ; clear babystepping
       
      if sensors.probes[0].value[0] = 1000
          M291 P"Make sure the klicky probe is mounted on the toolhead" S3
          if sensors.probes[0].value[0] = 1000
      		M564 H1	; Don't allow movement without homing
              abort "The probe doesn't seem to be attached, please attach before starting the configuration again"
       
      ; Display the popup to jog the tool to the spot where the klicky is in the dock
      M291 R"Move klicky to it's docking location" P"Press OK when the probe seated in the dock" S3 X1 Y1
      var probeDockXLocation = move.axes[0].machinePosition   ; Store the position of X when docked
      var probeDockYLocation = move.axes[1].machinePosition   ; Store the position of Y when docked
       
      ; Display the popup to jog the tool in order to "mount" the probe
      M291 R"Move the tool to pull the probe from the dock" P"Press ok when the tool is in a position you like it to be" S3 X1 Y1
      var probeAttachedXLocation = move.axes[0].machinePosition   ; Store the position of X when attached
      var probeAttachedYLocation = move.axes[1].machinePosition   ; Store the position of Y when attached
       
      ; Lets verify that we can move into the probe location before continuing
      while iterations < 3
          G0 X{var.probeDockXLocation} Y{var.probeDockYLocation}
          M400    ; Wait for all moves to be completed
          if sensors.probes[0].value[0] = 1000
      		M564 H1	; Don't allow movement without homing
              abort "The probe was detached, please start again"
          G0 X{var.probeAttachedXLocation} Y{var.probeAttachedYLocation}
          M400    ; Wait for all moves to be completed
          if sensors.probes[0].value[0] = 1000
      		M564 H1	; Don't allow movement without homing
              abort "The probe was detached, please start again"
       
      ; Lets make sure we are in the docked position
      G0 X{var.probeDockXLocation} Y{var.probeDockYLocation}
      M400    ; Wait for all moves to be completed
      if sensors.probes[0].value[0] = 1000
      	M564 H1	; Don't allow movement without homing
          abort "The probe was detached, please start again"
       
      ; Display the popup to jog the tool in order to "detach" the probe
      M291 R"Move the tool in order to detach the probe" P"Press ok when the probe is in a position where you would like it to be after detaching the probe" S3 X1 Y1
      var probeDetachedXLocation = move.axes[0].machinePosition   ; Store the position of X when attached
      var probeDetachedYLocation = move.axes[1].machinePosition   ; Store the position of Y when attached
       
      ; Lets verify that we can attach and detach the probe
      while iterations < 3
          G0 X{var.probeAttachedXLocation} Y{var.probeAttachedYLocation}  ; Move to attach the probe
          G0 X{var.probeDockXLocation} Y{var.probeDockYLocation}  ; Move into position to attach the probe
          G0 X{var.probeAttachedXLocation} Y{var.probeAttachedYLocation}  ; Move to attach the probe
          G0 X{var.probeDockXLocation} Y{var.probeDockYLocation}  ; Move into position to attach the probe
          M400    ; Wait for all moves to be completed
          if sensors.probes[0].value[0] = 1000
      		M564 H1	; Don't allow movement without homing
              abort "The probe wasn't mounted, please start again"
          G0 X{var.probeDetachedXLocation} Y{var.probeDetachedYLocation}  ; Move to detach the probe
          M400    ; Wait for all moves to be completed
          if sensors.probes[0].value[0] = 0
      		M564 H1	; Don't allow movement without homing
              abort "The probe wasn't detached, please start again"
       
      echo > {var.deployFile} "; The deploy command for Z when using a dockable probe" ; Let's create the probe loading code file for dockable probes
      echo >> {var.deployFile} "if sensors.probes[0].value[0] != 0"
      echo >> {var.deployFile} "    var originX = {move.axes[0].userPosition} ; Store the X position before grabbing the probe."
      echo >> {var.deployFile} "    var originY = {move.axes[1].userPosition} ; Store the Y position before grabbing the probe."
      echo >> {var.deployFile} "    G1 X" ^ {var.probeAttachedXLocation}, "Y" ^ {var.probeAttachedYLocation}, "F999999 ; Move tool in front of dock"
      echo >> {var.deployFile} "    G1 X" ^ {var.probeDockXLocation}, "Y" ^ {var.probeDockYLocation}, "F999999 ; Move tool in position where probe is mounted"
      echo >> {var.deployFile} "    G1 X" ^ {var.probeAttachedXLocation}, "Y" ^ {var.probeAttachedYLocation}, "F999999 ; Move tool in front of dock"
      echo >> {var.deployFile} "    if var.originX > " ^ {var.probeAttachedXLocation}, "|| var.originY > " ^ {var.probeAttachedYLocation}
      echo >> {var.deployFile} "        ; Move the toolhead back to the position we came from"
      echo >> {var.deployFile} "        G1 X{var.originX} Y{var.originY} F999999"
      echo >> {var.deployFile} "    M400"
      echo >> {var.deployFile} "if sensors.probes[0].value[0] != 0"
      echo >> {var.deployFile} "   abort ""Error probe not attached - aborting"""
      
      echo > {var.retractFile} "; The retract command for Z when using a dockable probe" ; Let's create the docking code file for dockable probes
      echo >> {var.retractFile} "if sensors.probes[0].value[0] != 1000"
      echo >> {var.retractFile} "    G90"
      echo >> {var.retractFile} "    G1 X" ^ {var.probeAttachedXLocation}, "Y" ^ {var.probeAttachedYLocation}, "F999999 ; Move tool in front of dock"
      echo >> {var.retractFile} "    M400"
      echo >> {var.retractFile} "    G1 X" ^ {var.probeDockXLocation}, "Y" ^ {var.probeDockYLocation}, "F999999 ; Move tool in position where probe is mounted"
      echo >> {var.retractFile} "    G1 X" ^ {var.probeDetachedXLocation}, "Y" ^ {var.probeDetachedYLocation}, "F999999 ; Move tool to detach probe"
      echo >> {var.retractFile} "    G1 X" ^ {var.probeAttachedXLocation}, "Y" ^ {var.probeAttachedYLocation}, "F999999 ; Move tool in front of dock"
      echo >> {var.retractFile} "    M400"
      echo >> {var.retractFile} "if sensors.probes[0].value[0] != 1000"
      echo >> {var.retractFile} "    abort ""Error probe not docked - aborting"""
       
      echo "configured the location"
      
      posted in Gcode meta commands
      mherundefined
      mher
    • RE: Only probe where the part will be printed

      Just want to share the solution I made for this a couple of months ago (posted here)
      as well.

      It works with PrusaSlicer/SuperSlicer, Cura and Ideamaker. Instructions are included as well.
      https://github.com/MaikoHermans/RRF-PAM

      posted in Gcode meta commands
      mherundefined
      mher
    • RE: 3.5.0rc4 - G29 crashes nozzle into bed after first probe point

      @omtek
      I've some macro going on for my klicky to unload/load it. I'll post the macro's maybe they can help you out to atleast prevent the crashes from happening.

      I must admit I didn't read through all your macro files and I'm not on 3.5 yet so not sure if it will be of any help or not but still figured I'd post them in an attempt to help out.

      All of these files are in their own directory called ZProbe

      initialize.g

      if global.probe_type == 0 ; Set config values for the BLTouch 
      	M98 P"/macros/ZProbe/BLTouch/initialize.g"
      
      elif global.probe_type == 1 ; Set the config values for the Klicky probe
      	M98 P"/macros/ZProbe/Klicky/initialize.g"
      

      deploy_probe.g

      ; Command to deploy the probe for Z moves that require probing
      if global.probe_type == 0 ; Deploy probe for BLTouch
      	M98 P"/macros/ZProbe/BLTouch/deployprobe.g"
      if global.probe_type == 1 ; Deploy probe for Klicky
      	M98 P"/macros/ZProbe/Klicky/deployprobe.g"
      

      retract_probe.g

      ; Command to retract the probe
      if global.probe_type == 0 ; Retract the probe for the BLTouch
      	M98 P"/macros/ZProbe/BLTouch/retractprobe.g"
      if global.probe_type == 1 ; Retract the probe for Klicky
      	M98 P"/macros/ZProbe/Klicky/retractprobe.g"
      

      as you can see I use this to be able to switch between probes (I once had the idea to create RatRepFirmware but due to time constraints and to many projects I haven't really continued on it)

      The specific klicky files:
      initialize.g

      ; Setup the probe details for the Klicky probe
      M558 P8 C"121.io0.in" I1 H2  R0.1 F240:60 T8000 A5 S0.01		; set Z probe type to unmodulated and the dive height + speeds
      G31 P25 X-24.526 Y-20.725 Z3.29          	   					; set Z probe trigger value, offset and trigger height, more Z means closer to the bed
      

      deployprobe.g

      ; The deploy command for Z when using a dockable probe
      if sensors.probes[0].value[0] != 0
          var originX = {move.axes[0].machinePosition} ; Store the X position before grabbing the probe.
          var originY = {move.axes[1].machinePosition} ; Store the Y position before grabbing the probe.
          G1 X60 Y11.5 F9000 ; Move tool in front of dock
          G1 X7.30000 Y11.5 F9000 ; Move tool in position where probe is mounted
          G1 X60 Y11.5 F9000 ; Move tool in front of dock
          if var.originX > 60 || var.originY > 11.5
              ; Move the toolhead back to the position we came from
              G1 X{var.originX} Y{var.originY} F9000
          M400
      if sensors.probes[0].value[0] != 0
         abort "Error probe not attached - aborting"
      

      retractprobe.g

      ; The retract command for Z when using a dockable probe
      if sensors.probes[0].value[0] != 1000
          G90
          G1 X60 Y11.5 F9000 ; Move tool in front of dock
          M400
          G1 X7.30000 Y11.5 F9000 ; Move tool in position where probe is mounted
          G1 X7.30000 Y42 F9000 ; Move tool to detach probe
          G1 X60 Y11.5 F9000 ; Move tool in front of dock
          M400
      if sensors.probes[0].value[0] != 1000
          abort "Error probe not docked - aborting"
      

      TLDR;
      I'm manually taking care of the mounting/docking and make sure to check the state of the probe before continuing any movements

      I also posted this macro to help determine the dock details and it'll generate most files for you afterwards
      https://forum.duet3d.com/topic/30495/dockable-probe-configurator-macro?_=1713439239779

      posted in Beta Firmware
      mherundefined
      mher
    • RE: while loop doesn't end

      @dc42
      Alright it seems like i figured out what is causing the issue.

      I created a new macro and started adding things one by one.
      Everything went fine until I added this line:

      G91 G1 H2 Z7 G90 ; Set to relative positioning, move Z up 5mm, change back to absolute positioning

      after adding this the while loop kept on running. After removing it everything ran as expected again

      EDIT:
      just confirmed it by creating the following macro. This would just keep running the while loop infinite.

      G91 G1 Z5 G90 ;Removed H2 to be sure this wasn't the cause
      
      while iterations < 4 
      	echo "iteration: " ^ iterations
      

      Then I split the G91/G90 command from single line to multi line and it started working as expected. So it seems there is an issue with the single line implementation for relative/absolute.
      Which I read here we should be able to do the way I did
      https://forum.duet3d.com/topic/11662/treat-g90-g91-and-m82-m83-like-g53/3

      posted in Gcode meta commands
      mherundefined
      mher
    • RE: Dockable Probe Configurator Macro

      @jay_s_uk I'll do some testing tonight and potentially change the script to output the results into the retract/deploy macros. Only thing I'm slightly worried about is that it'd be overwriting any settings someone already has in there. Then again that might be a good thing

      posted in Gcode meta commands
      mherundefined
      mher
    • RE: Thoughts on an auto-z offsett macro

      @Exerqtor Thanks for the response. I was thinking the same just wanted to verify.
      I'll continue with my implementation and I'll most likely use your script as inspiration but I have some ideas of changing it. I hope to have something working around next week. I'll also update here if I got something up and running

      posted in Gcode meta commands
      mherundefined
      mher
    • RE: Dockable Probe Configurator Macro

      @jay_s_uk as promised I looked into it and I've updated the script accordingly in the start post

      posted in Gcode meta commands
      mherundefined
      mher