
CNC Programming Core FAQ Answered: Precision, Syntax, and Real-World Constraints
A direct, technically grounded reference for CNC programmers addressing 28 frequently asked questions—covering G-code standards, machine-specific quirks, tolerance validation, toolpath optimization, and vendor-specific behaviors across Haas, Fanuc, Siemens Sinumerik, and Okuma systems.
Every day, CNC programmers face identical questions across shops—from junior machinists troubleshooting a G01 feed override to senior engineers validating cutter compensation on a 5-axis DMG Mori NTX 1000. This article answers the most persistent core FAQs with unambiguous, production-proven responses—not theory, but field-tested facts. We cover G-code interpretation differences between Fanuc 31i-B5 and Siemens Sinumerik 840D sl, explain why G43 H01 fails on Haas VF-2SS when H01 is undefined in the tool table, detail exact repeatability tolerances (±0.0002 in / ±0.005 mm) for linear axes on Okuma MULTUS U3000, and quantify how many microseconds of PLC scan time impact synchronized motion on a Mazak INTEGREX i-200S. No fluff. Just actionable clarity.
What Is the Difference Between Modal and Non-Modal G-Codes?
Modal G-codes remain active until explicitly canceled or replaced by another modal code in the same group. For example, G17 (XY plane selection) stays active until G18 or G19 is issued. Non-modal codes execute only once per block and have no lasting effect. G4 (dwell), G10 (data setting), and G28 (return to reference point) are non-modal. Misunderstanding this causes silent errors: issuing G1 F12.0 then G0 X1.0 Y1.0 retains the feed rate of 12.0 ipm for the next G1 unless overridden—even if 200 lines later. Fanuc 31i-B5 firmware v1.234 enforces strict modal group compliance (Group 1: motion; Group 2: plane selection; Group 3: distance mode), while Siemens Sinumerik 840D sl permits limited cross-group persistence for legacy compatibility—but only in MDI mode.
The risk escalates with canned cycles. G81 (drilling cycle) is modal until canceled by G80. If a programmer inserts G0 Z0.1 mid-cycle without G80, the machine may interpret it as part of the cycle’s return motion, causing overtravel on a Haas VF-4 with Z-axis travel of 24.0 in. Always verify modal state using the Program Status screen on Fanuc controls or Active G-Functions tab in Sinumerik ShopMill.
Common Modal Group Conflicts
- Group 5 (Feed Rate Mode):
G94(units/min) vs.G95(units/rev). Switching fromG94 F80.0toG95 F0.005without reissuing the feed value causes the controller to retain the previous F-value—resulting in unintended feed rates during threading. - Group 6 (Units):
G20(inches) andG21(mm) are mutually exclusive. On Okuma OSP-P300A, issuingG20afterG21does not auto-convert existing tool offsets—tool lengthH05 = 150.0remains 150.0 mm, not 5.91 in, risking Z-axis crash. - Group 7 (Coordinate System):
G54–G59persist across power cycles on Haas VF-2SS but reset toG54on Mazak QTU-200 after emergency stop recovery.
How Do Tool Offsets Actually Work in Practice?
Tool offsets are not simple additions to coordinates—they are applied in a fixed sequence defined by ISO 6983-1 and implemented with hardware-level precision. On a Fanuc 31i-B5, the control applies offsets in this order: geometry offset (Hxx) → wear offset (Dxx) → tool nose radius compensation (G41/G42) → coordinate system shift (G54). Each stage operates at sub-micron resolution: geometry offsets resolve to 0.0001 mm (0.000004 in), while wear offsets use 0.001 mm increments. Critically, H00 disables geometry offset but does not disable wear offset—D01 remains active unless explicitly zeroed. This caused a documented scrap event at a Tier-1 aerospace supplier machining Inconel 718 turbine blades on a DMG Mori NTX 1000: an operator cleared H03 but left D03 = -0.012 mm, resulting in 0.024 mm undersize on critical airfoil radii.
Geometry offsets store tool length (Z) and diameter (X for turning, D for milling). On Okuma MULTUS U3000, tool length is stored as absolute machine coordinate (e.g., H01 = -427.321 mm means the tool tip is 427.321 mm below the Z-machine zero). Wear offsets adjust for tool degradation: D01 = +0.008 mm adds 0.008 mm to the geometry length, effectively shortening the tool’s reach. Never confuse H and D: H is measured; D is adjusted.
Real-World Offset Validation Protocol
- Touch off tool against qualified master gage block (e.g., Mitutoyo 516-321, certified ±0.2 µm) on granite surface plate.
- Enter geometry value into control using
G10 L2 P1 Z[measured_value](Fanuc) orTOFSET(1,0,0,[measured_value])(Sinumerik). - Run dry-cut verification path: 10 mm linear move at 0.1 mm depth, measure actual position with Renishaw OMP60 probe (repeatability ±0.5 µm).
- If deviation > ±0.002 mm, inspect spindle thermal drift (Haas VF-2SS exhibits 0.004 mm Z-drift over 30 min at 12,000 rpm).
Why Does G43 H01 Sometimes Fail Even When H01 Exists?
This error occurs due to three distinct, verifiable conditions—not software bugs. First, H01 must be physically present in the tool table memory. On Fanuc 31i-B5, tool data resides in RAM address range 0x2000–0x3FFF; if memory corruption occurs (e.g., after abrupt power loss), H01 reads as null despite display showing a value. Second, the tool must be enabled: Okuma OSP-P300A requires T01 M06 to activate H01; issuing G43 H01 before tool change returns alarm 012 “Tool Not Selected.” Third, axis-specific validity: H01 stores Z-length but no X-diameter; calling G43 H01 in a lathe program where X-offset is required triggers alarm 027 “Invalid Tool Number” on Mazak QTU-200.
Validation steps: On Haas VF-4, press Settings → Tool Data → scroll to H01. If value displays as *** instead of numeric, memory is corrupted—perform Tool Table Reset (not full memory clear). On Siemens Sinumerik 840D sl, run TOOL_DATA(1) in MDI: returns [LZ, LX, LD, R, Q] array; if LZ = 0.0, geometry is uninitialized. Never assume display accuracy—always query programmatically.
What Are the Actual Tolerance Limits for Linear Axes?
Repeatability, not accuracy, defines real-world capability. Per ISO 230-2:2014, linear axis repeatability is measured as the maximum deviation of 30 consecutive moves to the same target position. Verified test data from factory acceptance tests:
| Machine Model | X-Axis Repeatability (mm) | Z-Axis Repeatability (mm) | Test Standard | Ballbar Measurement (mm) |
|---|---|---|---|---|
| Haas VF-2SS | ±0.0045 | ±0.0052 | ISO 230-2:2014 | 0.012 |
| Fanuc Robodrill α-D14MiB | ±0.0021 | ±0.0023 | ISO 230-2:2014 | 0.005 |
| Okuma MULTUS U3000 | ±0.0038 | ±0.0041 | ISO 230-2:2014 | 0.009 |
| DMG Mori NTX 1000 | ±0.0029 | ±0.0033 | ISO 230-2:2014 | 0.007 |
Note: These values assume ambient temperature 20 ±1°C, stabilized for 4 hours, and no cutting load. Under continuous 12,000 rpm milling, Haas VF-2SS Z-axis drift reaches ±0.018 mm after 45 minutes—requiring thermal compensation via G10 L2 P1 Z[comp_value] updated every 10 minutes. Ballbar results reflect dynamic contouring error, critical for circular interpolation: a 0.012 mm ballbar deviation on Haas VF-2SS translates to ±0.0085 mm radial error on a Ø50.0 mm pocket.
Always validate with physical measurement. A Renishaw XK10 laser calibration system measures axis linearity to ±0.001 mm over 1 m. If your shop lacks one, use a certified 1-2-3 block (e.g., Starrett 1000-2-3, grade AA, ±0.0001 in) and dial indicator (Mitutoyo 293-831-30, resolution 0.00005 in) at three points per axis. Deviation > 70% of published repeatability warrants service call.
How Does Cutter Compensation (G41/G42) Really Calculate Path Offset?
Cutter compensation does not simply add radius to coordinates—it performs real-time vector math using the current tool orientation, feed direction, and programmed path geometry. When G41 is active, the control calculates the compensated path as the locus of points located exactly R (tool radius) to the left of the programmed path’s tangent vector. This requires continuous derivative computation: for a programmed arc G2 X2.0 Y1.0 I0.5 J0.0 R0.5, the control solves for the offset arc center that maintains constant perpendicular distance R from all points on the original arc.
Three failure modes dominate:
First, lead-in/lead-out violations. G41 requires a straight-line approach vector of ≥3× tool diameter before the first compensated move. On Fanuc 31i-B5, violating this triggers alarm 040 “Cutter Comp Not Valid”; on Haas VF-2SS, it executes but produces gouges. Second, sharp corner issues: a programmed 90° corner with G41 active forces the control to insert a circular blend with radius equal to tool radius—unless G64 P0.001 (exact stop) is set. Third, radius programming conflict: if G41 is active and G2 uses R format (not I/J), the control cannot resolve the offset path uniquely—Siemens 840D sl rejects it outright; Fanuc 31i-B5 defaults to I/J calculation, often yielding incorrect centers.
Always use I/J for arcs under compensation. Verify offset paths offline: Mastercam 2024’s Verify G-Code shows compensated tool centerline in red; compare against raw CL data. Discrepancies > 0.005 mm indicate either incorrect tool radius entry or invalid lead-in geometry.
Valid Lead-In Geometry Examples
- Acceptable:
G0 X0.0 Y0.0→G1 X2.0 Y0.0 F150.0→G41 D01→G1 X2.0 Y1.0(2.0 in lead-in ≥ 3× 0.25 in end mill) - Unacceptable:
G0 X0.0 Y0.0→G41 D01→G1 X2.0 Y0.0(no pre-compensation move) - Marginally Acceptable:
G0 X0.0 Y0.0→G1 X1.2 Y0.0 F150.0→G41 D01→G1 X1.2 Y1.0(1.2 in lead-in = 4.8× radius for 0.25 in tool; meets Haas spec but violates Fanuc’s 5× recommendation)
What Causes Unexpected Feed Rate Changes During Machining?
Feed rate deviations stem from three deterministic sources—not controller “glitches.” First, acceleration/deceleration limits: all modern controls enforce jerk-limited motion. Fanuc 31i-B5 uses default acceleration of 0.2 G (1960 mm/s²) on linear axes; traversing a 0.1 mm radius corner at 1200 mm/min forces instantaneous deceleration to ≤300 mm/min to stay within jerk limits. The control displays F1200 but executes lower—verified via Fanuc’s Feed Override Monitor showing real-time F_ACT values.
Second, look-ahead buffer limitations. Fanuc 31i-B5 buffers 200 blocks; Siemens 840D sl buffers 500. When complex 5-axis toolpaths exceed buffer capacity, the control reduces feed to maintain smooth motion—observable as rhythmic speed drops every 200 blocks on Fanuc. Third, spindle load feedback: Haas VF-2SS automatically reduces feed by up to 30% when spindle load exceeds 85% for >2 seconds, per parameter #2015 (Feed Hold Load Limit). This is intentional protection—not a fault.
To diagnose: Enable Real-Time Feed Display (Fanuc: SYSTEM → MONITOR → FEED; Haas: Settings → Display → Feed Rate Actual). If F_ACT dips below F_CMD consistently at corners, increase acceleration parameters (Fanuc #1620–#1622) or simplify path geometry. If drops occur periodically, split long programs into subroutines under 150 blocks.
How Do Different Controllers Handle Subroutine Calls and Loops?
Subroutine behavior varies by architecture. Fanuc 31i-B5 supports nested subroutines to level 4 (e.g., O1000 calls O1001, which calls O1002, etc.) and allows local variables #100–#199 that persist only within the subroutine scope. Siemens Sinumerik 840D sl uses CALL with parameter passing: CALL L1000 P1=10.5 P2=20.0 passes values to formal parameters Q1 and Q2 inside L1000. Okuma OSP-P300A uses M98 P1000 L5 for 5 repeats but prohibits nesting entirely—calling M98 from within O1000 triggers alarm 051.
Loop timing is critical for cycle time estimation. Fanuc 31i-B5 executes GOTO in 12 µs; WHILE loop overhead is 45 µs per iteration. On a 10,000-iteration loop, that’s 450 ms pure overhead—enough to skew cycle time by 2.1% on a 35-second operation. Avoid loops for repetitive geometry: use G10 to generate patterns or external CAM-generated subroutines.
Always validate subroutine scope. In Fanuc, #100 set in O1000 is inaccessible in O1001 unless passed via M98 P1001 L#100. Misusing global variables (#500–#999) across subroutines caused a documented collision on a Mazak INTEGREX i-200S: O1000 wrote #501 = 12.5, then O1001 read #501 expecting 0.0, moving the B-axis 12.5° unintentionally.
Final note: never rely on default behavior. Read the machine’s Parameter Manual—not just the programming manual. Fanuc Parameter #6031 controls whether G43 activates wear offset; Siemens MD 21050 determines if G41 validates lead-in length. These are shop-floor realities—not academic abstractions.
For high-precision work, log every offset change: Haas VF-2SS supports Tool Change Log (enable via parameter #131), recording timestamp, tool number, geometry/wear values, and operator ID. At Boeing’s Everett facility, this log reduced setup-related scrap by 68% over 18 months by enabling root-cause analysis of dimensional drift.
When debugging, start physical: verify tool lengths with a Renishaw NC4 probe (repeatability ±0.5 µm), check coolant temperature (target 20 ±2°C for aluminum), and confirm air pressure (minimum 90 psi for Haas pneumatic drawbars). Software issues cause <5% of CNC faults—the rest are mechanical, thermal, or procedural.
Remember: G-code is a contract between programmer and machine. Every line must be provably correct—not merely syntactically valid. That means testing G43 H01 with a dial indicator, validating G41 paths with edge finders, and measuring feed rates with tachometers—not assuming the display tells the whole story.
The difference between a good program and a production-ready one is 0.0005 mm of validation—and 37 seconds of documented offset verification. Do the math. Then do the measurement.
Modern CNC isn’t about writing code—it’s about eliminating ambiguity. Every H, every G, every F must resolve to a physical, measurable reality. That’s the core. Everything else is noise.
If your shop runs Fanuc 31i-B5, print Parameter Manual Volume II, section 6.2.3 (Tool Offset Processing Logic). If you run Okuma OSP-P300A, open the Tool Data Structure Reference PDF—pages 17–22 define exactly how Hxx and Dxx map to memory addresses. These documents contain the truth. Your machine’s behavior is defined there—not in forums or YouTube tutorials.
Stop guessing. Start measuring. And always, always verify offsets before cutting metal.
There is no substitute for physical validation. No simulation replaces a 1-2-3 block and a dial indicator. No manual supersedes the parameter sheet. The core of CNC programming is rigor—not ritual.
That’s why these FAQs matter: they’re not trivia. They’re the difference between a part that passes CMM inspection and one that goes to scrap. Between a spindle that lasts 12,000 hours and one replaced at 3,000. Between a shop that ships on time and one perpetually firefighting.
So read the manuals. Calibrate the probes. Log the changes. And write code that leaves zero room for interpretation.


