Skip to content

CAM Post-Processor Optimization — Deep Hole Drilling Cycles

A Tier 1 aerospace shop programming gundrill operations for landing gear components found that its standard Fanuc G83 post-processor was outputting incorrect feed rates during the entry sequence — the spindle ramped to full 4,500 RPM before the tool engaged the pilot hole, causing three consecutive gundrill tip breakages. Rewriting the post-processor to output a custom spindle-speed sequencing routine eliminated the breakages, reduced cycle time by 12 %, and saved $18,000 per month in scrapped tools. The fix: 47 lines of TCL code in the post processor.

The Challenge — Why Standard CAM Cycles Fail for Deep Hole Drilling

Conventional drilling cycles (G81, G83, G73) were designed for twist drills in holes with depth-to-diameter ratios under 10:1. Deep hole drilling — gundrill and BTA — operates at ratios of 50:1 to 300:1 and imposes requirements that standard canned cycles cannot satisfy:

  • Entry sequencing: Gundrills must enter the pilot hole at low RPM (100–300) before ramping to cutting speed (3,000–8,000 RPM). Standard cycles apply cutting speed from the moment of spindle start.
  • Coolant synchronization: High-pressure coolant (80–150 bar) must be activated and stabilised before cutting begins. Standard cycles activate coolant simultaneously with feed.
  • Partial retract strategies: Gundrills must retract only 2–5 mm from the cutting face — not to the clearance plane — to maintain chip evacuation and coolant flow. Full retracts (G83) flush chips back into the hole.
  • Controlled breakthrough: Feed must reduce 50–70 % in the final 2 mm of breakthrough. Standard cycles apply constant feed throughout.
  • Variable peck depth: Shallow pecks at entry, deepening as the tool progresses. Standard cycles use a fixed Q value.

A standard post-processor treats a deep hole drilling operation as it would any other drilling cycle. Optimising the post to handle these five requirements is the difference between a reliable process and recurring tool breakage.

Fanuc — Customising G83 for Gundrill Operations

Fanuc controls are the most common platform for deep hole drilling. The standard deep hole cycle G83 with fixed peck Q is inadequate for gundrill work, but the post-processor can be modified to output a custom sequence.

The entry sequence problem:

Standard G83 output:

txt
G83 Z-100.0 R2.0 Q5.0 F0.08

This activates spindle at full cutting speed before Z reaches the pilot hole entry. The gundrill tip, unsupported until inside the pilot bush, deflects and chips.

Custom post output required:

txt
G00 Z2.0
M05                         (spindle stop)
M51                        (high-pressure coolant ON)
G04 P3000                 (dwell 3 s for coolant pressure)
S1800 M03                 (cutting speed)
G04 P1000                 (dwell 1 s for speed stabilisation)
G01 Z-100.0 F0.08        (feed to depth)
G00 Z2.0                  (rapid retract)
M05                       (spindle stop)
M52                       (coolant OFF)

Post-processor implementation (Fusion 360 / HSM Post):

The Fusion 360 post processor uses the "gun-drilling" cycle type. A known bug overwrites the positioning feedrate with the cutting feed-per-revolution value. The fix adds logic to onLinear():

javascript
if (isDrillingCycle(currentSection) && cycleType == "gun-drilling"
    && getParameter('operation:tool_useFeedPerRevolution') == 0
    && feedFormat.format(feed) == feedFormat.format(
         getParameter("operation:breakThroughFeedPerRevolution"))) {
  feed = getParameter("operation:positioningFeedrate");
}

Mastercam custom cycle implementation:

Mastercam's pdrlcst$ post block supports custom cycles 8–19. A gundrill cycle maps peck1$ to first peck depth, peck2$ to entry feed, and dwell$ to cutting speed:

txt
pdrilldeep        #Custom gundrill cycle
  pdrlcommonb
  start_hgt = peck1$ + 0.1
  drill_feed = peck2$
  
  pbld, n$, *refht$, e$
  pbld, n$, *sg01, *start_hgt, *feed, e$
  pbld, n$, sm05, e$
  pbld, n$, "M51 (HIGH PRESSURE COOLANT ON)", e$
  pbld, n$, *drill_speed, *sm03, e$
  pbld, n$, "G04", "P2000", e$
  pbld, n$, *sg01, pfzout, *drill_feed, strcantext, e$
  pbld, n$, *sm05, e$
  pbld, n$, *sg00, *start_hgt, e$
  pbld, n$, sg00, *clr_hght, e$

