@fcwilt said in common start and end gcode for all the slicer configurations:
@the_dragonlord
Let's start with the filament handling feature of the DWC since it is an essential part of the way I do things to achieve a degree of slicer independence.
When you create a filament in the DWC the system creates three files for each filament:
load.g
unload.g
config.g
The file config.g is the one that is important here. Note that this is not the main config.g file but a file with the same name unique to each filament.
The command M703 is used to invoke this config.g for the currently selected filament.
M703 documenttion
Here is an example of one of my filament config.g files:
M291 R"PLA - Generic - White" P"Configuring..." T0
M221 S100 D0 ; set extrusion multiplier
G10 S190 R0 ; set extruder temps
M140 S60 R0 ; set bed temps
M291 R"PLA - Generic - White" P"Configuring - Done" T1
Here is my print_begin.g file. This file is invoked from the slicer using M98 P"print_begin.g", which is placed in the slicer location for user code to be executed at the start of a print.
; select tool and configure based on filament selected
T0 ; select tool 0 so extruder commands below will work
M703 ; configure selected filament (sets bed/extruder temps, extrusion multiplier)
; *** the following "sanity checks" test for required conditions to make the my approach work ***
; check for selected filament
if move.extruders[0].filament = ""
M291 R"No Filament Selected" P"Cannot Continue" S2 T0
abort
; check bed heater active temp setting
if heat.heaters[0].active = 0
M291 R"Bed Heater Active Temp = 0" P"Cannot Continue" S2 T0
abort
; check extruder heater active temp setting
if heat.heaters[1].active = 0
M291 R"Extruder Heater Active Temp = 0" P"Cannot Continue" S2 T0
abort
; check if homed - allows homing (OK button) or canceling (CLOSE button)
if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
M291 R"Printer has not been homed" P"Home and Continue?" S3 T0
G28
; setup to print
M291 R"Preparing to print" P"Please wait..." T0
G90 ; absolute moves
G1 Z100 F1200 ; position for cleaning
G1 X0 Y-145 F6000 ; position for cleaning
M291 R"Heating Extruder & Bed" P"Please wait..." T0
M116 ; wait for temps to reach set points
M291 R"Priming Extruder" P"Please wait..." T0
M83 ; insure extruder relative mode
G92 E0 ; reset the extruder logical position
G1 E10 F120 ; prime the extruder
M400 ; wait for extruding to finish
G92 E0 ; reset the extruder logical position
M291 R"Clean Nozzle and Bed" P"Click OK to begin printing" S3 T0
G1 E-0.1 F120 ; retract to control oozing
M400 ; wait for extruding to finish
G92 E0 ; reset the extruder logical position
M98 P"mesh_load.g" ; load height map
The code above is configured for the way I do things on my single tool printers. There are others ways you could do things, like priming the extruder.
The important parts are using T0 to select the tool, using M703 to invoke the selected filament config.g file and the "sanity checks" to verify the required conditions exist.
Check it over and let me know if you would like to see more of what I do.
Frederick
I'ts very interesting! If you have time give me more details, thanks!