; Change list: ; Toggle extrusion while keeping smooth movement ; Modify to se x0 and xf to arbitrary functions of step or another parameter ; NOTE: the underscore syntax signifies a global variable G21 (mm) G90 (Absolute distance mode) G55 (Machine Plane Coordinates) G64 (Turn off exact stop check) M5 (Stop the spindle if it's left on) ; Variables for controlling the model #<_printing_speed> = 1100 (1100) (Speed of the print as it moves along the straight line) #<_margin_speed_scalar> = 1.28 (1.28) (Margin Speed Scalar: the return speed on the margin) #<_extrusion_rate> = 0.0003 (0.0003) (extrude: extruder motor counter clockwise from top 0.005 to 0.007) ; Not used ; #<_clockwise_speed> = ? (0.005) (extruder back up, used before inter-layer pauses) #<_should_extrude_on_corners> = 0 (0) (1 extrude on corners, 0 no extrude on corners) #<_margin> = 8 (8) ; Not used ; #<_lo> = ? (2) (loop offset, used to prevent errors from turn-arounds at row ends) ; #<_loop_offset> = ? (2) (loop offset, used to prevent errors from turn-arounds at row ends) ; #<_pause> = ? (.0001) (wait time, used at corners) #<_corner_wait_time> = .0001 (.0001) (wait time, used at corners) ;work dimensions #<_l> = 36 (36) (mm length) #<_width> = 36 (36) (mm width) #<_delta> = .75 (.75) (mm inter-row&column spacing) #<_layerH> = .08 (.08) (mm layer height) ;coordinates ; #<_z0> = ? (2) (Initial Height of Needle Tip) (5) ; #<_z0> = ? (1) (Initial Height of Needle Tip) (5) #<_zz> = 2 (2) #<_x0> = 0 (0) (initial x) #<_xx> = #<_x0> (x) #<_y0> = 0 (0) (initial y) #<_yy> = #<_y0> (y) ;counters #<_zstep> = 0 (0) #<_step> = 0 (0) ;counter maximums #<_layers> = 20 (20) #<_ystepf> = FIX[#<_l>/#<_delta>](_____-[#<_l> MOD #<_delta>]/#<_delta>]) #<_xstepf> = FIX[#<_width>/#<_delta>]([_____-[#<_width> MOD #<_delta>]/#<_delta>]) ;#<_yy> = [#<_yy> + #<_l> + 20] ;position purge routine (y) ;#<_xx> = [#<_xx> - #<_width>+7] ;position purge routine (x) ;G0 X[#<_xx>] Y[#<_yy>] Z10 ;position purge routine ; ;M3 S0.005 ;literal purge ;o100 while [#<_step> LE 0] ;'timer' for purge ; ;#<_yy> = [#<_yy> + #<_delta>] (shows iterations for debugging) ; #<_xx> = [#<_xx> + 0.25*#<_width>*[2*[#<_step> MOD 2]-1]] ;remind linuxcnc how to dance ; G1 X[#<_xx>] F#<_printing_speed> ;travel (the real time filler) ; #<_step>=[#<_step> + 1] ;linuxcnc doesn't like infinity... ;o100 endwhile ; ;M4 S0.05 ;back up extruder to relieve excess pressure ;o101 while [#<_step> LE 0] ;'timer' for purge ; ;#<_yy> = [#<_yy> + #<_delta>] (shows iterations for debugging) ; #<_xx> = [#<_xx> + 0.25*#<_width>*[2*[#<_step> MOD 2]-1]] ;remind linuxcnc how to dance ; G1 X[#<_xx>] F#<_printing_speed> ;travel (the real time filler) ; #<_step>=[#<_step> + 1] ;linuxcnc doesn't like infinity... ;o101 endwhile ;M3 ; ;S#<_extrusion_rate> ;slow down the extruder and allow the pressure to equilibrate ;o105 while [#<_step> LE 35] ; ;G1 X[#<_xx> - #<_margin>*[2*[#<_step> MOD 2]-1]] F#<_printing_speed> ;margin code (equilibration) ; ;G0 Y[#<_yy>] F#<_printing_speed> ;margin code (equilibration) ; ;G1 X[#<_xx>] F#<_printing_speed> ;margin code (equilibration) ; ;#<_yy> = [#<_yy> + #<_delta>] (shows iterations for debugging) ; #<_xx> = [#<_xx> + 0.5*#<_width>*[2*[#<_step> MOD 2]-1]] ; G1 X[#<_xx>] F#<_printing_speed> ; #<_step>=[#<_step> + 1] ;o105 endwhile ;#<_xx> = #<_x0> ;reset variables assumed to have previously stated initial values ;#<_yy> = #<_y0> ;reset variables assumed to have previously stated initial values ;#<_step> = 0 ;reset variables assumed to have previously stated initial values ;M5 ; G1 X[#<_xx>] Y[#<_yy>] Z[#<_zz>] F#<_printing_speed> G1 X[#<_xx>] Y[#<_yy>] F#<_printing_speed> M3 S#<_extrusion_rate> o110 while [#<_zstep> LE FIX[[#<_layers> - 1]/2]] (4) ;G1 Y[#<_yy> + #<_margin>+5] F#<_printing_speed> ;G1 X[#<_x0> - #<_margin>-5] F#<_printing_speed> ;G1 Y[#<_y0>] F#<_printing_speed> #<_xx> = [#<_l> + #<_margin>*0.5] #<_yy> = [#<_y0> + [[0.5*#<_delta>]*[#<_zstep> MOD 2]]] ; causes layers to stager o115 while[#<_step> LE [[#<_ystepf>/2]-1]] #<_step> = [#<_step> + 1] o120 if [#<_should_extrude_on_corners> EQ 0] (M5) (Causes stop in spite of G64 will need something else.) o120 endif ;G4 P#<_corner_wait_time> G1 X[[#<_xx> - #<_width> - [#<_margin>]]] F#<_printing_speed> #<_yy> = [#<_yy>+[0.5*#<_l>]] G4 P[#<_corner_wait_time>] ;margin G0 Y[#<_yy>] X[[#<_xx> - #<_width> - [#<_margin>]*1.5]] F[#<_printing_speed> * #<_margin_speed_scalar>] G4 P#<_corner_wait_time> G1 X[#<_xx> ] F#<_printing_speed> #<_yy> = [#<_yy>-[[0.5*#<_l>]-#<_delta>]] G4 P#<_corner_wait_time> ;margin G0 Y[#<_yy>] X[#<_xx> + [#<_margin>/2]] F[#<_printing_speed>*#<_margin_speed_scalar>] G4 P#<_corner_wait_time> o115 endwhile #<_zz> = [#<_zz>+#<_layerH>] G0 Z[#<_zz>] ;#<_step> = 0 #<_xx> = #<_x0> #<_xx> = [#<_x0> + [[0.5*#<_delta>]*[#<_zstep> MOD 2]]] ; causes layers to stager #<_yy> = [#<_y0> - #<_margin>] ;These three lines may turn out to be important ;G1 X[#<_x0> - #<_margin>-5] Y[#<_yy> + #<_margin>+5] F#<_printing_speed> ;G1 X[#<_x0> - #<_margin>-5] Y[#<_yy> + #<_margin>+5] F#<_printing_speed> ;G1 Y[#<_y0>] F#<_printing_speed> #<_step> = 0 o125 while[#<_step> LE [[#<_xstepf>/2]-1]] #<_step> = [#<_step> + 1] o130 if [#<_should_extrude_on_corners> EQ 0] (M5) (Causes stop in spite of G64) o130 endif ;G4 P#<_corner_wait_time> G1 Y[[#<_yy> + #<_l> +[#<_margin>*1.5]]] F#<_printing_speed> #<_xx> = [#<_xx>+[0.5*#<_width>]] G4 P[#<_corner_wait_time>/2] ;margin G0 X[#<_xx>] Y[[#<_yy> + #<_l> + [2*#<_margin>]]] F[#<_printing_speed>*#<_margin_speed_scalar>] ;G4 P#<_corner_wait_time> G1 Y[#<_yy> + [#<_margin>/2]] F#<_printing_speed> #<_xx> = [#<_xx>-[[0.5*#<_width>]-#<_delta>]] G4 P#<_corner_wait_time> ;margin G0 X[#<_xx>] Y[#<_yy>] F[#<_printing_speed>*#<_margin_speed_scalar>] o125 endwhile #<_zz> = [#<_zz>+#<_layerH>] G0 Z[#<_zz>] #<_step> = 0 (z++) #<_zstep> = [#<_zstep> + 1] o110 endwhile G0 X-20 Y-20 Z 20 M5 M30