Skip to content

Instantly share code, notes, and snippets.

@prcutler
Created December 3, 2021 01:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prcutler/f4c56fcde3a4e04433f60ece6b416990 to your computer and use it in GitHub Desktop.
Save prcutler/f4c56fcde3a4e04433f60ece6b416990 to your computer and use it in GitHub Desktop.
START PRINT
[gcode_macro START_PRINT]
gcode:
#Get Printer built volume dimensions
{% set X_MAX = printer.toolhead.axis_maximum.x|default(100)|float %}
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(100)|float %}
{% set Z_MAX = printer.toolhead.axis_maximum.z|default(100)|float %}
#Get Nozzle diameter and filament width for conditioning
{% set NOZZLE = printer.extruder.nozzle_diameter|default(0.4)|float %}
{% set FILADIA = printer.extruder.filament_diameter|default(1.75)|float %}
#Set Start coordinates of priming lines
{% set X_START = 10.0|default(10.0)|float %}
{% set Y_START = 20.0|default(20.0)|float %}
#Calculate Primer line extrusion volume and filament length
{% set PRIMER_WIDTH = 0.75 * NOZZLE %}
{% set PRIMER_HEIGHT = 0.70 * NOZZLE %}
{% set PRIMER_SECT = PRIMER_WIDTH * PRIMER_HEIGHT %}
{% set PRIMER_VOL = PRIMER_SECT * (X_MAX - 3 * X_START) %}
{% set FILA_SECT = 3.1415 * ( FILADIA / 2.0)**2 %}
{% set FILA_LENGTH = 1.55 * PRIMER_VOL / FILA_SECT %}
#Get Bed and Extruder temperature from Slicer GCode
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
#Preheat nozzle and bed
M104 S{EXTRUDER_TEMP} T0
M140 S{BED_TEMP}
#Home
G28
#Move up to clean bed
G1 Y{Y_MAX - 20} Z{Z_MAX/4.0} F6000
#Heat nozzle and bed
M190 S{BED_TEMP}
M109 S{EXTRUDER_TEMP} T0
#Precondition extruder
# G92 E0
# G1 X{X_START} Y{Y_START} Z{PRIMER_HEIGHT} F6000.0
# G1 X{X_MAX - 2 * X_START} Y{Y_START} Z{PRIMER_HEIGHT} F2000.0
# G1 X{X_MAX - 2 * X_START} Y{Y_START + PRIMER_WIDTH} Z{PRIMER_HEIGHT}
# G1 X{X_START} Y{Y_START + PRIMER_WIDTH} Z{PRIMER_HEIGHT} F2000.0
# G92 E0
# G1 Z2.0 F600
# G1 Z0.2 F600
# G1 Z2.0 F600
; now print a line of filament to prepare extrusion
G92 E0 ; reset extruder
G1 X0.1 Y20 Z0.3 F5000.0 ; move to start-line position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; draw 1st 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 2nd line
G92 E0 ; reset extruder
G1 Z1.0 F3000 ; move z up little to prevent scratching of surface G1 X100 Y100 F15000
# ;Tuning params
# ;Put printing message on LCD screen
# M117 Printing...
# M83
# ; Start of actual GCode for the print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment