Originally Posted by
vmax549
You can program for a progressive peck drilling but it is a bit clumsy.
(;-) TP
It depends what you call clumsy. Here is the subroutine that I've used for drilling for the past few years. Its logic should be evident, but I'll help anyone who has questions.
Code:
o <hole_drill> sub
; drill a hole
; current as of 2020-05-06
; Oh 2010-2024
; input
; #<_CBEscalation> from options
; #<_ChipBreakFactor> from options
; #<_CoolantEndRough>
; #<_DeepTestFactor> from options
; #<_FeedEndRough>
; #<_FMinFactor> from options
; #<_FReduction> from options
; #<_HelixAngle>
; #<_ODToBottom>
; #<_OldA>
; #<_PeckMinFactor> from options
; #<_PeckReduction> from options
; #<_PointAngle>
; #<_RetractionLimit> from options
; #<_ShowProgress>
; #<_SMinFactor> from options
; #<_SpeedEndRough>
; #<_SReduction> from options
; #<_ToolOD> from <set_tool>
; #<_ToolRadius> from <set_tool>
; #<_MinutesHere>
; #<_TotalMinutes>
; #<_XCenter>
; #<_YCenter>
; #<_ZBottom>
; #<_ZClear>
; #<_ZTop>
#<FluteUpPerRev> = [3.14159 * #<_ToolOD> / tan[#<_HelixAngle>]]
#<ZBot> = [#<_ZBottom>]
o 2010 if [#<_ODToBottom>]
#<ZBot> = [#<ZBot> - #<_ToolRadius> / tan[#<_PointAngle> / 2]]
o 2010 endif
#<MaxPeck> = [#<_DeepTestFactor> * #<_ToolOD>]
#<MinPeck> = [#<_PeckMinFactor> * #<_ToolOD>]
#<ChipBreak> = [#<_ChipBreakFactor> * #<_ToolOD>]
#<MinFeed> = [#<_FMinFactor> * #<_FeedEndRough>]
#<MinRPM> = [#<_SMinFactor> * #<_SpeedEndRough>]
#<Depth> = [#<_ZTop> - #<ZBot>]
#<ZMaxRetract> = [#<_ZTop> - #<_RetractionLimit> * #<_ToolOD>]
#<InchProg> = 0 ; progress increments
o 2012 if [#<_ShowProgress>] ; ..
#<ProgressHere> = [100 * #<_MinutesHere> / #<_TotalMinutes>] ; ..
#<InchProg> = [#<ProgressHere> / #<Depth>] ; ..
o 2012 endif ; ..
#<Peck> = [#<MaxPeck>] ; initial values
#<Feed> = [#<_FeedEndRough>] ; ..
#<RPM> = [#<_SpeedEndRough>] ; ..
F [#<Feed>] S [#<RPM>] ; needed before starting spindle
#<Pecks> = 0 ; just for DEBUG message
G00 Z [#<_ZClear>] ; start above work
G00 X [#<_XCenter>] Y [#<_YCenter>] ; get ready to cut
o <coolant> call [#<_CoolantEndRough>] ; coolant
M3 ; spindle on
G01 Z [#<_ZTop>] ; G01 to allow imprecise ZTop
#<ZReached> = [#<_ZTop>] ; ..
o 2014 while [#<ZReached> GT #<ZBot>] ; *peck again
F [#<Feed>] S [#<RPM>] ; different from previous peck
G00 Z [#<ZReached>] ; back to uncut metal
; drill down by one peck, or less if that would overshoot bottom
#<UsePeck> = [#<Peck>]
o 2016 if [[#<ZReached> - #<Peck>] LT #<ZBot>] ; *overshot
#<UsePeck> = [#<ZReached> - #<ZBot>] ; ..
o 2016 endif ; .. UsePeck now OK
(debug, usepeck = #<UsePeck>)
G01 Z [#<ZReached> - #<UsePeck>] A [#<_OldA> + #<UsePeck> * #<InchProg>]
#<ZReached> = [#<ZReached> - #<UsePeck>] ; ..
#<_OldA> = [#<_OldA> + #<UsePeck> * #<InchProg>]
#<Pecks> = [#<Pecks> + 1] ; just for DEBUG message
; dwell long enough for chips to ride the flutes to the surface
#<RevsToSurface> = [[#<_ZTop> - #<ZReached>] / #<FluteUpPerRev>]
#<Dwell> = [60 * #<RevsToSurface> / #<RPM>]
(DEBUG, after peck #<Pecks>: dwell #<Dwell> seconds at Z = #<ZReached>)
G04 P [#<Dwell>] ; wait for chips
; retract to break the chip, but not too high
#<ZChipBreak> = [#<ZReached> + #<ChipBreak>] ; tentative
o 2018 if [#<ZChipBreak> GT #<ZMaxRetract>] ; *too high
#<ZChipBreak> = [#<ZMaxRetract>] ; .. use limit
o 2018 endif ; ZChipBreak set
G00 Z [#<ZChipBreak>] ; break the chip
; peck less deeply, run slower, retract more
#<Peck> = [#<_PeckReduction> * #<Peck>] ; adjust peck
o 2020 if [#<Peck> LT #<MinPeck>] ; ..
#<Peck> = [#<MinPeck>] ; ..
o 2020 endif ; ..
#<Feed> = [#<_FReduction> * #<Feed>] ; adjust feed
o 2022 if [#<Feed> LT #<MinFeed>] ; ..
#<Feed> = [#<MinFeed>] ; ..
o 2022 endif ; ..
#<RPM> = [#<_SReduction> * #<RPM>] ; adjust RPM
o 2024 if [#<RPM> LT #<MinRPM>] ; ..
#<RPM> = [#<MinRPM>] ; ..
o 2024 endif ; ..
#<ChipBreak> = [#<_CBEscalation> * #<ChipBreak>]
o 2014 endwhile ; end of one peck
G00 Z [#<_ZClear>] ; finish above work
M5 M9 ; spindle & coolant off
o <hole_drill> endsub ; return to caller