Fundamentals

G-Code & M-Code Basics

Basics

A beginner's primer on reading and writing CNC programs: blocks and words, modal vs non-modal codes and modal groups, the common G-code and M-code tables, feeds and speeds, and a complete first program walked line by line.

Coordinate Systems & Offsets

Basics

A cross-control primer on CNC coordinate systems: machine vs work coordinates, the reference point, work offsets G54–G59 and the extended set, G52/G92/external offsets, how each control (Fanuc, Haas, Mazak, Mitsubishi, Siemens, Heidenhain, Okuma) names its offset registers, and how to set an offset manually, with G10, or from a macro.

Tool Length & Cutter Comp

Basics

Fundamentals of tool length compensation (G43/G44/G49) and cutter radius compensation (G40/G41/G42): the gauge line, H and D codes, geometry vs wear, offset memory types A/B/C, tool-nose-radius comp for turning, and how Fanuc, Haas, Siemens, Heidenhain, and Okuma each store the data.

Canned Cycles

Basics

Cross-control reference for hole-making canned (fixed) cycles: the Fanuc/ISO G73-G89 set, address words G98/G99/R/Z/Q/P/F/K, rigid tapping, worked drill/peck/tap examples, and the Siemens CYCLE8x and Heidenhain CYCL DEF equivalents.

What Is a Macro? (Start Here)

Basics

A beginner's on-ramp to CNC macro programming for machinists who already write G-code: what macros are, why they matter, variables, math, loops, passing arguments with G65, and a complete first macro worked line by line.

Reading & Writing System Variables

Basics

The cross-control concept: how a part program reads and writes the control's internal data — positions, offsets, tool data, probe results, modal state — in Fanuc, Haas, Mitsubishi, Mazak, Siemens, Heidenhain, and Okuma dialects, with a Rosetta-stone syntax table.

CNC Glossary

Basics

A cross-control glossary of the terms a CNC programmer meets every day — machine and motion, coordinate systems and offsets, tooling, program structure, macros and variables, probing, and the major control platforms — each with a concise, plain-language definition.

Advanced Topics

Threading & Rigid Tapping

Reference

How to cut threads on any CNC control: rigid tapping (Fanuc M29/G84, Haas, Brother, Siemens CYCLE84 and G331/G332, Heidenhain Cycle 207), single-point lathe threading with a G32/G33 macro loop, and thread milling by helical interpolation — with the feed/lead arithmetic and the gotchas.

DNC, Drip-Feed & File Transfer

Reference

How CNC programs get from the CAM computer to the control — RS-232, USB, Ethernet, and network shares — and how drip-feed / DNC runs programs too big for control memory, including M198 and EXTCALL.

Post-Processors & CAM

Reference

What a CNC post-processor actually decides, how the same operation posts differently on Fanuc, Haas, Siemens, Heidenhain, and Mazak, why daily hand edits at the control mean the post is wrong, and a practical checklist for verifying a post before trusting it.

High-Speed Machining & Look-Ahead

Advanced

Why 3D surfacing programs run slow or leave facets, and what the control-side HSM levers actually do: block processing rate arithmetic, look-ahead buffers, smoothing modes per control (Fanuc G05.1 AICC, Haas G187, Siemens CYCLE832, Heidenhain Cycle 32, Mazak, Brother, Okuma), and how to match CAM chord tolerance to the control's tolerance band.

4th/5th Axis, TWP & TCP

Advanced

A cross-control primer on rotary and 5-axis programming: machine kinematics (head/table/mixed), 3+2 tilted work planes (Fanuc G68.2/G53.1, Haas G268 & DWO, Siemens CYCLE800, Heidenhain PLANE SPATIAL), tool center point control (G43.4, M128/TCPM, TRAORI, Haas TCPC), inverse-time feed, singularities, rotary probing, and a sane adoption path from indexing to simultaneous 5-axis.

Turning & Lathe

Fanuc Turning (Fanuc-T)

Basics

Fanuc lathe programming for mill programmers: diameter-mode X, G-code systems A/B/C, G96 constant surface speed with the G50 clamp, the G70–G76 multiple repetitive cycles with a full worked G71/G70 program, G76 threading word by word, nose-radius compensation and tip-direction numbers, and T0101 offset mechanics.

Fanuc-T System Variables

Reference

Fanuc lathe (0i-T/30i-T) system variable reference for macro programming: the X/Z/R/T wear and geometry offset variable blocks, work shift, diameter-mode position reads, and a worked in-process gauging macro that writes X wear offsets.

Haas Lathe (ST)

Basics

Programming Haas ST-series lathes: G71/G70 roughing and finishing in Haas single-block format, G76 threading word by word, nose-radius compensation, live tooling and C-axis work with M133/M154, and how the mill macro layer carries over to turning.

Okuma OSP Turning

Reference

Programming Okuma LB and Genos lathes on the OSP control: zero offsets instead of G54, the LAP contour-roughing cycles (G81/G80 definition, G85/G87 calls), G96 constant surface speed, G33 threading with VC-variable pass loops, and a Fanuc-to-OSP translation table.

SINUMERIK Turning

Reference

SINUMERIK 828D / 840D sl lathe programming guide: diameter programming (DIAMON/DIAMOF/DIAM90), constant surface speed with G96 and LIMS, CYCLE95 stock removal, CYCLE97 threading, tool nose compensation with cutting-edge position, and TRANSMIT/TRACYL live tooling.

Mazak Turning & Integrex

Reference

Programming Mazak QT-series lathes and Integrex multi-tasking machines: how MAZATROL turning programs are built from units, EIA/ISO in Fanuc-style lathe conventions, work transfer and B-axis milling on Integrex, thread cutting in both languages, and when to go conversational vs CAM-posted G-code.

Fanuc

Running a Program at the Control

Basics

How to actually run an NC program on a Fanuc 30i/31i/32i: which operating mode runs a program, selecting the program with an O-number search, getting the cursor back to the program head, why sequence-number search does not rebuild modal state, Program Restart P type vs Q type, and the alarms you hit before the first chip.

Series & Generation Guide

Basics

Which Fanuc do I have? The control lineup decoded: Series 0, 15, 16/18/21, 16i/18i/21i, 0i, 30i/31i/32i-A/-B/-B Plus and Power Mate, with the B-number manual system, identification tips, and what each generation added for the programmer.

MANUAL GUIDE i

Basics

How FANUC MANUAL GUIDE i conversational programming works: the all-in-one screen, how G1xxx machining-cycle and figure blocks are inserted into an ordinary ISO G-code program, the full milling and turning cycle library with G-number ranges, free-form contour programming, NC program conversion, when to use MANUAL GUIDE i vs raw G-code vs CAM, and how the iHMI Machining Cycle screens carry the same cycles forward on Plus-era controls.

System Variables

Reference

Complete Fanuc CNC system variable reference with read/write flags: macro arguments, tool offsets, work offsets, live positions, skip/probe results, modal codes, timers, and alarms — plus worked read/write examples.

Tool Offset Variables

Reference

Fanuc system variables for reading and writing tool length and diameter offsets including geometry, wear, and offset memory types A, B, and C.

Modal & Position Data

Reference

Fanuc system variables for modal G-code groups (#4001-#4130), machine/work position data (#5001-#5088), and work coordinate offsets (#5201-#7948).

Parameters

Reference

Reference for Fanuc CNC parameters including bit-level parameter guide and common parameter settings.

Alarms & Diagnostics

Reference

Reference for Fanuc 30i/31i/32i alarms and diagnostics: alarm prefix decode table, common alarms with causes, old three-digit P/S to new prefixed number mapping, DGN screen guide, and triage workflow.

PMC for Programmers

Reference

What the Fanuc PMC is and how to work with it as a CNC programmer: G/F/X/Y/R/K/D signal addresses, the M-code FIN handshake, #1000/#1100 macro interface variables, and reading the PMC screens without a ladder license.

Custom G/M Cycles

Advanced

How to create custom G-code and M-code macros on Fanuc CNC using parameters 6050-6059, program mapping, and argument design.

Macro Executor & P-Code

Advanced

How the Fanuc Macro Executor runs machine-tool-builder P-code macros: the macro compiler toolchain, O9000-series protection parameters (NE8/NE9, 3210/3211), G/M-code aliasing, conversational vs execution macros, and P-code variables #10000+.

Renishaw Inspection Plus

Advanced

Complete reference for Renishaw Inspection Plus probing on Fanuc CNC: cycle inputs, output variables, calibration, protected positioning, and error handling.

Tilted Working Plane (G68.2)

Advanced

How Fanuc G68.2 tilted working plane indexing works and how to program 3+2 machining with it: defining a feature coordinate system by Euler angles (G68.2 X_Y_Z_ I_J_K_), roll-pitch-yaw (P4), three points (P2) or two vectors (P3); orienting the tool perpendicular to the tilted plane with G53.1; cancelling with G69; the rules about cancelling tool length/radius compensation first; the machine-configuration parameters (19680/19681/19686/19696); and how G68.2 differs from G54.4 workpiece setting error and G43.4/G43.5 tool centre point control. Manual-derived from FANUC B-64724EN §22.6 and B-64730EN §4.98.

Tool Centre Point (G43.4/G43.5)

Advanced

How Fanuc keeps the tool tip on the programmed path during simultaneous 5-axis motion: tool centre point control G43.4 (type 1, program the tip) and G43.5 (type 2, program the tool-axis direction), cancelled by G49; plus the related tool-length-in-tool-axis-direction command G43.1 and the nutating rotary head compensation G43.3. Covers what TCP compensates for, the command formats, the machine-kinematics parameters, and how TCP differs from G68.2 tilted working plane indexing and G54.4 workpiece setting error. Manual-derived from FANUC B-64724EN §22.1 and B-64730EN §4.104.

Workpiece Setting Error (G54.4)

Advanced

What Fanuc G54.4 Workpiece Setting Error Compensation actually does and how to use it: the G54.4 Pn / P0 command, the eight values that define a setting error (x/y/z translation, a/b/c rotation, two table-axis positions), the rotate-then-shift compensation model, the No.00 COMMON set that adds into all seven error sets, the 5-axis table-rotation conversion rule, how to set the data on the workpiece-setting-error screen, and how G54.4 differs from G54.1 additional offsets and G68.2 tilted working plane. Manual-derived from FANUC B-64724EN.

Siemens SINUMERIK

Running a Program at the Control

Basics

How to actually run an NC program on a Siemens SINUMERIK: which operating mode executes a program, why selecting a program is not the same as opening it, the four block search modes and why without calculation is the dangerous one, REPOS after an interruption, and the alarms that block a start.

Family Guide (828D / 840D sl / ONE)

Basics

Positioning guide to the modern SINUMERIK line: how the 828D, 840D sl, and SINUMERIK ONE differ in hardware, drives, PLC, axes, and channels — and why the NC part-program language is essentially common across all three.

Programming Basics

Basics

Fanuc-to-Siemens translation guide for the Sinumerik 828D: program structure, tool calls, work offsets, frames (TRANS/ROT), cycles, and ShopMill vs G-code programs.

R-Parameters & System Vars

Reference

Siemens SINUMERIK 828D reference for R-parameters, the $-prefix system variable naming scheme, useful runtime variables, and GUD — with Fanuc macro equivalents.

Machine Data & Settings

Reference

Reference for Siemens Sinumerik 828D machine data (MD) and setting data (SD): numbering ranges, $MN_/$MC_/$MA_ prefixes, activation types, access levels, and the machine data a programmer actually touches.

ISO Mode (Fanuc G-Code)

Reference

How SINUMERIK 840D sl / 828D ISO dialect mode runs Fanuc-style G-code: G290/G291 switching, supported G-codes, macro handling, and what breaks.

Alarms & Diagnostics

Reference

Quick reference for SINUMERIK 828D alarms: number ranges by subsystem, alarm reactions and clear conditions, common NC/drive/PLC alarms, and the 6xxxx cycle alarm family.

Measuring Cycles

Advanced

Reference for SINUMERIK 828D / 840D sl built-in measuring cycles: probe calibration (CYCLE976/973), workpiece measurement (CYCLE977/978/998/997), tool measurement (CYCLE971/982), result variables, and alarms.

Synchronized Actions

Advanced

Reference for Siemens SINUMERIK 840D sl / ONE synchronized actions: the ID/IDS + WHEN/WHENEVER/FROM/EVERY + DO structure, real-time $A_/$AA_/$AC_ variables, the actions you can trigger (POS, RDISABLE, SYNFCT, M/S/H output), LOCK/UNLOCK/CANCEL, and worked examples from the function manual.

Transformations & 5-Axis

Advanced

Reference for SINUMERIK 840D sl / ONE kinematic transformations: TRAORI 5-axis orientation programming (A3/B3/C3, LEAD/TILT, ORIWKS/ORIMKS), TRANSMIT face/polar milling, TRACYL cylinder-surface wrapping, TRAANG inclined axis, chained transformations, and the CYCLE800 swivel-plane relationship.

Swivel Plane (CYCLE800)

Advanced

What Siemens SINUMERIK CYCLE800 Swivel Plane actually does and how to program it: the sixteen-parameter call CYCLE800(_FR,_TC,_ST,_MODE,_X0,_Y0,_Z0,_A,_B,_C,_X1,_Y1,_Z1,_DIR,_FR_I,_DMODE), the _TC swivel data block that carries the machine kinematics, the _ST new-vs-additive and track-tool-tip options, the _MODE angle interpretation (axis-by-axis, solid angle, projection angle, direct) and rotation sequence, the _X0/_Y0/_Z0 and _X1/_Y1/_Z1 reference points before and after rotation, the _DIR rotary-axis direction, retraction with _FR, and how CYCLE800() alone resets the swivel frame. Manual-derived from SINUMERIK 840D sl NC Programming (A5E47432823B AA).

5-Axis Transform (TRAORI)

Advanced

What Siemens SINUMERIK TRAORI 5-axis orientation transformation actually does and how to program it: TRAORI(n) and TRAORI(n,X,Y,Z,A,B) to activate, TRAFOOF to deactivate, why with the transformation on the programmed X/Y/Z always relate to the tool tip so moving a rotary axis produces compensating linear motion that keeps the tip on path, the orientation vector pointing tool-tip to tool-adapter, ORIWKS workpiece vs ORIMKS machine reference for orientation interpolation, the orientable toolholder TCARR with TCOABS / TCOFR / TCOFRX / TCOFRY / TCOFRZ, and worked examples like TRAORI(1,0,0,1). Manual-derived from SINUMERIK 840D sl NC Programming (A5E47432823B AA).

Workpiece Alignment (CYCLE998)

Advanced

How Siemens SINUMERIK aligns a mis-set workpiece in software instead of re-clamping it: the CYCLE998 '3D - align plane' measuring cycle that probes three points and writes the angular error into the rotary components of a work offset (max +/-45 degrees), its S_MVAR variant / correction-target coding, S_KNUM frame selection (settable, channel-specific basic, basic reference, coarse/fine), and S_RA correction as a coordinate rotation or into a rotary axis; then the frame system itself - settable frames $P_UIFR[n] (=G54..G599), base frame $P_BFRAME, programmable $P_PFRAME, total $P_ACTFRAME - written with ROT/AROT/CROT and TRANS/ATRANS/CTRANS, e.g. $P_UIFR[n]=CROT(X,a,Y,b,Z,c), with component access $P_UIFR[n,Z,TR] and $P_UIFR[n,X,RT]; plus why CYCLE996 is kinematic calibration, not workpiece setup. Manual-derived from SINUMERIK Measuring Cycles (A5E44904897B AB) and NC Programming (A5E47432823B AA).

Heidenhain

Running a Program at the Control

Basics

How to actually run an NC program on a Heidenhain TNC: which operating mode runs a program, selecting the program, addressing the start block with GOTO 0, why mid-program re-entry needs Block Scan instead of GOTO, and the errors you hit when you skip a step.

TNC Series & Firmware Guide

Basics

Which Heidenhain do I have? The TNC lineup mapped: TNC7 family, TNC 640, TNC 620, TNC 320, TNC 128, iTNC 530 and the legacy TNC 4xx/3xx/124 controls, with NC-software number families, capability differences, and how the manual set is organized.

Tilted Plane (PLANE)

Advanced

How the HEIDENHAIN PLANE function tilts the working plane on a TNC 640 / TNC7: why every PLANE block is a geometry definition plus a mandatory positioning behavior, the seven ways to define the tilted plane (PLANE SPATIAL SPA/SPB/SPC, PROJECTED, EULER, VECTOR, POINTS, RELATIV and AXIAL) plus PLANE RESET, the MOVE / TURN / STAY positioning options with DIST and F, the SYM/SEQ solution picker, COORD ROT vs. TABLE ROT, and how PLANE maps to Fanuc G68.2 tilted working plane. Requires software option 8. Manual-derived from HEIDENHAIN 892903-29.

Tool Tip Control (TCPM)

Advanced

How HEIDENHAIN keeps the tool tip on the programmed contour while the rotary axes move: the legacy M128 / M129 pair and the modern FUNCTION TCPM on a TNC 640 / TNC7. Covers all four TCPM selectors — feed reference F TCP vs. F CONT, rotary-coordinate interpretation AXIS POS vs. AXIS SPAT, orientation interpolation PATHCTRL AXIS vs. PATHCTRL VECTOR, and reference point REFPNT TIP-TIP / TIP-CENTER / CENTER-CENTER — plus FUNCTION RESET TCPM and the M144 kinematics-change compensation. Requires software option 9. Maps to Fanuc G43.4/G43.5 TCP. Manual-derived from HEIDENHAIN 892903-29.

3D Basic Rotation

Advanced

How a HEIDENHAIN TNC compensates a misaligned workpiece in software instead of re-clamping it: a touch-probe cycle measures the setup skew and writes it into the active preset as a basic rotation or 3D basic rotation, a basic transformation the control then applies automatically to every subsequent program. Covers the modern 14xx family (Cycle 1420 PROBING IN PLANE, 1410 PROBING ON EDGE, 1411/1412/1416) that works with 3D-ROT and TCPM, the return parameters Q970/Q971/Q972 and the confirm/transfer/align switches Q1121/Q1120/Q1126, the legacy 400-series (Cycle 400 BASIC ROTATION, 401/402/403/405, and Cycle 404 SET BASIC ROTATION with Q307/Q305) that does not, and M143 to rescind it. Maps to Fanuc G54.4. Manual-derived from HEIDENHAIN 1303409-23 and TNC7 1358773-24.

Error Messages & Diagnostics

Reference

Reference for Heidenhain TNC error messages: how error numbers are structured, the major error groups, a curated table of the errors machinists actually hit (programming, probing, program run, files), FN 14: ERROR, and how to look an error up.

Mazak (Mazatrol)

Running a Program at the Control

Basics

How to actually run a program on a MAZATROL Smooth control: which operating mode executes a program, selecting it with a WORK No. search, the preparation steps Mazak says come first, RESTART versus RESTART 2 NONMODAL for mid-program re-entry, the prove-out functions, and the alarms that stop you before the first chip.

Control & Family Guide

Basics

Which Mazak do I have? How MAZATROL works as a dual-mode conversational + EIA/ISO control, the Smooth generation lineage (SmoothG / SmoothX / SmoothC / SmoothAi), the machine families (HCN, VARIAXIS/VRX, INTEGREX, QUICK TURN, NEXUS), and how the Mazak manual set and its H-code numbering are organized.

MAZATROL Conversational

Basics

How MAZATROL conversational programming works on the Mazak SmoothAi/SmoothG control: unit-based programs instead of G-code, the Common (WPC) unit, machining units with tool and shape sequences, the full unit-type list, automatic cutting-condition setting from material, TOOL DATA/TOOL FILE, and mixing MANUAL PROGRAM (EIA) units.

EIA/ISO Programming

Reference

How to program a Mazak machining center in standard EIA/ISO G-code on MAZATROL SmoothAi / SmoothG: G-code and M-code reference, canned cycles, user macros with #-variables, work offsets, and where Mazak differs from Fanuc.

Alarms & Parameters

Reference

Reference for MAZATROL SmoothAi alarms and parameters: how the alarm number classes decode by subsystem, type/stop/clear codes, common program-ATC-spindle-overtravel-coolant alarms with fixes, the user vs. machine parameter split, and the SmoothAi diagnosis screens.

Probing (MAZATROL & EIA)

Advanced

How probing works on a Mazak: MAZATROL-side WPC and tool measurement built into the conversational workflow, EIA-side G31 skip programming with the #-variables, Renishaw macro packages, and how to choose which side to probe on.