The G-Code segments are "mail-merged" by Creation Workshop X to create the
full print sequence. The full sequence is a header, then for each layer it
adds pre-slice, layer, and lift sequences, then finally appends the footer.

Words with a "$" in front of them are replaced with their configuration values,
for words that exist as configuration value items.

Words with a "@" in front of them are replaced with the value from the user
parameter in the machine config that has the same name - if it exists.
Note that arithmetic does not work with these.

Below are the sequences that are embedded in Creation Workshop X, used when
a new profile is created as the default G-Code sequences.


;********** Header Start ********
G21          ; Set units to be mm
G91          ; Relative Positioning
M17          ; Enable motors
;G28 Z        ; Home Z axis - uncomment to auto-home on play
;********** Header End **********


;********** Pre-Slice %d$CURSLICE ********
; Printer G-code sequence before each slice
G4 P0            ; Make sure any previous relative moves are complete
;<Delay> %d$SettleTime
;********** Pre-Slice End **********


;********** Layer %d$CURSLICE ********
; Printer G-code sequence to print a slice
;<Slice> %d$CURSLICE
;<Delay> %d@sliceDelay
@cmdOpenShutter  ; UV on
;{$CURSLICE<$NumFirstLayers?<Delay> %d$FirstLayerTime:<Delay> %d$LayerTime}
@cmdCloseShutter ; UV off
;<Slice> Blank
;<Delay> %d$BlankTime
;********** Layer End **********


;********** Lift Sequence %d$CURSLICE ********
; Printer G-code sequence to perform lift and return after a slice
G1 Z($ZLiftDist * $ZDir) F{$CURSLICE < $NumFirstLayers?$ZBottomLiftRate:$ZLiftRate}
;<Takes> {$CURSLICE<$NumFirstLayers?%d($ZLiftDist*1000*60/$ZBottomLiftRate):%d($ZLiftDist*1000*60/$ZLiftRate)}
G4 P0            ; Wait for lift rise to complete
;<Delay> %d$TopTime
G1 Z(($LayerThickness-$ZLiftDist) * $ZDir) F$ZRetractRate
;<Takes> %d(($ZLiftDist*1000-$LayerThickness*1000)*60/$ZRetractRate)
;********** Lift Sequence End **********


;********** Footer ********
; Printer G-code sequence at the end of a print
@cmdCloseShutter ; UV off
G4 P0            ; wait for last lift to complete
G1 Z40.0 F150.0  ; lift print clear of resin
G4 P0            ; sync
M18              ; Disable Motors
;<Completed>
;********** Footer End ********



As a simple example of a modification you can make, this variation of the
header sequence will home the Z axis* then lift the plate 10mm and then
lower it slowly 1mm at a time back to the home position. The idea being to
try to ensure no bubbles under the build plate at the start of a print.

(*) Note that the "G28 Z" homing command is commented here, deliberately to
avoid people accidentally hitting print without having removed partially
cured resin from the vat, and causing their LCD to be broken as a result.
Make sure you know
what you're doing if you uncomment it.

;********** Header Start ********
G21          ; Set units to be mm
G91          ; Relative Positioning
M17          ; Enable motors
;G28 Z        ; Home Z axis
; Do a 10mm lift, then drop slowly to ensure no bubbles under the build plate
G0 Z10.0 F60 ; Lift 10mm
G4 P0        ; wait for lift to complete
G0 Z-1.0 F60 ; 10 x Drop 1mm and pause
G4 P5000
G0 Z-1.0 F60
G4 P5000
G0 Z-1.0 F60
G4 P5000
G0 Z-1.0 F60
G4 P5000
G0 Z-1.0 F60
G4 P5000
G0 Z-1.0 F60
G4 P5000
G0 Z-1.0 F60
G4 P5000
G0 Z-1.0 F60
G4 P5000
G0 Z-1.0 F60
G4 P5000
G0 Z-1.0 F60
G4 P5000
<Takes> 60000
