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

Get Instant Quote

Engineering explainer

CNC Programming and Processing: How Code Becomes a Toleranced Part

This page explains what actually happens between a CAD model and a finished metal part: how G-code is built, where CAM toolpaths lose accuracy, and which setups hold ±0.005 mm. It is written for design engineers and buyers who review drawings, not for operators learning a control. Read it and you can judge whether a quoted process is realistic for your geometry.

±0.005 mm tolerance16 five-axis centersISO 9001 / IATF 16949No minimum order quantity
CNC programming and processing setup for 5-axis machined engine parts
Foundations

What CNC programming and processing actually controls

CNC programming and processing is a chain, not a single step. A CAM system converts the solid model into a toolpath, the post-processor turns that toolpath into G-code for one specific machine, the operator proves the program, and the machine executes it. Accuracy is set at the weakest link. A perfect model with a sloppy toolpath still cuts a bad part.

The drawing is the contract. Programmers read tolerances, datum callouts and surface notes before choosing a tool. If a bore is called at Ø20 H7, the programmer cannot treat it as a nominal hole and drill it. That callout decides whether the hole is drilled, bored or reamed, and whether a separate finishing pass is scheduled after heat treatment.

Every block of code does one of three things: move the tool, set a machine state, or hold a value. G00 and G01 move it fast or feed it. G43 applies tool length offset, G54 through G59 pick the work coordinate system. M03 starts the spindle, M08 floods coolant. Anything a machine does comes from that short list, which is why small syntax errors produce large physical results.

The engineering meaning is simple. Code does not know your intent. It only carries the numbers you gave it, so a transposed decimal in a Z value becomes a crash or a scrapped part. Programmers therefore verify coordinates against the model, not against memory, before the first cut on a new program.

  • 1
    Model to codeCAM builds the path; the post turns it into machine-specific G-code.
  • 2
    Datum firstTool and offset choices follow the drawing datums, not the CAD origin.
  • 3
    Verify numbersCheck Z depths and offsets against the model before the first cut.
Toolpaths

Toolpath strategy and where accuracy is lost

A toolpath is a compromise between cycle time, tool life and dimensional result. Roughing removes most of the volume with a large stepover and leaves stock for finishing. Finishing removes that stock in one or two light passes. If the finishing pass is too heavy, the tool flexes, the wall tapers, and the part measures oversize at the top and undersize at the bottom.

Cutter engagement drives both heat and load. In 6061 aluminium a radial engagement near 8 to 10 percent of the cutter diameter with high spindle speed clears material quickly without chatter. In 316 stainless the same strategy stalls, because the material work-hardens. There, heavier radial engagement at lower surface speed keeps the cut under the hardened layer instead of rubbing on it.

Climb milling is the default for finishing on modern machines. The cutter tooth enters at maximum chip thickness and exits at zero, which pushes the cutting force into the part rather than lifting it and leaves a cleaner wall. Conventional milling still has a place on castings and forgings with a hard skin, where the cutter should enter below the scale.

Interpolation decides how round a round feature really is. A circular boss cut with a coarse point spacing looks round but measures as a polygon. Setting the CAM tolerance to 0.005 mm or finer keeps the chord error below the dimensional tolerance. On a small radius, that tolerance matters more than machine positioning accuracy.

Rest material is where many programs fail quietly. After a large cutter clears a pocket, the corners hold material the tool could not reach. A smaller tool has to come back. If the programmer forgets it, the operator finds it at the bench, and the part is re-fixtured for a second operation instead of finished in one.

  • 1
    Rough then finishLeave 0.3–0.5 mm of stock for the finishing pass.
  • 2
    Match engagement to materialAluminium takes light radial cuts; stainless does not.
  • 3
    Control chord errorCAM tolerance of 0.005 mm or finer keeps arcs round.
Fixturing

Workholding, datums and the 3-2-1 rule

A part can only be as accurate as its setup. The 3-2-1 rule still holds: three points define a plane, two define a line, one stops rotation. Vises, soft jaws and fixture plates all exist to repeat that constraint without distorting the part. A thin wall clamped too hard springs back when the vise opens, and the measurement taken in the machine is wrong.

Datum selection should follow the function of the part, not the convenience of the setup. If a bearing bore and a mounting face must be parallel, both should come from the same datum in the same operation where possible. Splitting them across two setups adds the fixture error of the second setup to the tolerance stack.

Five-axis machining reduces setups, and every removed setup removes a stack-up. A part that needs four faces can often be finished in two operations on a trunnion table with a Ø400 mm rotary table. The trade is programming complexity and a slightly lower removal rate, because the tool is often held further from the spindle nose.

