CNC Machining

Table of Contents

What is CNC Machining?

CNC machining is a manufacturing process in which machines are programmed using software to perform three-dimensional tasks. The name CNC stands for “computer numerical control” and stems from how the machines are controlled by software while operating as opposed to being operated manually [1]. As this kind of machining is done using pre-programmed software, machining tasks that require multiple degrees of movement simultaneously can be performed quite easily with high precision. This is generally not possible when operating a machine manually.


There are also countless types of CNC machines such as milling machines, lathes. Functionally machines may differ in terms of how the tool moving in relation to the workpiece, however, they are programmed in generally the same way.


Advantages and Disadvantages of CNC Machining

Advantages [2]

  • Very precise and accurate
  • Uniform outputs 
  • Can machine parts with greater complexity
  • Requires less labor
  • Less wear and tear on tools
  • Fewer number of setups needed

Disadvantages [2]

  • Upfront cost
  • Manual skills becoming obsolete
  • Expensive repairs




Programming CNC Machines


The process of programming a CNC is relatively straightforward. Understanding what the code is doing is and when it may need to be altered is the difficult part.
CNC machines are programmed using what are called G-Codes. These are simple instructions that when executed in order tell the machine where to move to and at what speed. There are also specific codes that give the machine information such as what unit of measurements to be using. A set of these instructions is called a toolpath. Multiple toolpaths may be necessary depending on the CNC machine and the part being created to achieve the final end product.


The basic steps to generate this program and running it are outlined below [1] :

  1. A two- or three-dimensional part model is created using computer-aided design (CAD) software. This will be the desired end product.
  2. Use computer-aided manufacturing (CAM) software associated with the CAD software to translate the model into G-Code. Multiple toolpaths may be needed depending on the part and CNC machine being used.
  3. Test each toolpath in a trial run to see if there are any mistakes present in the code. This can usually be done in simulation using the CAM software first. Next, a trial run on the CNC machine, without actually cutting any material can also be done as an added test.
  4. If there was no mistake found in the trial run, go to the next step. Otherwise, fix any mistakes and redo the trial run.
  5. Finally, setup the CNC machine so that the toolpaths can be executed to create desired parts.


Preventing Errors

A very important idea to keep in mind while programming and operating a CNC machine is that the machine has no idea of what its surroundings are like. It will do exactly as the program it’s running tells it to. So if that program tells it to cut into the bench vice that’s holding the workpiece, it will do it. If the program tells it to plunge the cutter straight into the workpiece at an alarming speed, it will do it. That is why doing the trial run in simulation can be such a vital step in making sure you prevent these errors before they can ever happen. 


Another helpful way to prevent any such errors is to glance over the G-Code to see if any commands are not supposed to be there. This can be tough as there may be thousands of lines of G-Codes. With some experience, however, you can start to recognize certain commands that may not need to be there.


Common G-Codes and M-Codes

G-Codes and M-Codes are used to tell the machine what to do. G-Codes are used to tell the machine how to move, whereas M-Codes direct operations outside of movement [3]. Here are some of the common codes and their meanings [4]:

CodeDescription
G00Rapid position. Move from current position to coordinates specified at maximum speed.
G01Linear Interpolation. Move in a straight line at set feed rate to specified point.
G02

Circular Interpolation Clockwise. Move clockwise in a circular pattern. Need to define end point, center of rotation or the distance of start point from the center point of the arc.

G03Circular Interpolation Counterclockwise. Move counterclockwise in a circular pattern. Need to define end point, center of rotation or the distance of start point from the center point of the arc.
G20

Unit Selection of inches. The commands in the G-Codes are in inches.

G21

Unit Selection of millimeters. The commands in the G-Codes are in millimeters.

G28

Return Home. Returns tool to set reference point. Can set an intermediate point to avoid collision with part.

G90Absolute Positioning. Commands given are with reference to the absolute point or zero location.
G91

Relative Positioning. Commands given are with reference to last position.

M00Program Stop
M02End of Program
M03Spindle ON -Clockwise
M04Spindle ON – counterclockwise
M05Spindle OFF
M06 Tool Change
M08Flood Coolant ON
M09 Flood Coolant OFF
M30End of Program
Figure 1. An example of a simple G-Code program [3].

 


Contributors: 

UserLast Update
Lesley Lang 1069 days ago
Former user (Deleted)

Faculty Advisor: Dr. Sanjeev Bedi