CNC Machine Operation
An introduction to CNC machining, covering coordinate systems, G-code fundamentals, tool offsets, machine setup, and first article inspection procedures.
Table of contents
CNC Machine Operation
Computer Numerical Control (CNC) machines use programmed instructions to cut, drill, and shape metal and other materials with high precision and repeatability. CNC machining is the backbone of modern manufacturing, producing everything from aerospace engine components to medical implants to automotive parts. This guide provides the comprehensive knowledge a new CNC operator needs to understand the equipment, set up jobs, run programs, inspect parts, and work safely from day one.
Safety in the CNC Shop
CNC machines operate at high speeds with sharp cutting tools, powerful motors, and moving components. The consequences of carelessness range from scrapped parts to severe injuries.
Critical Safety Rules
- Never reach into a running machine. This is the most important rule. Do not adjust workholding, touch chips, or measure parts while the spindle is rotating or axes are moving. Press the feed hold button and wait for all motion to stop completely.
- Wear safety glasses at all times in the shop, not just at the machine. Flying chips travel far.
- No loose clothing, jewelry, or long hair. Rotating spindles and workpieces catch anything loose and pull it (and you) in instantly. Tie back long hair, remove rings and watches, tuck in shirts, and do not wear gloves while operating the machine (gloves are worn only for material handling, never while the machine is running).
- Know where the emergency stop button is. Every CNC machine has a large red E-stop button. Find it before you start. Hit it immediately if something goes wrong - a tool crash, unexpected movement, or fire.
- Close the machine door. CNC machines have enclosures and interlocked doors for a reason. Never defeat a door interlock. If the interlock is malfunctioning, report it to maintenance rather than bypassing it.
- Chip removal - Use a chip brush, chip hook, or compressed air (with safety nozzle at less than 30 PSI per OSHA) to remove chips. Never use your hands. Chips are razor-sharp and often hot.
- Coolant safety - Cutting fluids can cause skin irritation, respiratory issues, and slippery floors. Use barrier cream on exposed skin, clean up coolant spills immediately, and report any coolant with a foul odor (indicates bacterial growth). Use splash guards and mist collectors.
Types of CNC Machines
CNC Milling Machine (Machining Center)
The workpiece is mounted on a table (or in a fixture) and a rotating cutting tool removes material. Modern machining centers are classified by spindle orientation:
- Vertical machining center (VMC) - The spindle is vertical (pointing down). Most common for general machining, mold work, and production parts. 3-axis machines move in X (table left/right), Y (table forward/back), and Z (spindle up/down). 4- and 5-axis machines add rotary axes for machining complex geometries without re-fixturing.
- Horizontal machining center (HMC) - The spindle is horizontal. Better chip evacuation for deep pockets and heavy cuts. Often used with tombstone fixtures for high-volume production. HMCs typically have a B-axis (rotary table) for 4-sided machining.
CNC Lathe (Turning Center)
The workpiece rotates in a chuck or collet and a stationary cutting tool removes material. Used for cylindrical parts: shafts, bushings, fittings, bolts, and pins.
- 2-axis lathe - X (tool in/out) and Z (tool left/right along the spindle axis). The basic configuration for most turning work.
- Live tooling lathe - Adds a C-axis (spindle indexing) and driven tool stations that can mill, drill, and tap while the part is in the chuck. Reduces the need for secondary operations on a mill.
- Swiss-type lathe - A sliding headstock design optimized for small-diameter, long parts. The guide bushing supports the bar close to the cutting point for extreme precision. Used for medical devices, watch components, and electronic connectors.
CNC Router
Similar to a VMC but with a larger work envelope and lighter construction. Used for cutting wood, plastics, composites, aluminum, and foam. Common in sign making, furniture, aerospace composite parts, and packaging.
Wire EDM and Sinker EDM
Electrical discharge machining uses electrical sparks to erode material. Wire EDM uses a thin brass wire to cut profiles with extreme precision (tolerances of 0.0001"). Sinker EDM uses shaped electrodes to burn cavities (used for mold and die making). No cutting force, so it can machine hardened steel and carbide.
Coordinate Systems
CNC machines use a Cartesian coordinate system to define positions in space.
Machine Coordinate System
- X axis - Left/right movement (on a VMC, this is the table's long axis)
- Y axis - Forward/backward movement (on a VMC, this is the table's short axis)
- Z axis - Up/down movement (spindle direction). On a lathe, Z is along the spindle axis and X is the cross-slide direction.
- Machine zero (machine home) - A fixed reference point built into the machine, established by the home switches. All machine coordinates are measured from this point. The machine always knows where it is relative to machine zero.
Work Coordinate System (Work Zero / Program Zero)
- Work zero is a reference point that the operator sets on the workpiece. All programmed coordinates in the G-code are relative to this point.
- On a mill, work zero is typically set at the top surface of the workpiece, at a corner or center, depending on the part and programming convention.
- On a lathe, work zero is typically at the face of the finished part, centered on the spindle axis.
- Setting work zero is done with an edge finder, indicator, probe, or by touching a tool to the workpiece and entering the position into the work offset register (G54, G55, etc.).
Setting work zero on a mill (edge finder method):
- Install an edge finder in the spindle. Run the spindle at 800 to 1,000 RPM.
- Slowly jog the machine toward the workpiece edge in X. Watch the edge finder's indicator. When the indicator kicks (the tip deflects), the center of the edge finder is exactly one half-diameter from the workpiece edge.
- Record the X machine position and subtract (or add) the edge finder radius to calculate the edge position.
- Set the X work offset (e.g., in G54) to this value.
- Repeat for Y.
- For Z, touch a known tool to the top of the workpiece, set Z to zero.
Modern machines with probes automate this process. The probe touches the workpiece automatically and sets the work offset in seconds.
G-Code Fundamentals
G-code is the programming language that tells the machine where to move and how to cut. While most programs are generated by CAM (Computer-Aided Manufacturing) software, every operator should understand the basics to read programs, catch errors, and make adjustments.
Essential G-Codes (Mill)
| Code | Function | Example |
|---|---|---|
| G00 | Rapid positioning (move quickly, no cutting) | G00 X1.0 Y2.0 Z0.5 |
| G01 | Linear interpolation (straight-line cut at feedrate F) | G01 X3.0 F10.0 |
| G02 | Circular interpolation clockwise | G02 X2.0 Y0.0 R1.0 F8.0 |
| G03 | Circular interpolation counterclockwise | G03 X0.0 Y2.0 R1.0 F8.0 |
| G17 | XY plane select (default for most mills) | G17 |
| G20 | Inch programming | G20 |
| G21 | Metric programming | G21 |
| G28 | Return to machine home | G28 G91 Z0 |
| G40 | Cancel cutter compensation | G40 |
| G41 | Cutter compensation left | G41 D01 |
| G42 | Cutter compensation right | G42 D01 |
| G43 | Tool length compensation positive | G43 H01 Z0.1 |
| G54-G59 | Work coordinate offsets | G54 |
| G80 | Cancel canned cycle | G80 |
| G81 | Drilling canned cycle | G81 X1.0 Y1.0 Z-0.5 R0.1 F5.0 |
| G83 | Peck drilling canned cycle | G83 X1.0 Y1.0 Z-1.5 Q0.25 R0.1 F4.0 |
| G84 | Tapping canned cycle | G84 X1.0 Y1.0 Z-0.75 R0.1 F12.5 |
| G90 | Absolute positioning | G90 |
| G91 | Incremental positioning | G91 |
Essential M-Codes
| Code | Function |
|---|---|
| M00 | Program stop (operator must press cycle start to resume) |
| M01 | Optional stop (stops only if optional stop switch is on) |
| M03 | Spindle on clockwise |
| M04 | Spindle on counterclockwise |
| M05 | Spindle stop |
| M06 | Tool change |
| M08 | Coolant on |
| M09 | Coolant off |
| M30 | Program end and reset to beginning |
Reading a G-Code Program
Here is a simple program to drill three holes on a mill:
O0001 (DRILL THREE HOLES)
G20 G90 G40 (INCH, ABSOLUTE, CANCEL COMP)
G28 G91 Z0 (HOME Z AXIS)
T01 M06 (LOAD TOOL 1 - 1/4 DRILL)
G54 (SELECT WORK OFFSET)
G43 H01 Z1.0 (TOOL LENGTH COMP, MOVE TO Z1.0)
M03 S2000 (SPINDLE ON CW AT 2000 RPM)
M08 (COOLANT ON)
G83 X1.0 Y1.0 Z-0.625 Q0.15 R0.1 F6.0 (PECK DRILL HOLE 1)
X2.0 Y1.0 (DRILL HOLE 2 - SAME Z, Q, R, F)
X3.0 Y1.0 (DRILL HOLE 3)
G80 (CANCEL DRILL CYCLE)
G28 G91 Z0 (HOME Z)
M05 (SPINDLE OFF)
M09 (COOLANT OFF)
M30 (END PROGRAM)
As an operator, you should be able to read this and understand: what tool is being used, where the holes are located, how deep they are drilled, and what the cutting parameters are.
Tool Offsets
Tool offsets tell the machine the exact length and diameter of each cutting tool so it can position them accurately.
Tool Length Offset (H)
Every cutting tool is a different length. The tool length offset compensates for this so that the programmed Z position corresponds to the actual Z position at the tool tip.
Setting tool length offsets:
- Touch-off method - Jog the tool down until it just touches the top of the workpiece (or a gauge block of known height on the workpiece). Record the Z machine position. Enter this value (or the difference from a reference tool) as the H offset for that tool number.
- Tool presetter - An off-machine device that measures the tool length optically or mechanically. Faster and more accurate than touch-off, especially for shops running many tools.
- On-machine tool setter - A touch probe mounted on the machine table. The machine automatically measures the tool length by touching the probe. The fastest and most repeatable method.
Tool Diameter Compensation (D / Cutter Comp)
When the program uses G41 or G42 (cutter compensation), the machine offsets the tool path by the tool's radius so the tool does not cut into the programmed profile. The D offset stores the tool diameter (or radius, depending on the control).
Wear Offsets
During production, tools wear and parts gradually drift out of tolerance. Wear offsets are small adjustments to the length or diameter offset to compensate for tool wear without changing the main offset.
How to use wear offsets:
- Measure a part dimension. If it is 0.002" oversize, enter -0.001" in the tool's diameter wear offset (because the offset is applied as a radius).
- If a Z dimension is 0.003" shallow, enter -0.003" in the tool length wear offset.
- Make small adjustments (0.001" to 0.005" at a time). Verify with the next part.
Critical rule: Always verify tool offsets before running a new setup. Incorrect offsets are the leading cause of tool crashes (the tool runs into the workpiece, fixture, or machine at rapid speed). A crash can break the tool, scrap the part, damage the spindle, and cost thousands of dollars.
Machine Setup Procedure - Step by Step
This is the procedure a CNC operator follows when setting up a new job on a VMC:
- Review the job package - Read the engineering drawing (print), work order, routing sheet, setup sheet, and program. Understand what you are making, the material, the tolerances, and the sequence of operations.
- Gather tooling and materials - Collect the required cutting tools, tool holders, collets, and inserts. Check tool condition. Replace worn inserts. Verify tool diameters and lengths.
- Install workholding - Mount the vise, fixture, or chuck on the table. Clean the table and workholding surfaces. Indicate the vise or fixture with a dial test indicator (DTI) to verify alignment. For a vise, sweep the fixed jaw with the indicator. Adjust until the jaw is parallel to the X axis within 0.0005" or better.
- Load the workpiece - Place the raw material in the vise or fixture. Ensure it is seated firmly and clamped securely. Verify that the workpiece extends enough for all features to be machined but does not interfere with tool travel.
- Load tools - Install cutting tools in the appropriate tool holders with the correct stickout (length extending from the holder). Load tools into the machine's tool magazine at the correct pocket positions per the setup sheet.
- Set work zero - Use an edge finder, indicator, or probe to locate the workpiece and set the work coordinate offset (G54).
- Set tool length offsets - Measure each tool's length using touch-off, tool presetter, or on-machine tool setter. Enter offsets into the control.
- Load the program - Transfer the G-code program to the machine control via USB, network, or manual entry. Verify the program number matches the job.
- Dry run - Run the program with no workpiece or with the Z raised above the part (Z shift or single-block mode). Watch for unexpected movements, rapid moves that come too close to the workpiece, and correct tool changes. Verify the machine is calling the right tools in the right order.
- First part - Run the program on the first workpiece. Use single-block mode (the machine pauses after every line of code) or reduced feed override (50%) for the first part. Watch and listen carefully. Stop if anything looks or sounds wrong.
- First article inspection - Remove the first part and inspect all critical dimensions.
Feeds and Speeds
Cutting parameters determine how efficiently and safely the tool removes material.
Key Parameters
- Spindle speed (RPM) - How fast the tool (or workpiece on a lathe) rotates. Calculated from surface speed (SFM or m/min) and tool diameter.
- Feed rate - How fast the tool moves through the material. On a mill, measured in inches per minute (IPM). On a lathe, measured in inches per revolution (IPR).
- Depth of cut (DOC) - How deep the tool cuts in the Z axis per pass.
- Width of cut (WOC or stepover) - How wide the tool engages in a milling pass.
Calculating RPM
RPM = (SFM x 3.82) / Tool Diameter (inches)
Or in metric: RPM = (Surface Speed in m/min x 318.3) / Tool Diameter (mm)
Example: Milling 6061 aluminum with a 1/2" carbide end mill at 800 SFM:
RPM = (800 x 3.82) / 0.5 = 6,112 RPM
Calculating Feed Rate (Mill)
Feed Rate (IPM) = RPM x Number of Flutes x Chip Load per Tooth
Example: 4-flute end mill at 6,112 RPM with a 0.004" chip load:
Feed = 6,112 x 4 x 0.004 = 97.8 IPM
Starting Points by Material
| Material | SFM (Carbide) | Chip Load (1/2" EM) |
|---|---|---|
| Mild steel | 400-600 | 0.003-0.005" |
| Stainless 304 | 200-350 | 0.002-0.004" |
| 6061 Aluminum | 800-1200 | 0.004-0.008" |
| Cast iron | 300-500 | 0.003-0.006" |
| Titanium | 100-200 | 0.002-0.004" |
These are starting points. Adjust based on tool manufacturer recommendations, machine rigidity, workholding, and the sound and feel of the cut.
Signs of Incorrect Parameters
- Chatter (vibration) - A loud, screeching sound and rough surface finish. Causes: too light a chip load, too much tool stickout, worn tool, or insufficient workholding rigidity. Fix: increase chip load, reduce stickout, replace tool, or improve fixturing.
- Tool breakage - Excessive chip load, too deep a cut, dull tool, or hard inclusion in the material. Fix: reduce feed/depth, verify material, replace tool.
- Built-up edge (BUE) - Material welds to the cutting edge. Common with aluminum and stainless at low speeds. Fix: increase speed, use sharp coated tools, improve coolant delivery.
- Rapid tool wear - Speed too high, wrong tool grade/coating for the material, or insufficient coolant. Fix: reduce speed, select appropriate tool coating (TiAlN for steel, uncoated or ZrN for aluminum), improve coolant.
First Article Inspection
The first part must be thoroughly inspected before running production.
Inspection Steps
- Remove the part carefully. Clean off coolant and chips.
- Visual inspection. Check for obvious defects: burrs, tool marks, missed features, surface finish issues.
- Measure all critical dimensions using the appropriate tools:
- Calipers for general dimensions (+/- 0.005" tolerance)
- Micrometers for tighter dimensions (+/- 0.001" or better)
- Pin gauges for hole diameters
- Thread gauges for threaded holes
- Height gauge or CMM for complex features
- Compare to the drawing. Check every dimensioned feature on the print.
- Record measurements on a first article inspection report (FAIR). Note the actual dimension, tolerance, and pass/fail status for each feature.
- Adjust offsets if dimensions are out of tolerance but the part is salvageable. Move dimensions toward the center of the tolerance band, not just inside the limit. This provides margin for tool wear during the production run.
- Get approval from the lead, supervisor, or quality inspector before running additional parts.
Tips from Experienced CNC Operators
- "Read the print first. Then read it again." Most scrap parts come from misreading the drawing. Check the material, tolerances, surface finish requirements, and notes. Look for GD&T callouts (position, profile, concentricity) that require specific measurement methods.
- "Run the first part slow." Use single-block mode and 50% feed override. You can always speed up later. You cannot un-crash a tool.
- "Listen to the machine." An experienced operator can tell when something is wrong by the sound of the cut. Learn what a good cut sounds like on each material.
- "Adjust wear offsets, not geometry offsets, during a production run." Geometry offsets set the tool position. Wear offsets compensate for tool wear. If you change geometry offsets during production, you lose your baseline when you change a tool.
- "Never hand-jog a tool in Z toward the workpiece at rapid speed." Always use slow jog (1x or 10x incremental) when moving a tool close to the part. One wrong button press at rapid can drive the tool into the part at full speed.
- "Keep your work area clean." Chips on the table cause parts to seat incorrectly. Coolant on the floor causes slips. Clean throughout the shift, not just at the end.
Key Takeaways
- Never reach into a running machine. Press feed hold and wait for all motion to stop.
- Setting accurate work zero and tool offsets is the foundation of good parts. Verify before running.
- Understand G-code well enough to read programs, identify tool calls, and catch errors.
- Always run the first part carefully with reduced speed and single-block mode. Inspect thoroughly before starting production.
- Listen to the cut, watch the chips, and monitor tool wear throughout the run.
- Keep records of your setups, offsets, and inspection results for future reference.