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

    adaptative mesh on delta, help

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    2
    3
    87
    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.
    • apakundefined
      apak
      last edited by

      This is my startup script in orcaslcier

      G28                                    ; home
      M104 S150                              ; Precaliento nozzle
      M140 S[first_layer_bed_temperature]    ; Caliento la cama
      M190 S[first_layer_bed_temperature]    ; wait for bed temp
      M109 S150                              ; wait for extruder temp
      G1 Z10 F30000                           ; Bajo rapido para hacer el probe
      G30                                    ;Establezco altura Z para evitar error Z-datum y que cargue correctamente el offset del prob
      M98 P"0:/sys/00-Functions/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]}
      M376 H5                               ; turn on fade feature so it fades after 5mm height
      G1 X0 Y-165 Z80 F6000                  ; Me pongo en posicion para limpiar el filamento
      M104 S[first_layer_temperature]        ; set extruder temp
      M109 S[first_layer_temperature]        ; wait for extruder temp
      G92 E0                                 ;zero the extruded length 
      M400
      M98 P"0:/sys/primeLine.g"                     ; Fichero de purga por el borde
      G92 E0.0
      

      And this is the script I am using to do the adaptative mesh.

      ; This command will only create a mesh of the print area
      ; This will reduce the printing time considerably by only probing what is needed
      ; start script call
      ; M98 P"0:/sys/00-Functions/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]}
      
      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 R165 S40:40 							; define grid for mesh bed compensation MAX ALLOWED
      M557 X{var.probeGridMinX, var.probeGridMaxX} Y{var.probeGridMinY, var.probeGridMaxY} P{var.meshX, var.meshY}
      

      I have not had any problems yet, but I think I could have it if I set a big enought piece, so that Min and Max X,Y point make a rectangule bigger than print area, and would love to set mesh area in RADIUS format instead of rectangle.

      but don´t remember where I collected this code to ask for it, so would like for some advice on how to do it.

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @apak
        last edited by dc42

        @apak I suggest something like this (not tested) to replace the M557 command at the end of your script:

        var maxProbeRadius = 165   ; or use move.kinematics.printRadius if you can probe the entire printable area
        var highestXSquared = max(var.probeGridMinX * var.probeGridMinX, var.probeGridMaxX * var.probeGridMaxX)
        var highestYSquared = max(var.probeGridMinY * var.probeGridMinY, var.probeGridMaxY * var.probeGridMaxY)
        var maxRadiusSquared = var.highestXSquared + var.highestYSquared
        if var.maxRadiusSquared > var.maxProbeRadius * var.maxProbeRadius
          M557 R{var.maxProbeRadius} S40:40
        else
          M557 X{var.probeGridMinX, var.probeGridMaxX} Y{var.probeGridMinY, var.probeGridMaxY} P{var.meshX, var.meshY}
        

        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

        apakundefined 1 Reply Last reply Reply Quote 0
        • apakundefined
          apak @dc42
          last edited by

          @dc42 will try it later, thanks

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