[gcode_macro PRINT_START] gcode: {% set extruderTemp = params.EXTRUDER_TEMP|default(205)|int %} {% set bedTemp = params.BED_TEMP|default(55)|int %} {% set DWELL = params.DWELL|default(300)|int %} LIGHT_DISPLAY # Loading extruder and bed temperature M104 S{extruderTemp|float*0.75} M140 S{bedTemp} RESPOND PREFIX= MSG="Waiting for temperatures..." M117 Waiting for temperatures... #LIGHTS_ON M190 S{bedTemp} # Wait for bed to come to temperature RESPOND PREFIX= MSG="Waiting for thermal expansion..." M117 Waiting for thermal expansion... HEATSOAK DWELL={DWELL} # Dwelling # Homing and creating a mesh RESPOND PREFIX= MSG="Creating a mesh..." M117 Creating a mesh... G28 BED_MESH_CALIBRATE AREA_START={params.AREA_START} AREA_END={params.AREA_END} M104 S{extruderTemp} # Set extruder to printing temperature G90 M83 Dock_probe # Move to prime position RESPOND PREFIX= MSG="Moving to prime position" M117 Moving to prime position PRIME_LINE EXTRUDER_TEMP={extruderTemp} XPAD=0 YPAD=0 LENGTH=50 PRINT_SPEED=30 TRAVEL_SPEED=200 PURGE=8 RETRACT=0.5 EXTRUSION_MULTIPLIER=1.25 PRINT_HANDLE=0 HANDLE_FAN=35 AREA_START={params.AREA_START} [gcode_macro HEATSOAK] gcode: G4 P{params.DWELL|int*1000} [gcode_macro LIGHT_DISPLAY] gcode: SET_LED LED=fysetc_mini12864 RED=.25 GREEN=0 BLUE=.25 INDEX=1 TRANSMIT=0 SET_LED LED=fysetc_mini12864 RED=.05 GREEN=0 BLUE=.5 INDEX=2 TRANSMIT=0 SET_LED LED=fysetc_mini12864 RED=.05 GREEN=0 BLUE=.5 INDEX=3 [gcode_macro PRIME_LINE] description: Print an easy to remove parametric extruder priming line with a built-in handle. gcode: # settings {% set line = { 'x_padding' : params.XPAD|default(0)|float, # left/right padding around the bed the line can't print into 'y_padding' : params.YPAD|default(0)|float, # top/bottom padding around the bed the line can't print into 'area_start_x' : params.AREA_START.split(",")[0]|default(0)|float, # area to start the line 'area_start_y' : params.AREA_START.split(",")[1]|default(0)|float, # area to start the line 'initial_purge' : params.PURGE|default(8)|int, # mm of filament to purge before printing. set to 0 to disable 'retract_after' : params.RETRACT|default(1)|int, # mm of filament to recract after printing. set to 0 to disable 'length' : params.LENGTH|default(150)|int, 'print_speed' : params.PRINT_SPEED|default(30)|int, 'travel_speed' : params.TRAVEL_SPEED|default(200)|int, 'extr_multi' : params.EXTRUSION_MULTIPLIER|default(1.25)|float, # apply to prime lines 'overlap_percent': 80, # how much prime lines overlap each other } %} {% set handle = { 'do_print' : params.PRINT_HANDLE|default(1)|int, # set to 0 to disable printing the handle 'fan_percent' : params.HANDLE_FAN|default(40)|int, # without fan the handle is too small and melty to print upright 'width' : 5.0, 'height' : 5.0, 'move_away' : 40 # how much to move the toolhead away from the printed handle once done. set 0 to disable } %} # sanity check and computed variables {% set max_x, max_y, nozzle_diameter = printer.toolhead.axis_maximum.x|float, printer.toolhead.axis_maximum.y|float, printer.configfile.config['extruder'].nozzle_diameter|float %} {% set _ = line.update({'width': nozzle_diameter * 1.25, 'height': nozzle_diameter / 2, 'length': [line.length, max_x - 2 * line.x_padding - 2]|min}) %} {% set _ = line.update({'e_per_mm': line.extr_multi * (line.width * line.height) / (3.1415 * (1.75/2)**2), 'x_start': max_x / 2 - line.length / 2, 'y_start': line.y_padding + range(0,5)|random}) %} SAVE_GCODE_STATE NAME=STATE_PRIME_LINE {% set saved_prime_line = (line.area_start_y - 40) %} {% if saved_prime_line < -3 %} {% set saved_prime_line = -3|int %} {% endif %} M117 Prime Line G90 # absolute positioning G0 X{line.area_start_x} Y{saved_prime_line} Z{line.height} F{line.travel_speed * 60} # move to starting position M109 S{params.EXTRUDER_TEMP|float*0.98} # Wait until 98% of extruder temp is reached, then continue M104 S{params.EXTRUDER_TEMP} # Set printing extruder temp G91 # relative positioning G1 E{line.initial_purge} F{5 * 60} # extrude at ~12mm3/sec G0 F{line.print_speed * 60} # set print speed G1 X{line.length} E{line.length * line.e_per_mm} # print forward line G0 Y{line.width * line.overlap_percent / 100} # overlap forward line G1 X-{line.length / 2} E{(line.length / 2) * line.e_per_mm} # print backward line for half the length # print a handle for easy removal {% if handle.do_print != 0 and handle.width != 0 and handle.height != 0 %} G0 X{line.length / 2 - handle.width} Y{handle.width / 2} F{line.travel_speed * 60} # move into position for printing handle G0 F{line.print_speed * 60} # set print speed {% set saved_fan_speed = (printer['fan'].speed * 256)|int %} M106 S{((handle.fan_percent / 100) * 256)|int} # set part fan to desired speed {% for _ in range((line.height * 1000)|int, (handle.height * 1000)|int, (line.height * 1000)|int) %} # loop however many cycles it takes to print required handle height G1 Y{loop.cycle(-1.0, 1.0) * handle.width} E{handle.width * line.e_per_mm} # handle layer G0 X-{line.width * 0.2} Z{line.height} # move up and shift the layer to make the handle sloping {% endfor %} M106 S{saved_fan_speed} # restore previous part fan speed {% endif %} G1 E-{line.retract_after} F{50 * 60} # retract ar 50mm/sec after printing G0 Y{handle.move_away} F{line.travel_speed * 60} M117 RESTORE_GCODE_STATE NAME=STATE_PRIME_LINE