;Original Code by Dustin Neumann, Modified by Dane Ocampo and Egan Schmidt Weiss for 2GBP G21 (mm) G90 (Absolute distance mode) G55 (Machine Plane Coordinates) G64 (Turn off exact stop check) o call ;#######################################[ P A R A M E T E R S ]######################################## ; HV Levels #<_ep_hvlevel> = 2200 #<_es_hvlevel> = 15000 ; Movement Speed #<_speed> = 1100 #<_mss> = 1.25 (1.28) (Margin Speed Scalar: the return speed on the margin) #<_ext_rate> = 0.000000000025 ;extrude #<_purge_ext_rate> = 0.001 ;purge extrusion rate #<_reverse> = 0.005 (extruder back up, used before inter-layer pauses) #<_corners> = 0 (1 extrude on corners, 0 no extrude on corners) #<_margin> = 8 #<_lo> = 2 ; loop offset, used to prevent errors from turn-arounds at row ends #<_pause> = .0001 (wait time, used at corners) ;originally .0001 ; Work Dimensions #<_l> = 36 (mm length) #<_width> = 36 (mm width of entire matrix) #<_delta> = .75 (mm inter-row & column spacing) #<_layerH> = .08 (mm half-layer height) ; Boolean Values #<_last_layer> = 1 (0 if true, achieves NF as top layer instead of FF) ;#######################################[ I N I T I A L I Z E ]######################################## ;coordinates #<_z0> = 3 (Initial Height of Needle Tip in mm) #<_zz> = #<_z0> #<_x0> = 0 (initial x) #<_xx> = #<_x0> (x) #<_y0> = 0 (initial y) #<_yy> = #<_y0> (y) ;counters #<_zstep> = 0 #<_step> = 0 #<_done> = 0 ;counter maximums #<_layers> = 15 ;total number of alternating layers NF and FF (not incl. last NF layer) #<_ystepf> = FIX[#<_l>/#<_delta>] (FIX operator rounds the argument down to integer) #<_xstepf> = FIX[#<_width>/#<_delta>] ;######################[ M A T R I X C O D E ]################################ G1 X[#<_xx>] Y[#<_yy>] Z[#<_zz>] F#<_speed> ;M68 E0 Q2 ;turn on HV o110 while [#<_zstep> LE FIX[[#<_layers>]]] ;#########[ P U R G E C O D E ]####################### #<_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 o call [#<_purge_ext_rate>] [#<_ep_hvlevel>] o105 while [#<_step> LE 20] ;#<_yy> = [#<_yy> + #<_delta>] (shows iterations for debugging) #<_xx> = [#<_xx> + 0.5*#<_width>*[2*[#<_step> MOD 2]-1]] ;note: [2*[#<_step> MOD 2]-1]] alternates between +/-1 with each step G1 X[#<_xx>] F#<_speed> #<_step>=[#<_step> + 1] o105 endwhile o call ;###############[ E N D P U R G E C O D E ] ######################## ;reset variables assumed to have previously stated initial values #<_zz> = [#<_zz>+#<_layerH>] #<_xx> = #<_x0> #<_yy> = #<_y0> #<_step> = 0 G0 Z#<_zz> #<_xx> = [#<_l> + #<_margin>*0.5] #<_yy> = [#<_y0> + [[0.5*#<_delta>]*[#<_zstep> MOD 2]]] ; causes layers to stagger ;Start of making the matrix o call [#<_ext_rate>] [#<_ep_hvlevel>] o115 while [#<_step> LE [[#<_ystepf>/2]-1]] #<_step> = [#<_step> + 1] G1 X[[#<_xx> - #<_width> - [#<_margin>]]] F#<_speed> #<_yy> = [#<_yy>+[0.5*#<_l>]] G4 P[#<_pause>] ;margin G0 Y[#<_yy>] X[[#<_xx> - #<_width> - [#<_margin>]*1.5]] F[#<_speed> * #<_mss>] G4 P#<_pause> G1 X[#<_xx> ] F#<_speed> #<_yy> = [#<_yy>-[[0.5*#<_l>]-#<_delta>]] G4 P#<_pause> ;margin G0 Y[#<_yy>] X[#<_xx> + [#<_margin>/2]] F[#<_speed>*#<_mss>] G4 P#<_pause> o115 endwhile ;#########[ P U R G E C O D E ]####################### #<_yy> = [#<_yy> + #<_l> + 20] ;position purge routine (y) #<_xx> = [#<_xx> - #<_width> + 7] ;position purge routine (x) G0 Y[#<_yy>] Z10 ;position purge routine (split up into two to avoid depositing fiber on matrix) G4 P#<_pause> ;position purge routine G0 X[#<_xx>] Z10 ;position purge routine o call [#<_purge_ext_rate>] [#<_ep_hvlevel>] o120 while [#<_step> LE [[#<_ystepf>/2]-1+20]] ;#<_yy> = [#<_yy> + #<_delta>] (shows iterations for debugging) #<_xx> = [#<_xx> + 0.5*#<_width>*[2*[#<_step> MOD 2]-1]] ;note: [2*[#<_step> MOD 2]-1]] alternates between +/-1 with each step G1 X[#<_xx>] F#<_speed> #<_step>=[#<_step> + 1] o120 endwhile o call ;###############[ E N D P U R G E C O D E ] ######################## #<_zz> = [#<_zz>+#<_layerH>] G0 Z[#<_zz>] #<_xx> = #<_x0> #<_xx> = [#<_x0> + [[0.5*#<_delta>]*[#<_zstep> MOD 2]]] ; causes layers to stagger #<_yy> = [#<_y0> - #<_margin>] #<_step> = 0 o call [#<_ext_rate>] [#<_ep_hvlevel>] o125 while[#<_step> LE [[#<_xstepf>/2]-1]] #<_step> = [#<_step> + 1] G1 Y[[#<_yy> + #<_l> +[#<_margin>*1.5]]] F#<_speed> #<_xx> = [#<_xx>+[0.5*#<_width>]] G4 P[#<_pause>/2] ;margin G0 X[#<_xx>] Y[[#<_yy> + #<_l> + [2*#<_margin>]]] F[#<_speed>*#<_mss>] ;G4 P#<_pause> G1 Y[#<_yy> + [#<_margin>/2]] F#<_speed> #<_xx> = [#<_xx>-[[0.5*#<_width>]-#<_delta>]] G4 P#<_pause> ;margin G0 X[#<_xx>] Y[#<_yy>] F[#<_speed>*#<_mss>] o125 endwhile #<_zz> = [#<_zz>+#<_layerH>] G0 Z[#<_zz>] #<_step> = 0 o call ;============================[ E L E C T R O S P U N L A Y E R ]================================ o111 if [[#<_last_layer> EQ 1]] ;electrospin 1 layer for every 3 printed layers G1 Z[#<_zz> + 100] F2000 ;Go up a section. o call [1.5] [#<_es_hvlevel>];increment voltage to pull on fiber, extrude at 1.5mL/hr with hv on G4 P5 ;pause for 5 seconds to allow for deposition, preventing loose fiber from landing on the matrix. G1 Z[#<_zz> + 200.1] F2000 ;200.1 mm = 7.88 in #<_yy> = [#<_yy> + #<_l>/2] ;position purge routine (y) ;#<_xx> = [#<_xx> - #<_width>/2] ;position purge routine (x) G0 Y[#<_yy>] ;move y-axis to center of matrix G4 P180 ;electrospin for 180s (3 min) o call ;stop extruding and hv off G0 Y55 F200 ;Prevent drips onto matrix G1 Z[#<_zz>] F2000 ;quick move back to where it was (G0 causes error) o111 endif ;============================[ N E A R - F I E L D C H E C K E R ]=============================== #<_zstep> = [#<_zstep> + 1] o130 if [#<_zstep> EQ #<_layers>] #<_last_layer> = 0 ;Checks to see if last layer. If so, set true (0) and skip FF last layer to end on NF o130 endif o110 endwhile o call ;################################[ F I N I S H I N G S E Q U E N C E ]################################### G1 Y-30 ;Move out of the way M2 ;End Program