A Few Steps to Make You a Master in CNC Machine Tool Programming
Programming is the last step, not the first. This page walks through the sequence we use on the floor: reading the drawing, choosing the process, fixing the datum, writing the code, then proving it on the machine. Written for engineers and machinists who already run parts and want the decisions to be repeatable.

Programming Starts Before the Code
Five steps, in order. Skip one and the code will be rewritten anyway.
Read the Drawing for Function, Not for Dimensions
Most beginners open the drawing and start collecting numbers. That is the wrong order. First work out what the part does. A bracket that carries a load needs its mounting faces parallel and its bolt holes on true position. A cover plate that hides a connector needs almost nothing. The function tells you which dimensions actually matter, and those are the ones you will hold tight.
Then mark the critical dimensions on a copy. Typically three to eight of them. Everything else can float inside the general tolerance block. This single habit removes most of the arguing later, because when a dimension drifts you already know whether it matters.
Check the tolerance stack before you check the model. If two features are called out at ±0.05 mm and they sit at opposite ends of a 400 mm part, that is a different problem from the same tolerance on a 40 mm part. Thermal growth alone can eat it.
Finally, confirm units and datum scheme on the drawing match what you plan to use in CAM. Inch drawings with metric tooling are a common source of scrap on the first run.
- 1Mark 3–8 critical dimensionsEverything else lives inside the general tolerance block.
- 2Check the stackTolerance across 400 mm is not the same as across 40 mm.
- 3Confirm unitsInch drawing plus metric tooling is a classic first-run scrap.
Choose the Process Before You Choose the Toolpath
Process planning decides how many setups the part needs, and setups drive accuracy more than any cutter path. Every time you unclamp and re-fixture, you add error. A part that can be finished in two setups will hold tolerance better than the same part spread over four, even on the same machine.
Look at the part and ask which face gives you the best chance to reach the most features in one go. On a 5-axis machine with a Ø400 mm rotary table, a housing that would need three setups on a 3-axis mill often finishes in one. That is the real reason to move a part to 5-axis, not the surface finish.
Decide where the soft jaws, the vise, or the fixture will grip. Gripping on a finished surface is a mistake you only make once. Leave a clamping land, or plan the order so the gripping face is machined last.
For thin walls, plan the roughing direction so the wall is supported. A 1.5 mm aluminium wall will move if you rough both sides before finishing either. Rough one side, semi-finish, flip, then finish both.
- 1Fewer setups, tighter partRe-clamping adds error that no toolpath can remove.
- 2Grip on stock, not on finishLeave a clamping land or machine the grip face last.
- 3Thin walls need sequenceRough one side, semi-finish, flip, then finish both.
Set the Datum and Build the Stock Model Honestly
In CAM, the datum you pick becomes the origin every operation references. Pick it from the drawing datum, not from whatever corner is convenient in the model. If the drawing uses a hole pattern as datum A and a face as datum B, build your work offset the same way. Otherwise you will chase the difference between two coordinate systems all day.
Stock model matters more than people expect. A casting with 1.2 mm of draft and a 0.8 mm mismatch will not be cleaned up by a toolpath that assumes a perfect billet. Model the stock from the real incoming condition, or at least add the mismatch as an offset. First-article scrap usually traces back to this step.
Set your Z zero on a known surface, not on a saw cut. Saw cuts vary by 0.3 mm or more. Touch off on a machined face or a gauge block so the whole program sits on a repeatable reference.
Write down the work offset numbers and the tool length reference before you press cycle start. It sounds trivial. It is the difference between a first article and a crash.
- 1Datum from the drawingUse hole patterns and faces the way the drawing does.
- 2Model real stockCasting draft and mismatch must appear in the stock model.
- 3Never zero on a saw cutTouch off on a machined face or gauge block.
Write the Code in a Fixed Order, Every Time
A steady structure makes programs readable six months later, when someone else has to change a feed. We use the same order on every job: safety block, work offset, tool change, spindle start, coolant, approach, cut, retract, cancel. Nothing clever. The point is that anyone on the floor can scan it and find the problem.
Rough with the largest tool the geometry allows. On aluminium, a 16 mm or 20 mm end mill clears material far faster than a 6 mm tool running a long adaptive path. Save the small tools for corners and finishing. On 17-4PH or Inconel, drop the stepover and keep the cutter engaged; rubbing is what kills carbide in those materials.
Set feed and speed from the material table, then adjust from the sound and the chip. Stringy chips on 304 stainless mean you are too slow. Blue chips on 6061 mean you are leaving cycle time on the table.
Keep the tool list short. Every additional tool is another chance for a wrong offset. If a feature can be cut with a tool already in the program, use it.
- 1Same header every timeSafety block, offset, tool change, spindle, coolant, cut, retract.
- 2Rough with the biggest toolSmall tools are for corners and finishing, not bulk removal.
- 3Read the chipStringy 304 means too slow. Blue 6061 means push harder.
Process Choice by Part Shape
How the geometry usually maps to the machine and the setup count.
| Part shape | Typical setup count | Machine choice | Watch out for |
|---|---|---|---|
| Prismatic bracket, holes on 2 faces | 2 | 3-axis mill | Datum shift between setups |
| Housing, features on 4 sides | 1–2 | 5-axis with Ø400 mm table | Reach at deep corners |
| Shaft with cross holes | 1 | Mill-turn center | Cross-hole position after turning |
| Thin-wall cover, 1.5 mm wall | 2–3 | 3-axis, light finishing cuts | Wall deflection during roughing |
| Long rail, 4,000 mm | 1–2 | Large-travel machine | Thermal growth over length |
| Impeller or blade form | 1 | Simultaneous 5-axis | Collision check before cycle start |
Prove It Out: Dry Run, Single Block, Then First Article
Never go straight to a full cycle on a new program. Run the simulation with the real stock model and the real holder geometry. Then dry run on the machine with the tool offset raised well clear of the part. Then single block through the first approach move. The first approach is where most crashes happen.
Cut the first article and measure the critical dimensions you marked in step one. Not every dimension. The three to eight that matter. If those are in tolerance, the rest of the part is almost always fine, because you already checked the stack.
Record what you changed. If you adjusted a feed on tool 7 or moved a work offset by 0.03 mm, write it on the setup sheet. The second run should not repeat the discovery.
At that point the program is done. On a part running to ±0.005 mm, expect the first article to take longer than the tenth. The time goes into proofing, not into typing code.
- 1Simulate with real stockHolder geometry included, not just the cutter.
- 2Dry run, then single blockThe first approach move is where crashes happen.
- 3Measure the marked dimensionsThree to eight checks, not the whole print.
- 4Write down every changeThe setup sheet carries the fix to the next run.
Questions Engineers Ask
Do I need to know G-code by hand to program well?
Not for the whole program. CAM handles the geometry. But you should be able to read a block and know what it does, because that is how you debug a feed, a retract, or a wrong work offset at the machine.
The useful skill is editing, not authoring. Knowing which line controls the retract plane saves an hour.
When is 3-axis the right call instead of 5-axis?
When all the features are reachable from one or two directions and the part is not too tall for the vise. A flat bracket with holes on one face does not get faster on a 5-axis machine.
Move to 5-axis when the setup count is the problem, when you cannot reach a feature without re-fixturing, or when the part needs simultaneous motion to clear a form.
How much stock should I leave for finishing?
On aluminium, 0.3–0.5 mm radial is normal for a finishing pass after a stable roughing operation. On stainless and titanium, leave 0.2–0.3 mm and take a semi-finish pass first, so the finishing cutter is not removing a work-hardened skin.
If the roughing operation left chatter marks, fix the roughing first. Finishing cannot hide a bad rough.
What causes a good program to produce a bad first article?
Usually the stock model, the datum, or a tool offset. Casting mismatch that was not in the model is the most common. Zeroing on a saw cut is second.
Check those three before you touch the feeds. Changing speeds to fix a datum problem just makes a different bad part.
How do you handle a part that is too long for the machine travel?
Reposition the part on the table and re-zero, or split the operations across two machines. Both add a setup, so the datum has to be re-established carefully each time.
On long rails this is where thermal growth shows up. Let the part reach room temperature before the finishing pass on the second setup.
Can you review a program or a drawing before we cut?
Yes. Send the model and the drawing and we return a DFM analysis with the quotation, normally within 12 hours. We flag features that will need extra setups, tight tolerances that need special fixturing, and thin sections that will move under clamping.
Uploads stay confidential and an NDA is available on request.
Send the Drawing, Get a Process Review
We quote and return DFM feedback within 12 hours, covering setup count, fixturing, and the dimensions that will be hard to hold.
12-hour quote100% inspection±0.005 mm toleranceNDA on request