GreatLight CNC Machining Factory logo
CNC Machining
Rapid Prototyping
Materials
Industries
News
About GL

Get Instant Quote

CNC fundamentals

How CNC Machines Work: A Shop-Floor Guide for Engineers

This page explains how CNC machines work from the control loop outward: the code, the axes, the offsets and the thermal drift that decide the final dimension. It is written for design engineers and buyers who need to judge a process, not operate a console. Read it and you can tell which features belong on a 3-axis mill, which need 5-axis, and which tolerances are worth asking for.

±0.005 mm tolerance16 five-axis centersDFM in 12 hours
how cnc machines work on a 5-axis machining center
Quick answers

Key takeaways

The loop is simpleController reads code, commands a servo, encoder reports back position, controller corrects.
Offsets decide sizeA machine with perfect ballscrews still cuts 0.1 mm off if work offsets and tool lengths are wrong.
Axis count is a fixturing choiceAdding rotary axes removes re-clamping error, not just cycle time.
Accuracy ≠ repeatabilityA machine repeats to ±0.002 mm yet sits 0.02 mm from nominal until it is calibrated.
Heat moves metalA 2 °C shop swing over an 8-hour run shows up on long aluminium parts.
The control loop

How CNC machines work: the control loop in plain terms

A CNC machine does not know what a part is. It only knows where its tool tip should be at a given moment. A CAM post-processor turns the model into G-code: rapid moves, feed moves, spindle speeds, tool changes. The controller reads that file line by line and converts each line into a target position for every axis.

Each axis has a servo motor, a ballscrew or linear motor, a linear scale or rotary encoder, and a drive. The controller compares commanded position with measured position thousands of times per second and adjusts current to close the gap. That is the whole idea behind how CNC machines work: a closed position loop with a cutting tool attached.

The loop only holds what it can measure. Backlash in a worn ballscrew, thermal growth in a spindle, or flex in a thin wall all happen outside the loop. The encoder still reports 'in position' while the cutter pushes away from the workpiece. This is why a machine can repeat to ±0.002 mm and still produce a part 0.03 mm oversize.

  • 1
    ControllerInterprets G-code, runs the servo loop, manages tool and offset tables.
  • 2
    Drive trainServo, ballscrew or linear motor, guideways. Backlash and pitch error live here.
  • 3
    FeedbackEncoder or scale. Closed-loop machines read the slide, not the motor.
  • 4
    StructureCast iron or polymer concrete base. Damping decides surface finish on interrupted cuts.
Reading the code

What the G-code actually tells the machine to do

A typical block reads G01 X50.0 Y20.0 Z-3.0 F400. That is linear interpolation to a point, at 400 mm/min feed. G00 is a rapid at machine maximum, G02 and G03 are arcs, G81 to G89 are canned drilling cycles. M-codes handle non-motion events: M03 starts the spindle clockwise, M08 floods coolant, M06 changes tool.

Feeds and speeds are not guessed. For aluminium 6061 with a 10 mm carbide end mill, a starting point is 3,000–4,000 rpm and 800–1,200 mm/min in a roughing pass. For 316L stainless, drop to 800–1,200 rpm and 150–300 mm/min, and keep the tool engaged. The chip load per tooth matters more than the spindle number on the screen.

Two things trip up new programmers. First, feed is in mm/min for milling but mm/rev for turning on many controls. Second, G-code assumes the tool is where the offset table says it is. If the operator touched off a tool on a dirty face, every dimension from that tool is wrong by the same amount.

  • 1
    G00 vs G01Rapid is not a cutting move. Never rapid into stock.
  • 2
    CompensationG41/G42 shift the path by the tool radius. Wrong side scraps the part.
  • 3
    Canned cyclesDrilling cycles save code but hide retract and peck settings.
  • 4
    UnitsG20 is inches, G21 is mm. Mixing them is a classic crash.
From 3 to 5 axes

How axis count changes the way a part is held

