Skip to content

Instantly share code, notes, and snippets.

@QNimbus
Last active February 9, 2022 09:16
Show Gist options
  • Save QNimbus/6167760d6db098f84ddc2795584dce4c to your computer and use it in GitHub Desktop.
Save QNimbus/6167760d6db098f84ddc2795584dce4c to your computer and use it in GitHub Desktop.
PrusaSlicer startup g-code for 3D printing
M862.3 P "[printer_model]" ; printer model check
M862.1 P[nozzle_diameter] ; nozzle diameter check
M115 U3.10.0 ; tell printer latest fw version
M117 Initializing
; Set coordinate modes
G90 ; use absolute coordinates
M83 ; extruder relative mode
; Reset speed and extrusion rates
M200 D0 ; disable volumetric e
M220 S100 ; reset speed
M221 S{if layer_height >= 0.32}90{else}100{endif} ; compensate for thick layer heights
; Set initial warmup temps
M117 Preheating
M104 S{first_layer_temperature[0] * 3/4} ; set extruder no-ooze temp (see: https://marlinfw.org/docs/gcode/M104.html)
M140 S{min(first_layer_bed_temperature[0],80)} ; set bed PINDA warmup temp (see: https://marlinfw.org/docs/gcode/M140.html - https://help.prusa3d.com/en/article/macros_1775/#functions)
; Home
M300 S100 P250 ; short beep
M117 Homing
G28 W ; home all without mesh bed level (see: https://marlinfw.org/docs/gcode/G028.html)
; Present bed for final cleaning
G0 Z100 ; Raise nozzle before move
G0 X125 Y210 F5000 ; Move nozzle to PINDA warming position (see: https://marlinfw.org/docs/gcode/G000-G001.html)
G4 S30 ; Allow 30 seconds for cleaning
G0 Z0.15 F5000 ; Lower nozzle to PINDA warming position
; Wait for bed warmup
M190 R[first_layer_bed_temperature] ; set target bed temp (and wait for cooldown if necessary)
G0 Z3 ; Raise nozzle before move
; Mesh bed leveling
M117 Mesh bed leveling
G80 ; mesh bed leveling
G81 ; print mesh leveling results
; Final warmup routine
M117 Final warmup
G0 Z0.6 ; Lower nozzle to limit oozing
M140 S[first_layer_bed_temperature] ; set bed final temp
M104 S[first_layer_temperature] ; set extruder final temp
M109 R[first_layer_temperature] ; wait for extruder final temp
M190 R[first_layer_bed_temperature] ; wait for bed final temp
; Prime line routine
M117 Printing prime line
G0 Z0.15 ; Restore nozzle position - (thanks tim.m30)
M900 K0 ; Disable Linear Advance for prime line
G92 E0.0 ; reset extrusion distance
G1 Y-3.0 F1000.0 ; go outside print area
G1 E2 F1000 ; de-retract and push ooze
G1 X20.0 E6 F1000.0 ; fat 20mm intro line @ 0.30
G1 X100.0 E3.2 F1000.0 ; thin +40mm intro line @ 0.08
G1 X180.0 E6 F1000.0 ; fat +40mm intro line @ 0.15
G1 E-0.8 F3000 ; retract to avoid stringing
G1 X179.5 E0 F1000.0 ; -0.5mm wipe action to avoid string
G1 X190.0 E0 F1000.0 ; +10mm intro line @ 0.00
G1 E0.6 F1500 ; de-retract
G92 E0.0 ; reset extrusion distance
; Final print adjustments
M117 Preparing to print
; do anything else you need
M117 Print in progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment