; === HELICAL MILLING === ; Helix-mill a hole. ; Assumes metric, XY plane, feedrate, and tool compensation 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# G0 Z# # = # ; Mill out body with several full helical turns O100 while [ # GT [ # + #<_zstep> ] ] # = [ # - #<_zstep> ] G2 I# J0 Z# O100 endwhile G2 I# J0 Z# ; Flat out the bottom G2 I# J0 O endsub ; === SCREW/NUT POCKETING === ; Mill a pocket for a screw head. ; Assumes metric, XY plane, feedrate, and tool diameter are set. O sub # = #1 ; [mm] X center # = #2 ; [mm] Y center # = #3 ; [mm] Screw head thickness # = #4 ; [mm] Screw head depth ; Initial position G0 X# Y# ; Cutter compensation to the right. G42 ; Make a pocket for screw head. # = # O100 while [ # GT [ #5410 / 2 ] ] O call [#] [#] [#] [0.] [-#] # = [ # - #5410 * 0.9 ] ; Subtract 90% tool diameter G0 Z0.0 ; Get tool up for another plunge O100 endwhile ; Cleanup. G40 G0 Z#<_zsafe> O endsub ; --- BEGIN CONFIGURATION --- ; Don't forget to set up tool table. T2 M6 S2500 F300 ; 3.175mm cylindrical #<_zsafe> = 10. ; [mm] Safe Z #<_zstep> = 3. ; [mm] Z step #<_thickness> = 12.7 ; [mm] Sheet thickness #<_head_radius> = 6. ; [mm] Screw head radius #<_head_depth> = 8. ; [mm] Screw head depth ; --- END CONFIGURATION --- G21 G90 G17 ; Metric, Absolute, XY plane M3 /O call [0] [0] [#<_head_radius>] [#<_head_depth>] O call [0] [130] [#<_head_radius>] [#<_head_depth>] O call [0] [260] [#<_head_radius>] [#<_head_depth>] O call [150] [0] [#<_head_radius>] [#<_head_depth>] O call [150] [130] [#<_head_radius>] [#<_head_depth>] /O call [150] [260] [#<_head_radius>] [#<_head_depth>] G0 Z#<_zsafe> M2