Hi folks,
in the past days i updated my trusty D-Bot to the latest RFF release and tried some meta commands.
I came up with a first layer calibration script (simliar to Prusa Mini) someone might like (and dares to try).
It should work on most cartesian printers.
The script consists of 2 files:
The macro that starts the calibration script (place it in 0:/macros/) and the actual calibration script itself (place it in 0:/sys/)
There are several config parameters which should be rather self explanatory.
I'm looking for further improvements and things I might have missed or misunderstood.
0:/macros/First Layer Assistent
; First Layer Assistent v0.1
; This is a First Layer Calibration Script "kinda" based on the Prusa MINI
; Developed and tested on a D-Bot (Core XY) running RRF 3.4
; Macro starts a Printjob so Babysteps can be adjusted
;--------------------------------------------------------------------------------
; Make sure we are not currently printing!
if state.status != "processing" && state.status != "paused"
; Continue
M23 0:/sys/firstlayerassist.g
M24
else
;Otherwise Show Error
M291 R"First Layer Assist v0.1" P"Assist can't be run while printing!" S1 T10
0:/sys/firstlayerassist.g
; First Layer Assist v0.1
; Print File
; This is a First Layer Calibration Script "kinda" based on the Prusa MINI
; Developed and Tested on a D-Bot (Core XY)
;--------------------------------------------------------------------------------
; What it does:
; 1. Reset trigger height (& mesh / optional)
; 2. Preheat to leveling temp (170C / Ooz prevention / optional)
; 3. Home
; 4. Mesh bed leveling (optional)
; 5. Preheat to material temp (preset to 220C)
; 6. Purgeline
; 7. Adjust Z-Offset using Babysteps while printing line and infill patterns
; 8. Save new Z-Offset and reset Babysteps
;--------------------------------------------------------------------------------
; USER CONFIG
var FLA_layerHeight = 0.2 ; Layer Heigt in mm
var FLA_lines = 10 ; Number of Lines / use even Numbers only
var FLA_zSpeed = 4 ; Z-Axis speed in mm/s
var FLA_saveZOffset = 0 ; save Z offset in mm
var FLA_createMesh = true ; create new mesh
var FLA_purgeLine = true ; create purge line
var FLA_preheat = false ; use save preaheat
var FLA_bedPreheatTemp = 60 ; preaheat bed temp. in °C
var FLA_nozzlePreheatTemp = 170 ; preaheat nozzle temp. in °C
var FLA_bedTemp = 85 ; bed temp. in °C
var FLA_nozzleTemp = 235 ; nozzle temp. in °C
var FLA_OffsetL = 10 ; bed offset (left) in mm
var FLA_OffsetR = 30 ; bed offset (right) in mm
var FLA_OffsetF = 10 ; bed offset (front) in mm
var FLA_OffsetB = 10 ; bed offset (back) in mm
var FLA_printSpeed = 40 ; print speed in mm/s
var FLA_travelSpeed = 200 ; travel speed in mm/s
var FLA_FillX = 30 ; fill rectangle X size in mm
var FLA_FillY = 30 ; fill rectangle Y size in mm
var FLA_EndX = 0 ; end position X in mm
var FLA_EndY = {move.axes[1].max} ; end position Y in mm
;--------------------------------------------------------------------------------
; INTERNAL VARS ( no need to/dont change)
var FLA_title = "First Layer Assist v0.1"
var FLA_xMove = 0 ; x move var
var FLA_yMove = 0 ; y move var
var FLA_eMove = 0 ; e move var
var FLA_eFactor = 0.15588 ; based on Prusa Slicer
var FLA_FillIterations = 0 ; fill line interations
;--------------------------------------------------------------------------------
G90 ; send absolute coordinates...
M83 ; ...but relative extruder moves
; Reset trigger height & mesh
M291 R{var.FLA_title^": Reset"} P{"Current trigger height is "^sensors.probes[0].triggerHeight^" mm. Press OK to reset and beginn recalibration."} S3 T0
G31 P500 Z0 ; Set Z-Offset = 0
M290 R0 S0 ; Reset Babysteps
if {var.FLA_createMesh} = true
M561 ; reset bedlevel
G29 S2
M500 P31 ; save to config
M501 ; set config values
M564 S0 ; disable limits
M107 ; start with the fan off
if {var.FLA_preheat} = true
; Preheat to leveling temp (Ooz prevention)
M291 R{var.FLA_title^": Reset"} P{"Preheating nozzle to "^var.FLA_nozzlePreheatTemp^"C / heated bed to "^var.FLA_bedPreheatTemp^"C."} S1 T5
M140 S{var.FLA_bedPreheatTemp} ;heat up the bed
M109 S{var.FLA_nozzlePreheatTemp} ;heat up the nozzle and wait
M190 S{var.FLA_bedPreheatTemp} ;heat up the bed and wait
else
; Preheat to printing temp
M291 R{var.FLA_title^": Preheat and Wait"} P{"Heating nozzle to "^var.FLA_nozzleTemp^"C / heated bed to "^var.FLA_bedTemp^"C. If needed addjust temperatures now!"} S3
M140 S{var.FLA_bedTemp} ;heat up the bed
M109 S{var.FLA_nozzleTemp} ;heat up the nozzle and wait
M190 S{var.FLA_bedTemp} ;heat up the bed and wait
; Home
M400
M291 R{var.FLA_title^": Reset"} P{"Homing. Please Wait."} S1 T5
G28 ;home
; Mesh bed leveling
if {var.FLA_createMesh} = true
M291 R{var.FLA_title^": Bed Leveling"} P{"Mesh bed leveling. Please Wait"} S1 T5
G29 ;bedlevel
if {var.FLA_preheat} = true
; Preheat to printing temp
M291 R{var.FLA_title^": Preheat and Wait"} P{"Heating nozzle to "^var.FLA_nozzleTemp^"C / heated bed to "^var.FLA_bedTemp^"C. Addjust now if needed."} S3
M140 S{var.FLA_bedTemp} ;heat up the bed
M109 S{var.FLA_nozzleTemp} ;heat up the nozzle and wait
M190 S{var.FLA_bedTemp} ;heat up the bed and wait
; Save Offset
if var.FLA_saveZOffset != 0
M291 R{var.FLA_title^": Save Offset"} P{"Applying save Z-Offset of "^var.FLA_saveZOffset^" mm."} S3
M290 Z{(-var.FLA_saveZOffset)} R0 ; apply save Z Offset
; Adjust Z-Offset using Babysteps while printing line and infill patterns (+ purgeline)
M291 R{var.FLA_title^": Printing Patterns"} P"Adjust Z-Offset using Babysteps now! (Printstatus)" S1 T5
; Purgeline
if {var.FLA_purgeLine} = true
G1 X10 Y10 F{var.FLA_travelSpeed * 60} ;move X/Y to front of printer
G1 Z0.2 F{var.FLA_zSpeed * 60}; lower nozzle
G1 X{(move.axes[0].max / 5 )} E6 F250 ; start purge line
G1 X{(move.axes[0].max / 3 )} E6 F600 ; finish purge line
G1 Z10 F{var.FLA_zSpeed * 60} ; lift nozzle
G1 X{move.axes[0].max / 2 } F{var.FLA_travelSpeed * 60}
G92 E0 ;zero the extruded length
; Start line pattern
G1 X{var.FLA_OffsetL} Y{move.axes[1].max - var.FLA_OffsetB} F{var.FLA_travelSpeed * 60} ; start pos
G1 Z0.2 F{var.FLA_zSpeed * 60} ; Move Z to true printheight
M400
; Lines
G1 F{var.FLA_printSpeed * 60}
while (iterations+1) <= {var.FLA_lines}
if mod((iterations+1),2) >= 1
; X Move
set var.FLA_xMove={move.axes[0].max - var.FLA_OffsetR}
set var.FLA_yMove={move.axes[1].max - var.FLA_OffsetB - (move.axes[1].max - var.FLA_OffsetB - var.FLA_OffsetF - var.FLA_FillY) / var.FLA_lines * iterations}
set var.FLA_eMove={(move.axes[0].max - var.FLA_OffsetL - var.FLA_OffsetR) * var.FLA_layerHeight * var.FLA_eFactor}
; Y Move
G1 X{var.FLA_xMove} Y{var.FLA_yMove} E{var.FLA_eMove}
set var.FLA_yMove={move.axes[1].max - var.FLA_OffsetB - (move.axes[1].max - var.FLA_OffsetB - var.FLA_OffsetF - var.FLA_FillY) / var.FLA_lines * (iterations + 1)}
set var.FLA_eMove={(move.axes[1].max - var.FLA_OffsetB - var.FLA_OffsetF - var.FLA_FillY) * var.FLA_layerHeight * var.FLA_eFactor / var.FLA_lines}
G1 X{var.FLA_xMove} Y{var.FLA_yMove} E{var.FLA_eMove}
continue
else
; X Move
set var.FLA_xMove={var.FLA_OffsetL}
set var.FLA_yMove={move.axes[1].max - var.FLA_OffsetB - (move.axes[1].max - var.FLA_OffsetB - var.FLA_OffsetF - var.FLA_FillY) / var.FLA_lines * iterations}
set var.FLA_eMove={(move.axes[0].max - var.FLA_OffsetL - var.FLA_OffsetR) * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_xMove} Y{var.FLA_yMove} E{var.FLA_eMove}
; Y Move
set var.FLA_yMove={move.axes[1].max - var.FLA_OffsetB - (move.axes[1].max - var.FLA_OffsetB - var.FLA_OffsetF - var.FLA_FillY) / var.FLA_lines * (iterations + 1)}
set var.FLA_eMove={(move.axes[1].max - var.FLA_OffsetB - var.FLA_OffsetF - var.FLA_FillY) * var.FLA_layerHeight * var.FLA_eFactor / var.FLA_lines}
G1 X{var.FLA_xMove} Y{var.FLA_yMove} E{var.FLA_eMove}
continue
; Rectangle outline
set var.FLA_eMove={var.FLA_FillY * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_OffsetL} Y{var.FLA_OffsetF} E{var.FLA_eMove}
set var.FLA_eMove={var.FLA_FillX * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_OffsetL + var.FLA_FillX} Y{var.FLA_OffsetF} E{var.FLA_eMove}
set var.FLA_eMove={var.FLA_FillY * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_OffsetL + var.FLA_FillX} Y{var.FLA_OffsetF + var.FLA_FillY} E{var.FLA_eMove}
set var.FLA_eMove={(var.FLA_FillX - 0.4) * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_OffsetL + 0.4} Y{(var.FLA_OffsetF + var.FLA_FillY)} E{var.FLA_eMove}
;10,4 40
; Rectangle infill
set var.FLA_FillIterations = {floor((var.FLA_FillX - 0.8) / 0.4 / 2)}
while iterations <= var.FLA_FillIterations
set var.FLA_eMove={(var.FLA_FillY - 0.8) * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_OffsetL + 0.4 + iterations * 0.8} Y{var.FLA_OffsetF + 0.4} E{var.FLA_eMove}
set var.FLA_eMove={0.4 * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_OffsetL + 0.8 + iterations * 0.8} Y{var.FLA_OffsetF + 0.4} E{var.FLA_eMove}
set var.FLA_eMove={(var.FLA_FillY - 0.8) * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_OffsetL + 0.8 + iterations * 0.8} Y{var.FLA_OffsetF + var.FLA_FillY - 0.4} E{var.FLA_eMove}
if iterations != var.FLA_FillIterations
set var.FLA_eMove={0.4 * var.FLA_layerHeight * var.FLA_eFactor}
G1 X{var.FLA_OffsetL + 1.2 + iterations * 0.8} Y{var.FLA_OffsetF + var.FLA_FillY - 0.4} E{var.FLA_eMove}
; Wait till finished and cooldown
M400
M104 S0 ; turn off extruder
M140 S0 ; turn off bed
; Move end position
G1 Z20 F1000
G1 X{var.FLA_EndX} Y{var.FLA_EndY} F12000
; Save new Z-Offset and reset Babysteps
M291 R"First Layer Assist" P{"OK to Set Z-Trigger height set to "^-move.axes[2].babystep^"mm, Save to Config now."} S3 ;Show new Z-Offset
G31 P500 Z{-move.axes[2].babystep} ; Set Z-Offset
M500 P31 ; Save to Config
M501 ; Set Config Values
M290 R0 S0 ; Reset Babysteps
M564 S1 ; Enable limits