A 3-axis vertical mill moves X, Y and Z. The tool always points down. Any feature on the side of the part needs a second setup, and every setup adds a re-clamp error. On a ±0.05 mm bracket that is fine. On a ±0.01 mm hydraulic manifold it is not, because the second op references a face that was cut in the first op.

A 4-axis machine adds a rotary table, usually about the X axis. It is the right answer for shaft-like parts with features around the circumference: flanges, splines, cross-drilled ports, cam profiles. The part turns, the tool stays vertical. One setup covers the full circle, and the indexer holds angular position to a few arc-seconds.

A 5-axis machine adds a second rotary axis, so the tool can approach the part from almost any direction. That is what makes undercuts, deep pockets with drafted walls, and port intersections machinable in one setup. The trade-off is programming and rigidity. A tilted tool holder loses stiffness, so depth of cut drops and the programmer has to compensate with more passes. At GreatLight we run 16 simultaneous 5-axis centers, 12 four-axis mills and 27 three-axis machines, so the process can be matched to the geometry rather than forced onto one platform.

  • 1
    3-axisFlat plates, pockets, holes on one face. Cheapest per part.
  • 2
    4-axisCylindrical parts, cross ports, circumferential slots.
  • 3
    5-axisUndercuts, compound angles, tight true-position between faces.
  • 4
    Mill-turnTurned body with milled features, one setup, no re-chuck error.
Where accuracy goes

Where accuracy is lost after the machine is 'in position'

Machine geometry is the first loss. Squareness between X and Y, spindle axis to table, and rotary axis centerline all have error budgets. A machine tool builder quotes positioning accuracy of a few microns and repeatability of one or two. Both are measured unloaded, at a controlled temperature, with a warm spindle.

Cutting forces are the second loss. A 16 mm end mill taking a 3 mm radial cut in 4140 steel pushes hard enough to deflect a thin wall. The tool bends, the workpiece springs, and the finished wall comes out thinner at the top than the bottom. Spring passes with a 0.1 mm radial step clean that up.

Heat is the third loss. Spindle bearings, ballscrews and the cutting zone all generate heat. Over an 8-hour run, a machine can grow 0.02–0.04 mm along Z as the column warms. Shops that hold ±0.005 mm run climate control, warm the spindle before the first cut, and re-check critical dimensions mid-run rather than only at the end.

  • 1
    Warm-upSpindle and axes run 15–30 minutes before the first tight cut.
  • 2
    CoolantRemoves heat from the cut and stabilizes the part.
  • 3
    In-process checkProbe or gauge critical features without unclamping.
  • 4
    MetrologyCMM and optical comparison against a certified standard.
Setup procedure

Step by step: setting up a job that will hold ±0.005 mm

  • 1
    1. Check the drawing datum stackIdentify which face the tightest tolerance is called from. If the datum is a surface you cannot hold in the vise, stop and re-plan the setup before touching the machine.
  • 2
    2. Clean and seat the fixtureStone the vise jaws and the table. A single chip under a jaw tilts the part by 0.02 mm over 100 mm. Torque vise bolts evenly and re-indicate the jaw.
  • 3
    3. Warm the spindleRun 15–30 minutes at 4,000–8,000 rpm with no cut, or use the machine's warm-up cycle. Do this before touching off tools, not after.
  • 4
    4. Touch off every toolSet tool length on the same Z reference each time. For tight work, use a tool presetter and enter the measured length rather than the on-machine touch.
  • 5
    5. Set work offsets from one datumPick up X, Y and Z from the same physical feature. Record the numbers. If two operators set the same job, the offsets should agree within 0.005 mm.
  • 6
    6. Prove the path in airRun the first tool 20–30 mm above the stock at reduced feed, single block, with distance-to-go visible. Check every rapid clearance. This is where most crashes are prevented.
  • 7
    7. Cut a test feature and measure itMachine a boss or pocket, then measure before running the full program. Adjust wear offsets in 0.005–0.010 mm steps, not 0.05 mm.
  • 8
    8. Re-check mid-runOn runs longer than two hours, gauge the critical dimension at the halfway point. If it has drifted, correct the offset and log the change.
