Starting and Ending G-Code with BLTouch

Cura

Note: The following codes are sending a M420 S1 after G28. It is not required with recent versions of ADVi3++ (thanks to RESTORE_LEVELING_AFTER_G28) but does not harm.

Example of Starting G-Code for Cura:

G21 ; metric values
G90 ; absolute positioning
M82 ; set extruder to absolute mode
M107 ; start with the fan off
M140 S{material_bed_temperature_layer_0} ; Set bed temperature (no wait)
G28 X Y F6000 ; move X/Y to min endstops
G28 Z F1200 ; move Z to min endstops ; raise the nozzle
G28 X Y F6000 ; move X/Y to min endstops
M190 S{material_bed_temperature_layer_0} ; wait for bed temperature to reach target
M104 S{material_print_temperature_layer_0} T0 ; set extruder temperature (no wait)
G29 ; auto-leveling
G28 X Y F6000 ; move X/Y to min endstops, may disable bed leveling
M420 S1 ; enable bed leveling compensation
M109 S{material_print_temperature_layer_0} T0 ; set extruder temperature and wait
M300 P200 ; beep to indicate that the temp is reached
G1 Z15 F1200 ; raise to have room
G92 E0 ; zero the extruded length
G1 F140 E30 ; extrude 3mm of feed stock
G4 S2 ; Wait for 2 seconds
G92 E0 ; zero the extruded length
M117 Printing from Cura...; message

Example of Ending G-Code for Cura:

M104 S0 ; extruder heater off
M140 S0 ; heated bed heater off
M107; Turn fan off
G91 ; relative positioning
G1 E-1 F300 ; retract the filament a bit before lifting the nozzle to release some of the pressure
G1 Z+2.0 E-5 F6000 ; move Z up and retract filament even more
G90 ; absolute positioning
G1 X0 F6000 ; move X to min endstops so the head is out of the way
G1 Y160 F6000 ; move the bed so it is easy to access to the printed part
G92 E0 ; zero the extruded length
M84 ; steppers off

Simplify3D

Example of Starting G-Code for Simplify3D:

G21 ; metric values
G90 ; absolute positioning
M82 ; set extruder to absolute mode
M107 ; start with the fan off
M140 S[bed0_temperature] ; Set bed temperature (no wait)
G28 X Y F6000 ; move X/Y to min endstops
G28 Z F1200 ; move Z to min endstops ; raise the nozzle
G28 X Y F6000 ; move X/Y to min endstops
M190 S[bed0_temperature] ; wait for bed temperature to reach target
M104 S[extruder0_temperature] T0 ; set extruder temperature (no wait)
G29 ; auto-leveling
G28 X Y F6000 ; move X/Y to min endstops, may disable bed leveling
M420 S1 ; enable bed leveling compensation
M109 S[extruder0_temperature] T0 ; set extruder temperature and wait
M300 P200 ; beep to indicate that the temp is reached
G1 Z15 F1200 ; raise to have room
G92 E0 ; zero the extruded length
G1 F140 E30 ; extrude 3mm of feed stock
G4 S2 ; Wait for 2 seconds
G92 E0 ; zero the extruded length
G1 X5 Y5 F2000; Move a little over the bed
M117 Printing from Simplify3D...; message

Example of Ending G-Code for Simplify3D:

M104 S0 ; extruder heater off
M140 S0 ; heated bed heater off
M107; Turn fan off
G91 ; relative positioning
G1 E-1 F300 ; retract the filament a bit before lifting the nozzle to release some of the pressure
G1 Z+2.0 E-5 F6000 ; move Z up and retract filament even more
G90 ; absolute positioning
G1 X0 F6000 ; move X to min endstops so the head is out of the way
G1 Y160 F6000 ; move the bed so it is easy to access to the printed part
G92 E0 ; zero the extruded length
M84 ; steppers off