; "Tabbed" container wall. Tabs comprise 1/3 of length. ; Optionally, tab on right edge may be omitted. ; Assumes G41 O sub # = #1 # = #2 # = #3 # = #4 ; 0 or 1; 1 means tab, 0 means slot) # = #5 ; -//- # = #6 # = #7 ; 0 or 1; 1 means initial plunge ; Initial point G0 X[# * #<_thickness>] Y[# * #<_thickness>] O100 if [#] G0 Z0 O100 endif G1 F#<_plunge> Z# ; Left edge F#<_feed> Y[# / 3] X[[1 - #] * #<_thickness>] Y[# / 3 * 2] X[# * #<_thickness>] Y[# - [# * #<_thickness>]] ; Top edge X[# / 3] Y[# - [1 - #] * #<_thickness>] X[# / 3 * 2] Y[# - # * #<_thickness>] X[# - [# * #<_thickness>]] ; Right edge O110 if [#] Y[# * #<_thickness>] O110 else Y[# / 3 * 2] X[# - [1 - # ] * #<_thickness>] Y[# / 3] X[# - # * #<_thickness>] Y[# * #<_thickness>] O110 endif ; Bottom edge X[# / 3 * 2] Y[[1 - #] * #<_thickness>] X[# / 3] Y[# * #<_thickness>] X[# * #<_thickness>] O endsub ; "Tabbed" container wall. Tabs comprise 1/3 of length. O sub # = #1 # = #2 # = #3 ; 0 or 1; 1 means tab, 0 means slot) # = #4 ; -//- # = #5 ; 0 or 1; 1 means no right tab # = [-#<_step>] # = 1 G41 ; Cutter compensation to the left O100 while [# GE -#<_thickness>] O call [#] [#] [#] [#] [#] [#] [#] # = [# - #<_step>] # = 0 O100 endwhile O110 if [# NE -#<_thickness>] O call [#] [#] [-#<_thickness>] [#] [#] [#] [0] O110 endif G40 ; Pause between workpieces G0 Z#<_zsafe> M1 O endsub ; Offset G55 coordinate system based on G54 O sub # = #1 # = #2 G10 L2 P2 X[#5221 + #] Y[#5222 + #] Z#5223 R#5230 O endsub ; Helix-mill a hole. ; Assumes metric, XY plane, feedrate, and tool diameter are set. O sub # = #1 ( [mm] X center ) # = #2 ( [mm] Y center ) # = #3 ( [mm] Hole radius ) # = #4 ( [mm] Z start position ) # = #5 ( [mm] Z end position ) G0 X# Y# # = # G42 ; Cutter compensation to the right ; Cutter compensation entry F#<_feed> G1 X[ # - # ] Y# G1 Z# ; Mill out body with several full helical turns O100 while [ # GT [ # + #<_step> ] ] # = [ # - #<_step> ] G2 I# J0 Z# O100 endwhile G2 I# J0 Z# ; Flat out the bottom G2 I# J0 G40 G0 Z#<_zsafe> O endsub ( === BEGIN PARAMETERS === ) ; Metric, Absolute, XY plane G21 G90 G17 ; Safe Z level (above workpiece) #<_zsafe> = 25. ; Feeds/speeds for milling acrylic. *DO NOT FORGET COOLANT* S7000 #<_thickness> = 3. #<_step> = 0.4 #<_feed> = 600. #<_plunge> = 100. ; Box size # = 240. ; X # = 33. ; Y # = 26. ; Z ; Outflow pipe radius # = 3. ; Offset between workpieces # = 10. ( === END PARAMETERS === ) ; G54 contains base offset, G55 is for current workpiece G55 T1 M6 ; 1mm cylindrical M3 ; Spindle on ; Left/right walls O call [0] [0] O call [#] [#] [1] [1] [1] ; xtab ytab flat O call [# + #] [0] O call [#] [#] [1] [1] [1] ; Front/back walls O call [0] [# + #] O call [#] [#] [1] [0] [1] ; xtab !ytab flat O call [# + #] [# + #] O call [#] [#] [1] [0] [1] ; Bottom wall O call [[# + #] * 2] [# + #] O call [# / 2] [10.0] [#] [0] [-3.0] O call [#] [#] [0] [0] [0] ; !xtab !ytab !flat ; Finalize G0 Z#<_zsafe> G54 M2