Skip to content

Instantly share code, notes, and snippets.

@mikhailbot
Created November 16, 2021 18:03
Show Gist options
  • Save mikhailbot/322294bc3894515b93f31781ea55de8d to your computer and use it in GitHub Desktop.
Save mikhailbot/322294bc3894515b93f31781ea55de8d to your computer and use it in GitHub Desktop.
[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - please customize for your slicer of choice
gcode:
{% set BED = params.BED|default(100)|float %}
{% set EXTRUDER = params.EXTRUDER|default(240)|float %}
{% set CHAMBER = params.CHAMBER|default(15)|float %}
{% set SOAK = params.SOAK|default(15)|float %}
# Set bed temperature and partial nozzle temperature, turn on part cooling for heating chamber
{% if EXTRUDER >= 230 %}
M140 S{BED}
M104 S150
M106 S255
SET_FAN_SPEED FAN=nevermore_fan SPEED=1.0
{% else %}
M140 S{BED}
M104 S125
M106 S255
{% endif %}
G28 ; home all axes
PARKCENTER ; move to middle of bed
M190 S{BED} ; set bed temperature
{% if (SOAK|int) > 0 %}
M117 Starting Soak
{% for timer in range( SOAK|int,0,-1) %}
# we cycle once a minute, so we can send an update to keep octoprint happy, rather than just sleeping for the entire soak
M117 Soak: {timer|int}m remaining
M105
G4 P60000 # wait 1 minute
{% endfor %}
M117 Soak Complete
{% endif %}
G28
PARKFRONT ; move to front corner for ooze
M109 S{EXTRUDER} ; heat up hotend
# Prime line
# ABS
{% if BED >= 100 %}
G92 E0
G1 X3 Y3 Z0.90 F12000
G1 X25 Y3 E40 F100
G1 X30 F18000
G92 E0
## Catch-all
{% else %}
G0 Y0 X40 ; go to tongue of print bed
G1 Z0.2 F500.0 ; move bed to nozzle
G92 E0.0 ; reset extruder
G1 E2 F500 ; pre-purge prime LENGTH SHOULD MATCH YOUR PRINT_END RETRACT
G1 X80 E8.0 F500.0 ; intro line 1
G1 Y0.3 ; move in a little
G1 X40 E8.0 F500.0 ; second line
G92 E0.0 ; reset extruder
G1 Z2.0 ; move nozzle to prevent scratch
{% endif %}
M117 Printing;
# Park center of build volume
[gcode_macro PARKCENTER]
gcode:
CG28 ; home if not already homed
SAVE_GCODE_STATE NAME=PARKCENTER
G90 ; absolute positioning
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z{printer.toolhead.axis_maximum.z/2} F5000
RESTORE_GCODE_STATE NAME=PARKCENTER
# Park bottom rear left
[gcode_macro PARKFRONT]
gcode:
CG28 ; home if not already homed
SAVE_GCODE_STATE NAME=PARKFRONT
G90 ; absolute positioning
G0 X{printer.toolhead.axis_minimum.x+3} Y{printer.toolhead.axis_minimum.y+3} Z{printer.toolhead.axis_minimum.z+5} F5000
RESTORE_GCODE_STATE NAME=PARKFRONT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment