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

I wonder if those mods will be good for the Snapmaker Orca slicer too? Maybe I’ll try them.

1 Like

@Poky1 I don’t know. Another way to go would be to present the orca start gcode to chat gpt, explain what changes you want to make and it will make them for you…
I made a couple of improvements to my Prusa start gcode. Here is the latest version:

; 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
; ----------------------------
G28 ; Home all axes

; ----------------------------
; Step 2: Set bed temperature
; ----------------------------
M140 S{first_layer_bed_temperature[initial_extruder]}
; ----------------------------

; ----------------------------
; Step 3: Raise Z
; ----------------------------
G0 Z0.2 F300.0 ; Raise to Z0.2

; ----------------------------
; Step 4: Wait for bed temp
; ----------------------------
M190 S{first_layer_bed_temperature[initial_extruder] - 5} ; Wait for bed to reach temp - 5°C
M140 S{first_layer_bed_temperature[initial_extruder]} ; Reset bed temp

; ----------------------------
; Step 5: 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 F7000 ; Move to purge line start position
G1 Z0.2 F240.0 ; Lower back to purge start height
G1 E2 F200 ; Start extruding
G1 X10 E11 F2660.0 ; Draw purge line along X-axis (1/3 speed)
G1 E-0.2 F200 ; Retract slightly
G92 E0 ; Reset extruder position
G0 F7000 ; Set travel speed to 7000
{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 F7000 ; Move to purge line start position
G1 Z0.2 F240.0 ; Lower back to purge start height
G1 E2 F200 ; Start extruding
G1 X314 E11 F2660.0 ; Draw purge line along X-axis (1/3 speed)
G1 E-0.2 F200 ; Retract slightly
G92 E0 ; Reset extruder position
G0 F7000 ; Set travel speed to 7000
{endif}

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

; Ready to print!

It’s a pretty simple mod for start gcode that should be a procedural improvement regardless of slicer. Just depends how each slicer is coded.

You may want another M190 at the end of the first step 5, after the M109s. To ensure the bed also reaches temperature in case the nozzles go faster.

Looks good otherwise!

@Wombley There is a M140 at the end of step 4, I dont think any more bed temp commands are needed after that?

edit: Ok I see what you mean. I prefer not to wait for bed temp there. I often manually lower bed temp just for the printer to start faster, then reset to original bed temp after it has started :blush:

1 Like

I hear you. Figure you really wanna get that first layer to stick is all.

If you feel like going to all the trouble of adding an OctoPrint server, you can remotely click to start heating the bed while you slice your print. That’s what I actually do 90% if the time.

The other 10% is because I forgot. :sweat_smile:

You can also add a camera with it for monitoring (but not time lapse).