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

Get Instant Quote

Programming guide

How to Program CNC Milling Machine

This guide walks through how to program CNC milling machine work, from a finished CAD model to a proven, posted program. It is written for engineers and shop programmers who need parts that hold ±0.005 mm without burning a setup on trial cuts.

3-axis to 5-axisFeeds and speedsSetup and probingFirst-article checks
how to program cnc milling machine
Quick answer

Key takeaways

Programming starts with the modelA clean solid model and a defined datum decide more than the CAM strategy does.
Speeds and feeds are not guessesStart from surface speed and chip load for the material, then correct with the first cut.
Setup eats the toleranceMost ±0.005 mm misses come from workholding and re-fixturing, not from the toolpath.
Prove before you cut metalSimulation plus a single roughing pass on scrap is cheaper than a scrapped part.
Post-processor mattersA generic post on a 5-axis machine produces code the control will reject.
Before CAM

What to prepare before you program a CNC milling machine

Programming is the last third of a job, not the first. Before you open CAM, the model, the stock and the datums have to be settled. If the CAD file still has open surfaces or a missing fillet radius, the toolpath will follow the error and the operator will chase it at the machine.

Fix the model first. Close every surface, add a 0.4–0.8 mm corner radius to internal pockets where the tool allows it, and confirm that the smallest internal radius is larger than the smallest cutter you plan to run. A Ø3 mm end mill cannot clear a 1 mm corner.

Define the datum. Pick one primary face, two edges and a clear Z zero. Write them on the setup sheet. When the same part runs on a second machine, that sheet is what keeps the two setups aligned.

Check stock allowance. On a 6061 aluminium block, leave 0.5–1.0 mm on each face for finishing. On 17-4PH stainless, leave 0.3–0.5 mm and expect more tool wear. Too much stock means more passes, more heat and more chance of movement.

CAM work

Building the toolpath when you program CNC milling machine operations

Start with the roughing strategy. For most prismatic parts, a 2D adaptive or dynamic roughing path with a constant chip load removes material faster than a traditional offset pocket. Step-over of 40–60% of the cutter diameter is a common starting range on aluminium.

Choose the cutter for the feature, not for the whole part. A Ø12 mm three-flute carbide end mill handles most roughing on aluminium. Drop to Ø6 mm for pocket corners and Ø3 mm for detail. Each tool change costs time, so group features by cutter.

Set the finishing pass last and keep it light. Radial depth of cut of 0.2–0.5 mm and axial depth of 0.5–1.0 times the diameter keeps deflection low. That is how you hold ±0.005 mm on a wall that is 30 mm tall.

For 5-axis work, decide early whether you need simultaneous motion or just indexed positions. Indexed 3+2 setups are easier to verify and often faster to program. Reach for full simultaneous cutting only when the surface cannot be reached any other way.

Cutting data

Feeds and speeds that survive the first cut

Work from surface speed, then convert to spindle rpm. For 6061-T6 with a carbide tool, 300–500 m/min is a normal range. For 304 stainless, 80–120 m/min. For Ti-6Al-4V, 40–60 m/min. Then rpm = (surface speed × 1000) ÷ (π × cutter diameter).

Chip load sets the feed. A three-flute Ø12 mm cutter in aluminium runs well at 0.08–0.12 mm per tooth. Feed rate = rpm × flutes × chip load. If the chips come off as dust, the feed is too low. If the cutter squeals, the feed is too high or the tool is not rigid enough.

Depth of cut is a rigidity decision. A short tool in a solid holder can take 1.0 × diameter axial depth. A long tool at 4 × diameter length should be limited to 0.3 × diameter or less. Long reach is where chatter starts.

Coolant and chip evacuation matter more than most programmers admit. Aluminium wants flood coolant or high-pressure air. Titanium wants high pressure and no rubbing. A recut chip will ruin a finish faster than a wrong feed number.

Post and verify

Posting the program and proving it before the spindle turns

Match the post-processor to the control. A Fanuc post will not run correctly on a Heidenhain control, and a 3-axis post cannot output rotary moves. Check that the posted code carries the right work offset, tool length compensation and safe Z retract.

Read the posted code, at least the first 50 and last 50 lines. Look for the G43 tool length call, the G54 offset, the spindle direction and the coolant command. Missing a G43 is a crash, not a scrap part.

Simulate with the actual stock and fixture model, not just the part. Most collisions happen between the holder and the vise, or between the tool and a clamp that was not in the CAM file.

Cut air first. Run the program with the tool 50 mm above the stock and watch the machine. Then take one roughing pass on scrap material of the same grade. Only after that should the real part go in the vise.

Workflow

