At the beginning of every 3d print, most slicers will include a block of gcode, designed to set up your printer for a successful print. Here is the gcode I use for my Marlin based printers. Please note that if you have an auto bed leveling system (ABL) available you should uncomment the "g29" that will run the ABL before each print.
; DrVax May 2020 Start Code
; Added set temp before printint index line
; Added set bed temp before print
; This first section is for printers with ABL
M104 S200 ; heat up extruder before calibrating bed
M140 S40 ; same for bed
G28 ; Home all axes
; G29 ; Probe the bed with the ABL ; **** uncomment this line if you have a always on ABL *****
G92 E0 ; Reset Extruder
M140 S{material_bed_temperature_layer_0}
M190 S{material_bed_temperature_layer_0}
M104 S{material_print_temperature_layer_0}
M109 S{material_print_temperature_layer_0} ; Wait for extruder to get back up to temperature
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
; DrVax a number of viewers have mentioned that the following M140,190,104,109 commands are redundant.
; They maybe but if your printer is already at the correct temperature they will execute immediately
M140 S{material_bed_temperature_layer_0}
M190 S{material_bed_temperature_layer_0}
M104 S{material_print_temperature_layer_0}
M109 S{material_print_temperature_layer_0} ; Wait for extruder to get back up to temperature
; End of custom start GCode
; DrVax May 2020 Start Code
; Added set temp before printint index line
; Added set bed temp before print
; This first section is for printers with ABL
M104 S200 ; heat up extruder before calibrating bed
M140 S40 ; same for bed
G28 ; Home all axes
; G29 ; Probe the bed with the ABL ; **** uncomment this line if you have a always on ABL *****
G92 E0 ; Reset Extruder
M140 S{material_bed_temperature_layer_0}
M190 S{material_bed_temperature_layer_0}
M104 S{material_print_temperature_layer_0}
M109 S{material_print_temperature_layer_0} ; Wait for extruder to get back up to temperature
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
; DrVax a number of viewers have mentioned that the following M140,190,104,109 commands are redundant.
; They maybe but if your printer is already at the correct temperature they will execute immediately
M140 S{material_bed_temperature_layer_0}
M190 S{material_bed_temperature_layer_0}
M104 S{material_print_temperature_layer_0}
M109 S{material_print_temperature_layer_0} ; Wait for extruder to get back up to temperature
; End of custom start GCode
Comment