Process selection

Matching the machine to the feature

Use the tightest tolerance and the most awkward feature on the part to pick the platform.

Feature on the partRight platformTypical toleranceWatch out for
Flat plate, pockets, one face3-axis mill±0.02 mmSecond op re-clamp error
Circumferential ports and slots4-axis with rotary table±0.01 mmRotary backlash on reversal
Compound angles, undercuts5-axis simultaneous±0.005 mmTool holder stiffness on tilt
Turned body with milled flatsMill-turn center±0.01 mmSub-spindle concentricity
Deep thin wall, height > 5× wall3-axis with spring passes±0.03 mmChatter and wall taper
Optical or sealing surface5-axis plus fine finishingRa 0.2–0.8 μmStep-over marks left in the seal path

Pick the process from the tightest feature, not the part name

If the critical tolerance sits on one face, a 3-axis setup with a rigid fixture is the cheapest path. If it spans several faces, pay for 5-axis and remove the re-clamp. Send us the drawing and we will tell you which one your part actually needs.

FAQs

Questions engineers ask about how CNC machines work

Does a 5-axis machine always hold tighter tolerance than a 3-axis machine?

No. A well-maintained 3-axis machine cutting a simple plate will beat a 5-axis machine cutting a tilted surface, because the tool is stiffer and the setup is simpler.

Five-axis helps when the tolerance is called between features on different faces. The gain comes from removing re-clamping, not from the machine being inherently more accurate.

What surface finish can a normal milling pass leave?

As-machined aluminium typically lands at Ra 1.6–3.2 μm with a standard carbide end mill. A finishing pass with a 0.2–0.5 mm step-over and a sharp tool gets to Ra 0.8–1.6 μm.

Ra 0.2–0.8 μm is achievable on sealing and optical surfaces, but it usually means a dedicated finishing tool, a rigid setup and sometimes a secondary lapping step.

How much material should be left for a finishing pass?

Leave 0.2–0.5 mm radial and 0.1–0.2 mm axial on aluminium and mild steel. On hardened or difficult alloys, reduce to 0.1–0.3 mm radial.

Too little stock and the tool rubs instead of cutting, which work-hardens stainless and burns the edge. Too much and the finishing pass deflects the wall.

Why does the same program produce different sizes on two machines?

Geometry, calibration and thermal state differ. Two machines can both be 'in position' while sitting 0.02 mm apart in absolute space.

The fix is machine-specific wear offsets. Program to nominal, then let each machine hold size through its own offset table rather than editing the CAM file.

When should a part move to a different process instead of more CNC passes?

When the wall thickness drops below about 1 mm over a large area, or when the feature count makes cycle time the dominant cost.

Die casting, vacuum casting or sheet metal fabrication can carry the bulk shape, with CNC reserved for the critical interfaces. That is a cost decision as much as a technical one.

How do I know the inspection numbers are real?

Ask for the inspection method, not just the result. A dimension checked with calipers and one checked on a CMM carry different confidence.

At GreatLight every part is inspected before shipment, and raw material, in-process and final checks are recorded. Reports are available on request.

Send us the part that keeps failing inspection

Upload the STEP file and get a quotation plus a free DFM analysis within 12 hours. No minimum order quantity, from one prototype to 10,000+ part runs.

12-hour quote±0.005 mm100% inspectionNDA on request

Follow the shop

More from GreatLight

We publish setup notes, tooling trials and inspection data from the factory floor.

FacebookTikTokYouTubeLinkedInInstagramThreadsPinterest

Trusted by engineers and manufacturers worldwide

Tesla Ford Motor Company BYD Auto Denso Magna International Boeing Airbus Medtronic KUKA FANUC