For long parts up to 4,000 mm, thermal drift matters more than fixture stiffness. A machine that starts cold and runs for six hours will move. Roughing in the morning and finishing after the machine has reached steady state keeps long bores and long flat faces inside ±0.005 mm. We schedule long parts that way rather than chasing the number with offsets.

Zero-point clamping and pre-set fixture plates cut the time between operations. They do not improve the tolerance of a single setup. Engineers sometimes expect them to. What they actually buy is repeatability across a run, which is the difference between part one and part four hundred.

  • 1
    Repeat the constraintThree points, two points, one point. No over-constraint.
  • 2
    One datum per feature groupKeep related features in the same setup when possible.
  • 3
    Watch thermal driftRough early, finish after the machine stabilises.
Machine choice

Three-axis, four-axis or five-axis: picking by geometry

Three-axis machining moves the table in X and Y and the spindle in Z. It is the fastest and cheapest way to cut a part that can be reached from one direction: plates, housings, pockets, slots. If the part has features on two opposite faces, three-axis work needs two setups, and the second setup carries the first one's error plus its own.

Four-axis adds rotation about one axis, usually A. A shaft with cross-drilled holes, flats and a keyway can be cut in one program with the part indexed between features. Indexing is not simultaneous motion; the table stops, the rotary table locks, and the cut proceeds. That is enough for most turned and prismatic parts.

Five-axis adds a second rotation, normally C, so the tool can tilt. Tilt is what lets a short, stiff cutter reach a deep wall or the floor of a cavity without a long tool that deflects. It also lets the tool approach a surface at the angle the finishing strategy wants, instead of the angle the fixture allows.

The decision is geometric, not aspirational. Undercuts, deep cavities with draft, impellers, and features that wrap around a curved surface push toward five-axis. Flat plates with holes and pockets do not. Putting a simple part on a five-axis machine adds programming hours and can slow the cycle, because the trunnion is less rigid than a solid vise on a three-axis table.

We run 16 simultaneous five-axis centers, 16 mill-turn centers, 27 three-axis machines, 12 four-axis mills and 127 high-precision CNC machines in total. That mix exists because the right answer changes with the part. Matching the machine to the geometry is cheaper than forcing every part onto the most capable machine in the shop.

  • 1
    Three-axisOne-direction access, plates and housings, lowest cost per part.
  • 2
    Four-axisRotational features, indexing between cuts, one setup.
  • 3
    Five-axisUndercuts, deep cavities, contoured surfaces, fewer setups.
Materials

How material behaviour changes the program

Aluminium 6061 and 7075 cut cleanly at high speed and tolerate light radial engagement. They also move with heat. A heavy roughing pass on a thin 7075 rib can warp the part after it cools, so roughing is often split into two lighter passes with a pause, especially when the final wall is under 2 mm.

Stainless 304 and 316 work-harden. If the tool rubs instead of cutting, the surface gets harder and the next pass is worse. The fix is a heavier feed per tooth and a radial engagement that keeps the edge biting. Surface finish on stainless lands around Ra 0.8–1.6 μm without extra work when the parameters are right.

Titanium TC4 (Ti-6Al-4V) and Inconel carry heat into the tool rather than the chip. Cutting speed drops, coolant strategy changes, and tool life becomes the limiting cost. These parts are programmed with conservative depth of cut and generous coolant, and the finishing pass is kept as light as the tolerance permits.

Plastics behave in the opposite way. POM and PEEK cut fast but melt, and a dwell in the program leaves a mark. Sharp tools, high feed and air blast instead of flood coolant keep the chip clear. ABS and PC are softer and easier, but they still need support on thin sections or the cutter pushes them away from the tool.

Hardened tool steel above 45 HRC is usually roughed before heat treatment and finished after. The finishing allowance must account for the distortion the heat treatment causes, which is not a fixed number. It depends on section thickness and quench. We leave 0.3–0.5 mm and measure after hardening rather than assuming.

  • 1
    AluminiumHigh speed, light radial cuts, watch thin ribs.
  • 2
    StainlessKeep the edge biting; rubbing work-hardens the surface.
  • 3
    Titanium and InconelLow speed, heavy coolant, tool life sets cost.
Verification

Proving the program before and after the cut

A new program is proven before it runs on a part. The first pass is a dry run with the tool offset above the stock, watching the approach moves and checking that the offsets match the tool list. On complex five-axis work, simulation catches collisions between the holder and the fixture that a two-dimensional check would miss.