The post .txt file must enable the "Subsequent peck" and "Peck clearance" fields in the Mastercam UI to surface peck2$ and peckclr$ for gundrill parameter entry.

Heidenhain — CYCL DEF 241 Single-Lip Deep Hole Drilling

Heidenhain TNC controls (iTNC 530, TNC 640) offer a built-in cycle specifically for single-lip gundrills: CYCL DEF 241 DEEP HOLE DRILLING.

This cycle includes:

  • Special retract patterns with full withdrawal for chip clearance
  • Defined peck increments with intermediate dwell
  • Torque and coolant pressure monitoring on newer controls
  • Single-lip gundrill-specific feed and speed logic

Critical note from Siemens community experts: CYCL DEF 241 does not map cleanly to standard machine cycle output. It is recommended to use single moves output rather than canned cycle output. In NX CAM, this means setting MOM_expand_on/off in the post processor to expand the cycle into individual G01 movements rather than outputting a CYCL DEF 241 call.

UDE mapping for NX to Heidenhain:

NX operation typeHeidenhain UDECycle number
DrillingCYCL DEF 200DRILLING
Deep Hole DrillingCYCL DEF 205UNIVERSAL PECK
Deep Hole Drilling (gundrill)CYCL DEF 241SINGLE-LIP DEEP HOLE
TappingCYCL DEF 207RIGID TAPPING

The UDE must be applied to the correct NX operation type. CYCL DEF 241 only functions when placed on a Deep Hole Drilling operation — not on standard Drilling operations.

Siemens Sinumerik — CYCLE83 Deep Hole Drilling

Siemens Sinumerik controls use CYCLE83 for deep hole drilling. The cycle parameters include:

txt
CYCLE83(RTP, RFP, SDIS, DP, DPR, FDEP, FDPR, DAM, DTB, DTS, FRF, VARI)
ParameterMeaningGundrill recommendation
RTPRetract plane2 mm above workpiece
RFPReference planeTop of workpiece
SDISSafety distance1–2 mm
DPFinal depth
FDEPFirst drilling depth2–3 mm (shallow start)
FDPRFirst depth reduction0 (constant)
DAMSubsequent depth5–15 mm (material dependent)
DTBDwell at depth0.5–2 s for chip break
DTSDwell at start2–3 s for coolant pressure
FRFFeed rate factor0.3–0.5 for entry, 1.0 for cutting
VARI0 = chip break, 1 = full retractUse 0 for gundrill

Post-configurator customisation:

In Siemens Post Configurator, custom TCL procedures can override cycle output:

txt
proc G243_peck_drill {} {
    global mom_cutcom_plane
    if {$mom_cutcom_plane == "YZ"} {
        # Radial drilling on lathe
        MOM_force ONCE G_plane
        MOM_do_template cycle_drill_243
    } else {
        # Axial drilling
        MOM_force ONCE G_plane
        MOM_do_template cycle_drill
    }
}

The critical MOM variables for deep hole drilling in NX CAM:

VariablePurposeUsed in
mom_cycle_step1First peck depthFDEP in CYCLE83
mom_cycle_step2Subsequent peck depthDAM in CYCLE83
mom_cycle_step3Final peck depth (optional)Custom
mom_cycle_rapid_to_pos(2)Z rapid positionRTP
mom_cycle_feed_to_posFinal depthDP
mom_cycle_delayDwell timeDTB
mom_cycle_retract_to_posRetract planeRTP

NX CAM Post Builder — TCL Custom Cycle Scripting

For true gundrill and BTA cycle optimisation, NX Post Builder with TCL scripting offers the most flexibility.

The deep hole drilling custom approach:

Academic research (Huang & Wu, 2019 "Construction and Application of UG Post-Processor Specialized for Deep Hole Drilling") defines the required output sequence:

  1. Low-RPM approach to pilot hole (S200, G01 Z-3.0)
  2. Spindle stop (M05)
  3. Coolant ON, pressure build (M51, G04 P3000)
  4. Cutting speed ramp (S4500 M03, G04 P1000)
  5. Feed to first peck depth (G01 Z-5.0 F0.05)
  6. Partial retract to 2 mm from hole mouth (G00 Z-2.0)
  7. Rapid plunge to 0.5 mm above prior depth (G00 Z-5.5)
  8. Feed to next depth increment (G01 Z-12.0 F0.08)
  9. Repeat until final depth
  10. Reduce feed for breakthrough (G01 Z-101.0 F0.03)
  11. Retract, spindle ramp down, coolant off

TCL implementation in Post Builder:

txt
proc PB_CMD_gundrill_cycle { } {
    global mom_cycle_step1 mom_cycle_step2 mom_cycle_feed_to_pos
    global mom_cycle_rapid_to_pos mom_cycle_delay
    
    # Get parameters from CAM operation
    set first_peck $mom_cycle_step1
    set subsequent_peck $mom_cycle_step2
    set final_depth $mom_cycle_feed_to_pos
    set rapid_plane $mom_cycle_rapid_to_pos(2)
    
    # Output entry sequence
    MOM_output_literal "M05"
    MOM_output_literal "M51 (HP COOLANT ON)"
    MOM_output_literal "G04 P3000"
    MOM_output_literal "S[format "%.0f" $mom_cycle_speed] M03"
    MOM_output_literal "G04 P1000"
    
    # Output peck loop
    set current_z [expr $rapid_plane - $first_peck]
    while {$current_z > $final_depth} {
        MOM_output_literal "G01 Z$current_z F$mom_cycle_feed"
        set retract_z [expr $rapid_plane + 2.0]
        MOM_output_literal "G00 Z$retract_z"
        set plunge_z [expr $current_z + 0.5]
        MOM_output_literal "G00 Z$plunge_z"
        set current_z [expr $current_z - $subsequent_peck]
    }
    
    # Final depth and breakthrough
    MOM_output_literal "G01 Z$final_depth F[expr $mom_cycle_feed * 0.5]"
    MOM_output_literal "G00 Z$rapid_plane"
    MOM_output_literal "M05"
    MOM_output_literal "M52 (HP COOLANT OFF)"
}

Mastercam — Mapping Gundrill Parameters to Post Variables

Mastercam passes drilling parameters from the CAM tree to the post processor through NCI variables. For gundrill cycles, the mapping is:

CAM fieldNCI variableCustom cycle usage
1st peckpeck1$Starting depth into pilot hole
Subsequent peckpeck2$Cutting depth increments
Peck clearancepeckclr$Retract height above hole
Chip break retractretr$Partial retract distance
Dwelldwell$Cutting spindle speed
Feed ratefrplunge$ / feedCutting feed

Deep hole full-retract custom cycle (Mastercam post block):

txt
pdrilldeep
    pdrlcommonb
    pck_amt = peck1$
    drill_dist = -depth$ + tosz$
    pck_no = fmtrnd(drill_dist / pck_amt)
    rtr_hgt = peckclr$
    
    pbld, n$, pxout, pyout, e$
    pbld, n$, sg00, *rtr_hgt, e$
    
    while pck_no > 0, [
        drl_depth = tosz$ - (pck_amt * (pck_no - 0.5))
        pbld, n$, *sg01, *drl_depth, *feed, e$
        pbld, n$, sg00, *rtr_hgt, e$
        pck_no = pck_no - 1
    ]

For Haas controls using the IJK deep hole format:

txt
fmt  I  2   peck2$       #Initial peck
fmt  J  2   peckclr$     #Reduction per peck
fmt  K  2   retr$        #Minimum peck

pmisc1$          #Deep hole cycle with IJK
    pdrlcommonb
    if peck2$ > 0 & retr$ < peck2$,
    [
        pcan1, pbld, n, *sgdrlref, *sgdrill, pfxout, pfyout,
        pfzout, pcout, prdrlout, *peck2$, *peckclr$, *retr$,
        dwell$, *feed, strcantext, e
    ]
    pcom_movea

Coolant Synchronisation — The Critical Sequence

Across all control platforms, the coolant synchronisation sequence follows the same logic:

StepActionPurposeDuration
1Spindle stop (M05)Eliminate windmilling coolant spray0.1 s
2Coolant ON (M51/M08)Activate high-pressure delivery0.5 s
3Dwell (G04)Allow coolant pressure to reach tool tip at full depth2–4 s
4Cutting speed (Sxxx M03)Ramp spindle to operating speed1–2 s
5Dwell (G04)Stabilise speed and coolant flow0.5–1 s
6Feed to depth (G01)Begin cuttingVariable

The total overhead is 4–8 s per hole. For deep holes (500–1,000 mm at 100–200 mm/min feed), this represents less than 5 % of cycle time but is critical for tool life.

If the post-processor does not output steps 1–5, the gundrill enters the hole without stable coolant pressure, leading to:

  • Chip packing in the flute (40 % of gundrill failures)
  • Built-up edge on the cutting tip (25 %)
  • Thermal cracking from uneven cooling (15 %)

BTA Drilling — Post-Processor Considerations

BTA drilling uses a different tooling system (internal chip evacuation through the drill tube) and requires different post-processor logic:

  • Higher coolant volume: BTA systems require 200–600 L/min at 20–60 bar. Coolant must reach full flow before cutting begins.
  • Continuous feed: BTA drills typically run without pecking. The post should suppress any peck cycle and output a single G01 feed to depth.
  • Steady-state cutting: No spindle speed changes during the cut. Speed ramping is only needed at entry and exit.
  • Guide pad burnishing: The post must maintain constant feed through the burnishing zone at hole exit to avoid surface finish degradation.

BTA-specific post output:

txt
G00 Z2.0
M05
M53 (BTA COOLANT HIGH FLOW)
G04 P5000
S800 M03
G04 P2000
G01 Z-500.0 F0.15
G00 Z2.0
M05
M54 (BTA COOLANT OFF)

BTA process simulation (TU Dortmund, Procedia CIRP 2024) validates that post-processor parameters should use validated FE models for feed rates and speeds rather than handbook values, particularly for difficult-to-cut materials where guide pad loading and surface integrity are interdependent.

Simulation and Verification

Before deploying a custom post-processor for deep hole drilling, simulation verification is essential:

VERICUT simulation:

  • Verify custom cycle output against the machine controller
  • Check collision avoidance for extended gundrill assemblies (tool length up to 3,000 mm)
  • Validate coolant staging sequences

hyperMILL Virtual Machining (2024):

  • Open Mind's 2024 release added custom single-tip gundrill tool simulation
  • Precise collision checking with detailed stock removal visualisation
  • Chipbreaker integration and coolant stage identification

NX CAM Post Review:

  • Debug MOM variable values before actual machining
  • Verify mom_cycle_step1/2/3, mom_cycle_rapid_to_pos, and coolant M-code assignments
  • Test with View/Machine Tool Simulation before production

Optimisation by Machine Type

Specific machine types require targeted post-processor adjustments:

Horizontal machining centres:

  • Through-spindle coolant at 80–150 bar is standard
  • Weldon or cylindrical shank holders for gundrill
  • Post must output appropriate tool change macros (M06 with extended tool change)

CNC lathes with driven tooling:

  • Radial drilling cycles (G87 for Fanuc) for cross-hole drilling
  • Spindle orientation (M19) for fixed drilling positions
  • Synchronous spindle speed for counter-rotation drilling

Dedicated gundrill machines:

  • Often use proprietary cycles that standard CAM post-processors don't support
  • May require custom post-processor development from machine builder specifications
  • Typically include automatic guide bushing positioning that must be synchronised with Z movement

Multi-spindle machines:

  • Each spindle may require independent coolant and speed staging
  • Post must sequence operations to avoid simultaneous retract collisions
  • Tool length offsets differ per spindle

Troubleshooting Common Post-Processor Issues

SymptomLikely causeCorrection
Gundrill breaks at entrySpindle ramps to full speed before pilot holeAdd low-RPM approach sequence in post
Chip packing in fluteCoolant not stabilised before cuttingAdd 2–4 s coolant dwell (G04) before feed
Oversize hole at breakthroughFeed not reduced at exitAdd breakthrough feed reduction (50 % of cutting feed)
Surface finish variationPartial retract too far (chips wash back)Limit retract to 2 mm above cutting face
Cycle time too highFull retract (G83) instead of partial retractSwitch to chip-break (G73) or custom cycle
Wrong cycle outputPost mapping mismatchVerify drillcyc$ (Mastercam) or cycleType (Fusion)
Coolant not activatingM-code conflict with machineVerify coolant M-codes in post vs. machine builder manual
Alarm on cycle startCycle parameters exceed machine limitsCheck Q value in G83, peck depth in CYCLE83

Future Directions — Smart Post-Processors

The next generation of post-processor technology for deep hole drilling includes:

AI-assisted parameter selection:

  • Post-processors that read hole aspect ratio, material, and tool geometry from the CAM tree and automatically select peck strategy, coolant staging, and feed/speed ramping.

Digital twin integration:

  • Process models (FE-based, like the TU Dortmund BTA model) feeding recommended parameters directly into the post-processor, eliminating handbook values.

Adaptive cycle output:

  • Post-processors that can switch between gundrill, BTA, and ejector cycle types on the same part, selecting the appropriate output based on hole diameter, depth, and tolerance attributes.

Cloud-based post repository:

  • Shared, validated post-processor configurations for deep hole drilling across machine types and control platforms, maintained and updated by machine builders.

Frequently Asked Questions

  1. Why can't I use standard G83 for gundrill operations? G83 applies full cutting speed immediately and retracts fully per peck, both of which are unsuitable. Gundrills require low-RPM entry, coolant stabilisation dwell, and partial retracts.

  2. Which CAM system has the best built-in gundrill cycle support? NX CAM with Post Builder TCL scripting offers the most flexibility for custom cycles. hyperMILL 2024 added dedicated single-tip gundrill tool simulation. Mastercam supports custom cycles 8–19 in the post processor.

  3. How do I add the gundrill cycle type to Fusion 360? The cycle type string is "gun-drilling" in the post processor. Not all post processors have this logic baked in — you may need to copy gundrill logic from a supported post or customise your own.

  4. What is the most common post-processor error for deep hole drilling? Incorrect feed rate during the entry sequence — the standard post applies cutting feed-per-revolution from the start, which overwrites the positioning feedrate needed for safe pilot hole entry.

  5. Do I need a dedicated post for each machine-control combination? Yes. Gundrill and BTA cycles are machine-specific. A Fanuc-based horizontal machining centre requires different output logic than a Heidenhain-based gundrill machine or a Siemens-based lathe.

  6. How do I test a custom post without risking machine damage? Use CAM simulation tools (VERICUT, NX CAM Post Review, hyperMILL Virtual Machining) to verify tool paths, then dry-run on the machine without a workpiece.

  7. What TCL skills do I need to customise NX Post Builder for deep hole drilling? Variable manipulation, conditional logic (if/while), MOM variable access, MOM_output_literal, MOM_force_once, and understanding of NX CAM operation types.

  8. Can one post handle both gundrill and BTA drilling? Yes, using conditional logic based on tool type or operation name. The post reads mom_operation_type (3000 for drilling) and can branch based on cycle parameters.

  9. How does CAM simulation handle gundrill tool deflection? Most CAM simulators do not model tool deflection. Specialised software (VERICUT Force, hyperMILL Virtual Machining) can approximate deflection but physical validation remains essential.

  10. What is the ROI of custom post-processor development for deep hole drilling? Custom posts typically pay for themselves within 3–6 months through reduced tool breakage, elimination of manual G-code editing, and consistent cycle times.

Summary

Control platformStandard cycleGundrill-optimised cycleCustomisation method
FanucG83Custom sequence with M05/M51/G04/SxxxxPost processor TCL or macro variables
HeidenhainCYCL DEF 205CYCL DEF 241 single-lipUDE mapping or single-moves expansion
Siemens SinumerikCYCLE83CYCLE83 with FRF/DTS/DAMPost Configurator custom TCL
Mastercamppeck$ (G83)pdrlcst$ custom cycle 8–19Post block MP language
Fusion 360 / HSMguided-deep-drillinggun-drilling cycle typeonLinear() feedrate fix
NX CAMcycle_drill_deepTCL custom PB_CMD procedurePost Builder TCL scripting

CAM post-processor optimisation for deep hole drilling is not an optional refinement — it is a prerequisite for reliable gundrill and BTA operations. The five critical sequences (entry speed staging, coolant synchronisation, partial retract, variable pecking, and controlled breakthrough) cannot be achieved with standard drilling cycles. Implementing them requires post-processor customisation using TCL, MP, or JavaScript depending on the CAM platform. The investment in post development is repaid through eliminated tool breakages, consistent process quality, and reduced programmer overhead for manual G-code editing.

Deep Hole Drilling Hub — Your Trusted Third-Party Industry Resource