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

Get Instant Quote

CNC knowledge

CNC Machining Center Programming Skills in One Article

A practical walkthrough of CNC machining center programming for engineers who write or review their own code. Six steps, real parameter ranges, and the mistakes that scrap parts on the first run.

±0.005 mm tolerance16 five-axis centersISO 9001:2015
CNC machining center programming and basic structure of the machining center
Quick answer

Key takeaways

Setup sheet firstWrite tool list, work offset and stock allowance before the first block of G-code.
Feeds from chip loadStart at 0.05–0.10 mm/tooth for aluminium, then trim by spindle load, not by feel.
Dwell is not a stopG04 pauses feed; the spindle keeps turning. M00 stops everything.
Dry run with the tool highSingle block plus rapid override at 25% catches collisions before the first cut.
Prove one part, then releaseFirst-article inspection at ±0.005 mm is cheaper than a scrapped batch of 200.
Step 1

Read the part before you write CNC machining center programming

Open the drawing and mark the datum, the tightest tolerance and every feature that cannot be reached in one setup. Those three items decide the rest of the plan. A part with a ±0.005 mm bore on a side wall usually needs a different setup than a flat plate with slots.

Count the setups out loud. If the answer is four, ask whether a 5-axis center can bring it down to two. Fewer setups means fewer work offsets to trust and less re-fixturing error stacked into the final position.

Check the stock allowance on every face. On a 6061 plate, leave 0.5–1.0 mm per side for finishing. On 17-4PH stainless, leave 0.3–0.5 mm because the material work-hardens and light finish passes cut cleaner than heavy ones.

Write down the smallest tool you plan to use. A Ø3 mm end mill in a 4,000 mm travel machine still needs a spindle speed the machine can actually reach. If the calculated rpm sits above the spindle limit, reduce the feed per tooth instead of forcing the speed.

Step 2

Build the setup sheet and tool list

The setup sheet is the document the operator actually reads at the machine. It carries the work offset, the tool numbers, the Z zero face and the stock size. If the program and the setup sheet disagree, the operator trusts the sheet, so keep them in sync.

Number tools in the order they cut. Tool 1 faces, tool 2 roughs the profile, tool 3 finishes. Avoid reusing a tool number for two different cutters in the same program, even if the geometry looks similar. Someone will load the wrong one.

Record the gauge length for every tool. Length offsets drift when a cutter is re-seated, and a 0.05 mm error in Z shows up as a 0.05 mm error in floor depth. Measure the tool on the presetter and write the number down.

Note the clamping method. A vise on a 750 × 1,150 × 550 mm table holds parts differently than a fixture plate with M6 clamps. The program should not rapid to a Z height that clears the vise but not the clamp bolts.

Step 3

Choose cutting parameters that survive the first cut

Feeds and speeds come from chip load, not from a table taped to the machine. For aluminium 6061 with a carbide 3-flute cutter, a starting chip load of 0.05–0.10 mm/tooth at 300–500 m/min surface speed holds up well. Step up only after the spindle load stays flat.

For stainless 304 and 316L, drop surface speed to 100–150 m/min and keep the chip load at 0.03–0.06 mm/tooth. Stainless work-hardens, so a cutter that rubs instead of cutting will destroy the edge in minutes. Do not dwell in the cut.

Titanium TC4 and Inconel need more care. Use 40–60 m/min surface speed, generous flood coolant and a rigid setup. Climb milling with a sharp, uncoated or AlTiN-coated tool reduces heat at the edge on these alloys.

Depth of cut matters as much as speed. Radial engagement at 30–40% of the cutter diameter and axial depth at 0.5–1.0 × diameter is a safe starting point for roughing. Full-width slotting at full depth is where most broken tools come from.

Step 4

Use G04 dwell and program stops correctly

G04 X(U)_ or P_ sets a dwell time. Feed stops, the spindle does not. Use it to let a spindle reach speed, to clear chips at the bottom of a deep pocket, or to let a corner settle before a finish pass. A typical value is 0.5–2.0 s depending on the operation.

X and U take seconds in most controls, P usually takes milliseconds. Mixing them up turns a 1 s dwell into a 1 ms pause, which does almost nothing. Check the control manual for the machine you are posting to.

Do not use G04 as a substitute for a program stop. When the operator must open the door, flip a part or measure a bore, use M00. When the program should stop at the end of a cycle, use M30. Dwell is for the machine, not for the person.

In deep pockets, dwell at the bottom for 0.5 s while the coolant flushes. That small pause lets chips leave before the cutter pulls back up, which reduces recutting and improves floor finish.

Step 5

Prove the program before you release it

Run the first cycle with the tool offset raised 50 mm above the stock. Watch the position display against the drawing, not the cutter. You are checking that the machine goes where the program says. If the numbers match, lower the offset and cut.

Use single block and a rapid override of 25% for the first full pass. The override slows the non-cutting moves, which is where most crashes happen. Feed moves at cutting speed rarely surprise anyone.

Check the tool change sequence on the machine, not in the simulation. A simulation can miss a clamp bolt or a vise jaw. The physical envelope on a 4,000 × 400 × 150 mm machine is larger than the stock, so the risk is usually in the fixturing, not the part.

After the first part, measure the critical features and log the offsets. If the bore is 0.02 mm small, adjust the cutter radius compensation, not the program coordinates. That keeps the correction in one place.

Workflow

Step by step: from drawing to first good part

Follow this order. Skipping a step moves the error downstream, where it costs more.

  • 1
    1. Mark the datum and the tightest toleranceCircle the datum on the drawing and write the tolerance next to it. A ±0.005 mm bore drives the setup choice more than any other feature.
  • 2
    2. Pick the machine and count setupsUse a 3-axis mill for flat parts with features on one face. Move to 4-axis or 5-axis when two or more faces carry tight features.
  • 3
    3. Write the setup sheetList work offset, tool numbers, gauge lengths, Z zero face and stock size. Keep it on one page the operator can hold.
  • 4
    4. Set feeds from chip loadAluminium: 0.05–0.10 mm/tooth at 300–500 m/min. Stainless: 0.03–0.06 mm/tooth at 100–150 m/min. Titanium: 0.03–0.05 mm/tooth at 40–60 m/min.
  • 5
    5. Cap the depth of cutRough at 30–40% radial engagement and 0.5–1.0 × diameter axial depth. Avoid full-width slotting at full depth.
  • 6
    6. Add dwell only where it helpsG04 P500 for a 0.5 s pause at a pocket floor. Use M00 for operator stops, not G04.
  • 7
    7. Dry run with the offset raisedLift Z by 50 mm, run single block, rapid override at 25%. Confirm positions against the drawing.
  • 8
    8. Cut one part and inspect itMeasure the critical features, log the offsets, and adjust cutter compensation instead of the coordinates.
Reference

Starting parameters by material and operation

Ranges are starting points. Trim by spindle load and chip shape, then lock the values into the setup sheet.

MaterialSurface speedChip loadNotes
Aluminium 6061300–500 m/min0.05–0.10 mm/toothRough at 30–40% radial engagement
Aluminium 7075250–400 m/min0.05–0.08 mm/toothSharper edge, light finish pass
Stainless 304 / 316L100–150 m/min0.03–0.06 mm/toothNever rub; keep constant feed
Steel 4140120–180 m/min0.04–0.08 mm/toothFlood coolant on roughing
Titanium TC440–60 m/min0.03–0.05 mm/toothRigid setup, climb milling
Inconel25–40 m/min0.02–0.04 mm/toothExpect short tool life
POM / PEEK200–400 m/min0.05–0.12 mm/toothSharp tool, air blast helps

Program once, prove once, release safely

Good CNC machining center programming is mostly discipline before the spindle starts: datum, setup sheet, chip load, dry run. Get those four right and the first part usually measures close to nominal.

FAQs

Common questions on CNC machining center programming

When should I use G04 instead of M00?

Use G04 when the machine needs a short pause inside the cycle, for example 0.5–2.0 s at the bottom of a deep pocket so chips clear before the cutter retracts. Feed stops, the spindle keeps turning.

Use M00 when a person has to do something: open the door, flip the part, blow out chips or measure a bore. M00 stops the spindle and the feed. Mixing the two either crashes the part or leaves the operator waiting on a machine that is still running.

How do I decide between 3-axis and 5-axis programming?

Count the faces that carry tight features. If one face holds everything within ±0.005 mm, a 3-axis setup is enough and easier to prove.

If two or more faces carry the tight features, a 5-axis center removes the re-fixturing error between them. That is usually the deciding factor, not cycle time.

What causes a good program to cut a bad first part?

Most first-part failures come from the setup, not the code. A work offset that was set off the wrong corner, a gauge length entered as 120.00 instead of 12.00, or a clamp bolt sitting inside the rapid path.

Run the dry pass with the tool raised 50 mm and compare the position display against the drawing. If the numbers match, the program is likely fine and the problem is elsewhere.

Should I program for the nominal cutter size or the measured size?

Program to nominal and hold the correction in cutter radius compensation. Measure the actual tool diameter and enter the difference in the offset page.

That keeps the program portable. When the cutter is replaced mid-batch, you update one number instead of hunting through the code for every contour.

How much stock should I leave for finishing?

On aluminium, leave 0.5–1.0 mm per side for finishing. On stainless and tool steel, 0.3–0.5 mm is enough because the material work-hardens and light finish passes cut cleaner.

Leave too much and the finish pass deflects the tool. Leave too little and the cutter rubs on a hardened surface. Both show up as poor surface finish and drifting dimensions.

Do I need to document feed and speed changes?

Yes. Write the final values into the setup sheet after the first good part. The next run then starts from proven numbers instead of the original estimate.

Keep the reason short: 'reduced from 0.08 to 0.06 mm/tooth, chip colour too dark.' That single line tells the next programmer which way to move if the material lot changes.

Send us the drawing and the setup question

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

12-hour quote100% inspectionNDA on request

More from GreatLight

Follow our machining notes

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