How Are CNC Machines Programmed?
A CNC machine only does what its program says. This guide walks through the full chain: model preparation, CAM toolpath setup, post-processing, transfer to the control, and first-article verification. It is written for engineers and buyers who need to judge a shop's programming discipline, not just its spindle count.

In this article
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Key takeaways
What must exist before programming starts
Programming is not the first step in a machining job. It is the third. Before anyone opens CAM software, two things must be settled: a manufacturable model and a defined workholding plan. A model with zero-radius internal corners or an unreachable undercut will produce a program that crashes or leaves material behind. Fix the geometry first.
On our side, we read the STEP or native file, check wall thickness, corner radii and datum structure, then send a DFM note back with the quote. That note usually lists three to ten changes: fillet a corner, open a pocket, add a tool relief, or move a datum so it can be probed in one setup. Most changes take minutes to model and save hours at the machine.
Material drives the rest. A 6061-T6 bracket cuts clean at high feed, while 17-4PH stainless work-hardens if the tool rubs instead of bites. Titanium TC4 (Ti-6Al-4V) needs lower surface speed and more coolant pressure to keep heat out of the cut. The programmer has to know the stock condition before choosing a toolpath.
Workholding sets the coordinate system. A vise, a three-jaw chuck, a vacuum plate or a custom fixture all define where X0 Y0 Z0 lands. If the fixture is not modeled, the CAM file is guessing. We model soft jaws and fixtures in the same file when a part needs two or more setups.
- 1Model checkConfirm every feature is reachable with a standard or custom tool.
- 2Datum planPick a face and two edges that survive all operations.
- 3Stock calloutBar, plate or casting, plus allowance of 0.5–2 mm per side.
- 4Tolerance reviewFlag anything tighter than ±0.005 mm before CAM starts.
How are CNC machines programmed in practice: G-code, CAM and conversational
There are three routes, and they are not equal. Manual G-code is written by hand at the control or in a text editor. CAM programming builds toolpaths from a solid model and posts them out. Conversational programming uses shop-floor prompts on the machine to define features like pockets, bolt circles and threads. Most production shops use all three, depending on the job.
Manual G-code still has a place. A short subprogram for a chamfer, a deburr pass, or a repeat pattern in a family of parts is faster to hand-code than to model. Parametric code with variables lets one program cover a range of lengths or hole spacings. When the change is one dimension, editing a variable beats rebuilding a CAM file.
CAM handles the geometry a person cannot track by hand: blended surfaces, 5-axis swarf cuts, deep pockets with rest machining. A good CAM setup includes tool libraries with true cutter diameters, holder geometry for collision checks, and stock models that match what the saw actually delivers. Garbage in, garbage out applies here more than anywhere else.
Conversational programming sits between the two. It is common on lathes and on job-shop mills where the operator is also the programmer. It is fast for simple 2.5-axis work and weak for organic surfaces or tight true-position callouts. If a part has more than about six distinct features with tolerances under ±0.025 mm, move it to CAM.
Choosing tools, feeds and stepover inside CAM
Tool selection comes before feed calculation. For aluminum, a three-flute carbide end mill clears chips well and allows higher feed per tooth. For steel, four or five flutes add rigidity. For stainless and titanium, a variable-helix cutter reduces chatter and keeps the cutting edge engaged instead of rubbing.
Feeds and speeds follow the material, not the machine's maximum. A starting point for 6061-T6 with a 12 mm carbide end mill is 4,000–6,000 rpm and 1,500–2,500 mm/min feed, with a radial stepover of 8–10% of cutter diameter for trochoidal roughing. For 4140 steel, drop surface speed to roughly 120–180 m/min and keep chip load near 0.05 mm per tooth. These are starting numbers. Listen to the cut and adjust.
Stepover and stepdown control tool load and tool life. A light radial engagement with a deeper axial cut moves heat into the chip and away from the tool. This is the basis of high-efficiency roughing. On thin-walled parts, though, the same strategy will deflect the wall. Switch to progressive finishing passes or add support material.
Leave a finishing allowance of 0.2–0.5 mm on roughing. Then run a semi-finish pass before the final contours. Skipping the semi-finish shows up later as inconsistent Ra and tool marks on the finished surface. When a drawing asks for Ra 0.8–1.6 μm, the finish pass parameters decide whether you hit it.
Post-processing and getting the program to the machine
The post-processor converts CAM toolpaths into the dialect your control understands. Fanuc, Siemens, Heidenhain and Mitsubishi all read G-code, but they differ in canned cycles, high-speed look-ahead settings, and how they handle tool length compensation. Using a generic post on a 5-axis machine usually produces code that runs, but not safely.
We validate posts against each machine model in the shop. That means checking rotary axis direction, singularity handling near the C-axis, and safe retract planes. A wrong rotary sign turns a smooth toolpath into a crash in the first minute of the cycle.
Transfer to the machine happens over DNC, USB, or a network folder, depending on age and control. Large 5-axis programs with fine stepover can exceed 50 MB. Drip feeding from a server is standard for those. The older alternative, punching to a card, is gone from most shops but still appears in legacy cells.
Before the file leaves the office, name it so the operator can find it. A house convention like part number, operation number, revision, and machine group prevents the wrong program from being loaded. We have seen scrapped parts come from nothing more than a rev letter mismatch.
Simulation, dry runs and common programming errors
Simulation catches geometry errors, not physics. It will show a toolholder hitting a vise, but it will not tell you that 4140 at 300 m/min will burn the edge. Use simulation for collision and rapid-move checks, then use a dry run with the spindle off and Z offset raised to confirm the sequence.
The three most common programming mistakes we see are wrong work offset, missing tool length compensation, and rapids that pass through stock in a new setup. The first two are typing errors. The third is a planning error and only shows up when the fixture changes between operations.
Feed rate instability is a different class of problem. Chatter shows up as spikes in the 50–150 Hz range and usually means the tool is too long for the load, the holder is worn, or the stepover is too aggressive for the wall thickness. Fix the setup before you edit the feed numbers, because lowering feed alone just moves the problem.
Every program has a revision. When the drawing changes, the program changes with it. Track both with the same revision letter. A program that was correct for Rev B is not correct for Rev C, even if the difference is one hole location.
Step by step: programming a part from model to first chip
Follow this order on every new job. Skipping a step usually costs more time than it saves.
- 11. Review the model and DFM notesOpen the STEP file, check for unreachable features, thin walls under 1 mm, and tolerances tighter than ±0.005 mm. Send questions before CAM starts, not after the first setup.
- 22. Define stock and workholdingModel the raw stock with 0.5–2 mm allowance per side. Model the vise jaws, chuck jaws or fixture plate. Set the program zero on a face and two edges that survive all operations.
- 33. Build the tool listChoose roughing, semi-finish and finish tools with real diameters and holder geometry. Load them into the CAM tool library once and reuse. Include a spot drill and tap for every threaded hole.
- 44. Create roughing toolpathsUse trochoidal or adaptive clearing with 8–10% radial stepover and full depth where rigidity allows. Leave 0.2–0.5 mm radial and 0.1 mm axial allowance for finishing.
- 55. Add semi-finish and finish passesSemi-finish removes the uneven load from roughing. Finish with constant stepover and a lead-in that avoids tool marks at entry. Target Ra 0.8–1.6 μm on mating surfaces.
- 66. Post and simulatePost with the machine-specific processor. Run full simulation with holder and fixture collision checking. Watch for rapid moves that pass through stock and for rotary moves near the C-axis singularity.
- 77. Write the setup sheetList tool numbers, offsets, workholding, program zero, and inspection points. Include a sketch of the setup. The operator should not have to guess which face is Z0.
- 88. Prove out and measure the first articleRun with rapid override low and single block on the first part. Measure the critical dimensions, then adjust wear offsets. Only after sign-off should the run continue at full feed.
Manual G-code vs CAM vs conversational programming
Use this to decide which method fits a given part. There is no single best route.
| Method | Best for | Weak at | Typical use |
|---|---|---|---|
| Manual G-code | Simple edits, subprograms, parametric families | Complex 3D surfaces | Deburr, chamfer, repeat patterns |
| CAM programming | Blended surfaces, 5-axis, tight tolerances | Very small jobs, quick one-offs | Production parts, molds, aerospace ribs |
| Conversational | 2.5-axis lathe and mill work at the machine | Organic geometry, true position under 0.025 mm | Job shop, repairs, simple fixtures |
| Hybrid CAM + hand edit | CAM base with manual speed and safety tweaks | Needs a programmer who knows the control | 5-axis with cautious entry moves |
Programming questions engineers ask
Do I need to supply a 3D model, or can a 2D drawing work?
A 3D model is faster and removes interpretation errors. A 2D drawing with complete dimensions and tolerances can work for simple turned or prismatic parts, but the programmer has to rebuild the geometry, which adds time and risk.
If you only have a drawing, send it with the critical dimensions marked. We will confirm the datum structure before programming.
How long does programming take on a typical part?
A simple 3-axis bracket with three or four features takes one to two hours including simulation and the setup sheet. A 5-axis part with blended surfaces and two setups can take a full day or more.
Programming time is part of the quote. It does not shrink because the part is small.
Can you program from a customer's existing G-code?
Yes, if the code matches our control dialect and the setup matches our workholding. More often we re-post from the model, because transferred code carries assumptions about fixtures we do not have.
Send the source model with the code when possible.
What tolerance can CAM programming realistically hold?
On our machines we hold ±0.005 mm on critical features when the setup is rigid and the tool is short. Achieving that depends on the machine, the fixture and thermal stability, not on the CAM software alone.
Features that need tighter than that should be discussed before the design is frozen.
How do you handle a program change after the first article?
The programmer edits the CAM file, re-posts, and issues a new revision. The setup sheet and inspection plan are updated at the same time. We do not hand-edit at the control and leave the CAM file stale.
That keeps the next run identical to the approved one.
Is conversational programming accurate enough for production?
For 2.5-axis features with tolerances at ±0.05 mm and above, yes. For true-position callouts under 0.025 mm or contoured surfaces, CAM gives better control over tool engagement and entry moves.
The method should match the tolerance, not the operator's preference.
Send the model, get a programming-aware quote
We review every file for manufacturability before we quote, so the program, the fixture and the inspection plan are already in scope. Quotation and free DFM analysis within 12 hours.
12-hour quoteDFM review included100% inspection before shipment