Step by step: how to program CNC milling machine operations

Follow these in order. Skipping step 2 or step 7 is the most common cause of scrapped first articles.

  • 1
    1. Prepare and inspect the CAD modelClose all surfaces, confirm wall thickness, and check that internal corner radii are larger than the smallest cutter you will run. Export STEP AP214, not STL, for machined parts.
  • 2
    2. Define datums and work offsetsChoose one primary face and two edges. Assign G54 for the first setup, G55 for the second. Record them on a setup sheet with the Z zero reference.
  • 3
    3. Set the stock and fixture modelModel the vise, clamps and any soft jaws in CAM. Leave 0.5–1.0 mm finishing allowance on aluminium, 0.3–0.5 mm on stainless and titanium.
  • 4
    4. Build the roughing toolpathUse adaptive or dynamic roughing with 40–60% step-over on aluminium. Keep the axial depth at 0.5–1.0 × cutter diameter for short tools, less for long reach.
  • 5
    5. Add semi-finish and finish passesRadial depth of cut 0.2–0.5 mm, axial depth 0.5–1.0 × diameter. Use a separate finish tool when the wall height exceeds 3 × the cutter diameter.
  • 6
    6. Calculate feeds and speeds per materialAluminium 300–500 m/min, stainless 80–120 m/min, titanium 40–60 m/min. Chip load 0.08–0.12 mm per tooth for a Ø12 mm three-flute cutter in aluminium.
  • 7
    7. Post, read and simulatePost with the correct machine post. Read the first and last 50 lines for G43, G54, spindle direction and coolant. Simulate with the full fixture model, not just the part.
  • 8
    8. Prove on scrap, then measureRun one roughing pass on scrap of the same material, then check the first feature with a micrometer or CMM before releasing the full run.
Decision table

Cutting parameters by material and operation

Starting values for a coated carbide tool on a rigid setup. Adjust after the first cut.

MaterialSurface speedChip load (Ø12 mm, 3-flute)Typical use
6061-T6 aluminium300–500 m/min0.08–0.12 mm/toothRoughing and finishing
7075 aluminium250–400 m/min0.06–0.10 mm/toothHigh-strength brackets
304 stainless80–120 m/min0.04–0.07 mm/toothRoughing, light finish
17-4PH stainless60–90 m/min0.03–0.06 mm/toothFinishing after stress relief
Ti-6Al-4V40–60 m/min0.03–0.05 mm/toothRoughing with high-pressure coolant
POM / PEEK200–400 m/min0.05–0.10 mm/toothFinishing, sharp tools only
Brass C36000200–350 m/min0.05–0.10 mm/toothHigh-speed finishing

The short version

Program the setup before you program the toolpath. Datums, stock allowance and fixture clearance decide whether the part holds ±0.005 mm; the CAM strategy only decides how fast you get there.

FAQs

Common questions about CNC milling programming

Do I need 5-axis CAM to program a 5-axis machine?

No for indexed work. A 3+2 setup only needs the post to output rotary positions, and most CAM packages handle that.

Yes for simultaneous cutting. A part with a contoured surface that must be cut in one continuous pass needs a 5-axis toolpath and a matching post, or the control will alarm on the rotary moves.

How much stock should I leave for finishing?

On aluminium, 0.5–1.0 mm per face is a safe starting point. On stainless and titanium, 0.3–0.5 mm keeps the finishing pass light.

Thin walls need less. A 1 mm wall with 1 mm of stock will move during roughing and the finishing pass cannot bring it back.

Why does my part measure oversize after the finishing pass?

Check tool runout first. A cutter with 0.02 mm of runout will cut oversize on every pass.

Then check thermal growth and workholding. A vise clamped too hard on a thin section springs the part open when released, and the measured size changes after unclamping.

Can I program and run a prototype in one day?

For a simple prismatic part, yes. A clean model, one setup and a proven post can be ready in a few hours.

For a 5-axis contoured part with thin walls, the setup and first-article check usually take longer than the programming itself.

What file format should I send for programming?

Send STEP AP214 or a native CAD file. STL is a mesh and loses the exact radii and flat faces the toolpath needs.

Include a 2D drawing with the tolerances and datum callouts if any feature is not fully defined by the 3D model.

How do you keep programming data confidential?

Uploads are handled under NDA on request, and our quality system is certified to ISO 27001:2022 for information security.

We can work from a stripped model that removes customer identifiers if the part geometry is the only thing the programmer needs.

Send the model, get a programmed and machined part

Upload your CAD file and we return a quotation with free DFM analysis within 12 hours, then a first article you can measure.

12-hour quote±0.005 mm100% inspection

Follow our shop

More programming and 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