First-article inspection closes the loop. A coordinate measuring machine checks the features against the drawing, and the offsets are adjusted from measured data, not from the operator's feel. This is where a shop either holds ±0.005 mm across a run or slowly drifts out of tolerance over the following days.

In-process checks matter on long runs. Tool wear moves a bore diameter gradually, so a bore that starts at the low end of the tolerance band is measured again at intervals. We inspect 100% of parts before shipment: incoming material check, in-process monitoring and final inspection, with reports available on request.

Chip control belongs in this section because it affects measurement. A nest of chips in a pocket or on a fixture face holds the part off its stop, and the resulting offset error looks like a machine problem. Clearing chips between operations and blowing out fixture seats is part of the process, not housekeeping.

Documentation is what makes the result repeatable. Program number, revision, tool list, offsets and inspection results travel with the job. When a part comes back for a second run a year later, the program is a starting point instead of a guess.

  • 1
    Dry run firstCheck approaches and offsets with the tool clear of the stock.
  • 2
    Measure, then offsetAdjust from CMM data, not operator feel.
  • 3
    Keep recordsProgram revision, tool list and inspection results travel with the job.
Selection

Machine and strategy selection by part feature

Use the row that matches the dominant feature on your drawing.

Part featureRecommended setupWhy it holds tolerance
Flat plate, holes and pockets3-axis, one vise setupSingle datum, no re-clamping error
Shaft with cross holes4-axis, index between featuresRotary position repeats within seconds of arc
Deep cavity with draft5-axis with tilted cutterShort tool, less deflection at depth
Thin wall under 1.5 mm5-axis, light finishing passesTilt spreads cutting force along the wall
Long bore up to 4,000 mm3-axis or mill-turn, thermal scheduleRough early, finish after warm-up
Hardened steel above 45 HRCPre-hard rough, finish after heat treatFinishing cut removes distortion
Titanium and Inconel parts5-axis, low surface speedHeat stays in the chip, not the edge
One-off prototype3-axis or 4-axis, soft jawsFast setup, no fixture cost

When five-axis pays, and when it does not

Choose five-axis when the geometry has undercuts, deep cavities or contoured surfaces that need a tilted, short cutter; choose three-axis or four-axis when the part is prismatic and reachable from one or two directions, because the cycle is faster and the fixture is stiffer.

FAQs

Common questions on CNC programming and processing

Do all CNC machines use the same programming language?

Most machines read ISO G-code, but the dialect differs. A program written for one control may not run on another without a post-processor change.

The post-processor maps generic CAM output to the specific control: canned cycles, arc formats, offset registers and rotary conventions all vary. That is why the same model posted for two machines produces two different programs.

What tolerance can CNC programming and processing realistically hold?

Our standard working tolerance is ±0.005 mm (±0.0002 in) on features that can be measured from a single datum. Surface finish lands between Ra 0.2 μm and Ra 3.2 μm depending on the operation and material.

Tighter than that needs a conversation about geometry. A feature deep inside a cavity is harder to hold than a bore on an accessible face, because tool deflection grows with length and the measurement itself becomes uncertain.

When should a part be finished after heat treatment?

When the material is hardened above 45 HRC, or when the part is thin enough that quench distortion will move the critical features. Rough before treatment, finish after.

Leave 0.3–0.5 mm of stock and measure the distortion on the first part. Assuming a fixed allowance is how a run drifts out of tolerance.

How does tool length affect accuracy on deep features?

Deflection grows roughly with the cube of the length, so a tool twice as long bends about eight times as much under the same load. That is the main reason five-axis tilt helps.

Tilting the head lets a shorter, stiffer cutter reach the same surface. If a deep wall is called at ±0.005 mm, tool length is a bigger risk than the machine's positioning accuracy.

What information should be on the drawing for programming?

Datums, tolerances, surface finish per face, thread callouts and any post-treatment notes such as anodizing thickness. Anodizing builds up on the surface and changes a dimension if the drawing does not say whether the callout is before or after coating.

Mark critical features clearly. If everything is toleranced at ±0.01 mm, the programmer cannot tell which measurements actually decide whether the part works.

Can one program be used for prototypes and production?

Sometimes, but the fixture usually changes. A prototype cut in a vise may move to a dedicated fixture for a production run, and that changes the offsets and the cutter approach.

We treat the prototype program as a validated starting point, then re-post and re-prove it for the production fixture before the run starts.

Send a drawing and get a process answer, not just a price

Upload your model and we return a quotation with free DFM analysis within 12 hours, plus a note on which machine and setup we would use and why.

12-hour quote100% inspectionNo minimum order quantity

Follow

More machining notes from our shop floor

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