Start GCode routines

From RepRapWiki
Jump to: navigation, search

Contents

Intro

Slicers such as Slic3r and Cura can append user supplied GCode scripts/routines to the beginning of a print job to perform many useful functions.

Z-Probe

If you employ a z-probe of the inductive, optical, or mechanical type this is where you'll need to add your G29 command to command the firmware to perform the bed probing routine (only works immediately after G28).

Z-Probe Example

G28; Home all axis
G29; Probe bed before print

Cura 15.06

Cura 15.06 removed the ability to manually add start/end GCode in the GUI, but you can still do it by editing the machine specific .json file for your printer which includes separate lines for start/end gcode concatenated onto a single line with line breaks "\n" between statements.

Cura 15.06 default start GCode for the prusa_i3.json as of August 2015 (breaks added for readability, in situ it's one-line (but maybe it doesn't have to be?))

"machine_start_gcode": {
"default": "G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 
;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F9000 ;move the platform down 15mm\nG92 E0 
;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F9000\n
;Put printing message on LCD screen\nM117 Printing..."

Reformatted to human readable form below by grep replacing \\n for \n:

G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
G1 Z15.0 F9000 ;move the platform down 15mm
G92 E0 ;zero the extruded length
G1 F200 E3 ;extrude 3mm of feed stock
G92 E0 ;zero the extruded length again
G1 F9000 ; Put printing message on LCD screen
M 117 Printing...

Custom Start GCode

Here's my custom start-gcode with comments to perform the following actions (Marlin 1.0.2 Firmware):

  • Enable AutoTemp
  • Home X/Y/Z Axis
  • Probe Bed (requires Z-Probe)
  • Attempt Nozzle Wipe (for ooze free startup)
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
M109 S180 B210 F1;activate auto temp min 180 max 210 scaling factor 1 (for PLA)
G28; Home Axis
G29; Z-Probe the bed (requires Z-Probe!)
G1 Z5.0 F9000 ;move the head 5mm up for CYA clearance
G92 E0 ;zero the extruded length
M117 Cleaning...;Put Cleaning message on screen
G1 X100 Y0 F4000 ; move half way along the front edge
G1 Z1 ; move nozzle close to bed
M109 S200 ; heat nozzle to 200 degC and wait until reached
G4 P10000 ; wait 10 seconds for nozzle length to stabilize
G1 E10 ; extrude 10 mm of filament
G1 z15 F12000 E5 ; move 15 mm up, fast, while extruding 5mm
G92 E0 ; reset extruder
M117 Printing...;Put printing message on LCD screen