There’s no arguing: CNC machines are incredibly accurate. Their ability to precision cut ¼ the width of a human hair (0.001”), makes them essential in any modern machine shop.
Yet, simply having the ability to perform such feats is only half the story. The machines on their own are useless without the right automated “computer numerical control” (or CNC): the coded programmed instruction that really makes these machines so impressive.
While CNC machines may use one of three types of CNC machine programming methods — manual, conversational, CAM system — our focus today is on the most versatile and accurate: CAM system programming. Why? Because that programming type is used when a CNC machined part’s accuracy is at a premium.
G-Code and M-Code: Making the Magic Happen
A program is a code sequence that tells the CNC machine what to do. The programming language — consisting of both G-code and M-code — controls the CNC machinery, allowing for accurate and repeatable part manufacturing. We covered the details of G-code and M-code in a previous article, but it’s helpful to review the basics here.
Think of G-code as the master of action, telling the machine tool where to go (a specific geometric location) and what the command is (such as “rapid movement”). M-code is the organizer of functions, giving the machine a task (“start spindle rotation” or “turn coolant off”).
So, while the programming codes of “G00G58X-120.Y-5” and “M82” may look like nonsense to the untrained eye, they provide specific direction that’s vital to the final quality of the machine part.
One important reminder: the programming alone cannot guarantee quality; it requires the right tooling and skilled machinists to run a CNC machine center at its peak.
How Does the Software Work?
To create reliable CNC machine code, an engineer uses a computer-aided manufacturing (CAM) programming tool. One common example and industry-standard, Mastercam®, is software that takes input from an engineer and outputs the right G-code and M-code for the project into a post-processor (which has separate software, linked to Mastercam).
There are different post processors, depending on the machine, because some M-codes are machine-specific. Yet, to make life easy on engineers, once the Mastercam program is posted out to all machines, the codes automatically update for each CNC machine.
Remember when we said that “manual programming” isn’t as modern as CAM system programming? On occasion, a machinist will need to manually edit a program at their CNC machining center, physically typing in G-code or M-code when adjustments are needed. Of course, that requires an overall knowledge of programming, the part prints, each specific machine, and specific coding. The point is: CNC programming isn’t simply a matter of pushing the machine’s “start” button without guidance and an expert eye.
Secure Fixtures = Faster Cycle Time
Workholding has more impact on machining a project than many people think. Engineers need to evaluate a fixture (which could be manual or full hydraulic) as well as production volume before deciding how aggressive the program will be (how fast tools will run). The more secure and rigid the workholding, the more aggressive the cut tooling can run. Because high-end fixturing is stout, cut tools can be pushed to the upper limits of their Surface Feet per Minute (SFM) and Chip Load right out of the gate.
Programming: The Final Part of the Process
Although many people may see programming as a beginning step in the CNC machining process, it’s really the final step.
A vast majority of an engineer’s time is spent before any code is produced by the Mastercam software. Here’s what an engineer inputs into the software in order to get the correct code:
- Material being machined
- Machine type
- Part tolerance
- Tooling needed to achieve the tolerance
- Cycle time
- Surface finish
- Fixture design
All of that needs to be determined first, which makes programming the final step of the process before any CNC machine programming hits the shop floor.
How to Check Programming for Quality
At the beginning of a project, a customer sends the CNC machine shop CAD (computer aided design) models of both the cast part and the finished machined part. To test the programming, the Mastercam software verifies that every tool will go where it needs to go and do what it’s supposed to do. It virtually machines the raw cast model into a CAM finished part model, and then it checks against the actual customer part model. Any differences are highlighted and compared to help the programmer double-check their work.
As a another check, an experienced machinist on the shop floor executes a “dry run of tools” on the very first piece to ensure the design meets practice. The machinist runs through the program, but with the tool “cutting” air in front of the part while operators view it. They do this by adding just enough negative wear to each tool to keep them from engaging the part. This way the tool nears the part to see the motion without engaging.
This allows the machinist to catch any issues including unforeseen tolerance stack ups. For example, machining access around clamps can be tight, so this is an area of focus. If there are questions, the operator meets with the programmer to review the program, and toolpath changes can be made instantly. With experienced programmer advanced CAM tools, 99% of programs don’t need any changes out of the gate.
This screenshot from the Mastercam programming software shows the circular gray tool holder and tool machining the blue part, leaving a trace of yellow from its most recent cut.
That very first piece also undergoes a “first article inspection” quality check by the operator at the machining center bench where the part is gauged. It then goes to the shop’s quality lab where quality engineers run the part on a CMM (coordinate measuring machine) to verify and measure the physical geometrical characteristics of the part.
Training to be a Programmer: Learning the Process
How to program CNC machines is taught in many technical schools, yet nothing beats on-the-job training. Many shops have apprenticeships during which hands-on training is emphasized. In addition, Mastercam offers training programs and online webinars, too.
“Code doesn’t just write itself.” Well, it kind of does! If the engineer provides Mastercam with the correct information, the software writes the code. What’s most important is applying the process and knowing how to manufacture the parts. Reviewing a part print and quickly determining cutting tools, machine type, cycle time, fixturing, etc. comes over time. No textbook provides that day-in, day-out knowledge; it has to be learned through experience.
Operators also receive process training from the engineer who shows Mastercam details and shares exactly what the tool is supposed to do, making time spent in front of the spindle that much more productive.
It says something about a CNC machine shop’s quality standards when their specialty is taking on complex projects with demanding, tight tolerances. Stecker Machine leans on its CNC machine programming to help put operators in the best position to succeed and deliver high-quality, high-precision parts to our customers.
As you’ve read, tooling goes hand-in-hand with CNC machine programming. Learn more about how to approach your tooling needs and read about 4 real-life improvements in cutting tools. Get our guide: CNC Tooling Improvements and Partnerships. Click the link below now!