My start and end gcode for Prusaslicer

Just thaught I’d share my Prusaslicer start and end gcode for J1. It’s based of @macdylan work (thank you!). I made it a little simpler to better suit my preferences.

No mystery heating temps.

No purging of the nozzle while sitting “mid-air”. It now heats on top of the ooze blocker and moves directly to the purge line when it has reached printing temp.

No purge blob. Just a simple purge line in x-direction.

For the end gcode I just lowered the retraction amount.

Start gcode:
; Model: Snapmaker J1 ({nozzle_diameter[0]}/{nozzle_diameter[1]})
; Printer : [printer_preset]
; Profile : [print_preset]
; Plate : [physical_printer_preset]
; — initial_extruder: [initial_extruder]
; — has_wipe_tower: [has_wipe_tower]
; — total_toolchanges: [total_toolchanges]
; — T0: {is_extruder_used[0]}
; — T1: {is_extruder_used[1]}

M201 X[machine_max_acceleration_x] Y[machine_max_acceleration_y] Z[machine_max_acceleration_z] E[machine_max_acceleration_e]
M203 X[machine_max_feedrate_x] Y[machine_max_feedrate_y] Z[machine_max_feedrate_z] E[machine_max_feedrate_e]
M204 P[machine_max_acceleration_extruding] R[machine_max_acceleration_retracting] T[machine_max_acceleration_travel]
M205 X[machine_max_jerk_x] Y[machine_max_jerk_y] Z[machine_max_jerk_z] E[machine_max_jerk_e]

T[initial_extruder]

M205 V20 ; Junction Deviation (mm)

; Set IDEX mode if necessary
{if physical_printer_preset =~/.IDEXDupl./ || physical_printer_preset =~/.IDEXCopy./ }
M605 S2 X162 R0 ; IDEX Duplication
{elsif physical_printer_preset =~/.IDEXMirr./}
M605 S3 ; IDEX Mirror
{elsif physical_printer_preset =~/.IDEXBack./}
M605 S4 ; IDEX Backup
{endif}

; ----------------------------
; Step 1: Home all axes while heating the bed
; ----------------------------
G28 ; Home all axes

; ----------------------------
; Step 2: Set bed temperature and wait
; ----------------------------
M140 S{first_layer_bed_temperature[initial_extruder]}
M190 S{first_layer_bed_temperature[initial_extruder]} ; Wait for bed to reach temp

; ----------------------------
; Step 3: Heat the extruder
; ----------------------------
{if is_extruder_used[0]}M104 T0 S{first_layer_temperature[0]}{endif}
{if is_extruder_used[1]}M104 T1 S{first_layer_temperature[1]}{endif}
{if is_extruder_used[0]}M109 T0 S{first_layer_temperature[0]}{endif}
{if is_extruder_used[1]}M109 T1 S{first_layer_temperature[1]}{endif}

; ----------------------------
; Step 4: Purge Line for Each Extruder (Only on X-axis)
; ----------------------------

; Purge Line for Extruder 0 (if used)
{if is_extruder_used[0]}
T0
G28 X ; Re-home X to ensure correct position
G0 Z2.0 F300.0 ; Raise to Z2.0 before moving
G1 X142.0 F2660.0 ; Move to purge line start position (1/3 speed)
G1 Z0.2 F240.0 ; Lower back to purge start height
G1 E1 F200 ; Start extruding
G1 X10 E9.47915 F2660.0 ; Draw purge line along X-axis (1/3 speed)
G1 E-0.2 F200 ; Retract slightly
G92 E0 ; Reset extruder position
{endif}

; Purge Line for Extruder 1 (if used)
{if is_extruder_used[1]}
T1
G28 X ; Re-home X to ensure correct position
G0 Z2.0 F300.0 ; Raise to Z2.0 before moving
G1 X182.0 F2660.0 ; Move to purge line start position (1/3 speed)
G1 Z0.2 F240.0 ; Lower back to purge start height
G1 E1 F200 ; Start extruding
G1 X314 E9.47915 F2660.0 ; Draw purge line along X-axis (1/3 speed)
G1 E-0.2 F200 ; Retract slightly
G92 E0 ; Reset extruder position
{endif}

; ----------------------------
; Step 5: Select initial extruder before printing
; ----------------------------
T[initial_extruder]

; Ready to print!

End gcode:
G92 E0

G0 Z{max_layer_z + 2.0} F600
; retract the filament
G0 E-0.6 F200
G28

{if is_extruder_used[0]}M104 T0 S0{endif}
{if is_extruder_used[1]}M104 T1 S0{endif}

M140 S0
M107
M220 S100
M84

;
; DON’T REMOVE these lines if you’re using the smfix (GitHub - macdylan/SMFix: SMFix is a post-processing tool for PrusaSlicer/SuperSlicer/OrcaSlicer designed to be compatible with Snapmaker printers.)
; min_x = [first_layer_print_min_0]
; min_y = [first_layer_print_min_1]
; max_x = [first_layer_print_max_0]
; max_y = [first_layer_print_max_1]
; max_z = [max_layer_z]
; total_layer_number = [layer_num]
;

2 Likes

Nice! Some suggested small optimizations discussed here.

  1. Start heating the bed (140) before homing, then wait (190) to save some seconds.
  2. Better, preheat the bed to the target temp minus 5 degrees. Then start heating the hotend(s) and bed to full target temperature and wait for all.

These might knock 1-2 minutes off the start time.

1 Like

@Wombley Yes, I 100% agree. Will make those those adjustments soon! :slightly_smiling_face:

2 Likes