CNC Programming – Machines and Techniques


A CNC machine is a programmable device that can autonomously perform various operations of machining to produce a product. CNC means ‘Computer Numerical Control’. An operator applies CNC programming techniques to software-controlled machines that direct the motion of the machinery and its tools.

In the CNC machine, the operator programs the desired operations and feeds them into the machine through the keyboard or downloads them from a computer. The machine then carries out the tasks as specified in the program. It can perform three-dimensional cutting tasks which require accuracy, precision, and very tight tolerances.

CNC machining is a subtractive manufacturing process that employs automated controls and machine tools to remove layers of material from a stock piece. This process results in a custom-designed part and is suitable for a wide range of materials. In this article, you’ll learn about the types of CNC-controlled machines and CNC programming techniques.

CNC machine spindle
Courtesy: Haas CNC

Many precision industries use this manufacturing process including energy, manufacturing, health, aerospace, construction, and agriculture. CNC programming and its associated outputs produce a range of products, such as gears, valve bodies, actuators, and pump parts.

The CNC process allows consistency in production that would be difficult, if not impossible, to replicate manually. CNC machining process enables the production with high precision of high dimensional accuracy parts, cost-effectively even when fulfilling one-off and low volume production runs.

Types of CNC Machines

Mostly CNC machines are cutting machines that can work in 3 linear axes of motion which allows them to produce the most basic geometric shapes. For more complex parts, multi-axis machines are also available such as 5-axis machines which can rotate the cutting head and along with the machine bed.

Here are some types of commonly used CNC machines:


CNC-based lathe machines cut in a circular motion with their cutting tools. With this technology, these lathes carry out the cutting process with precision and high speed.  CNC lathes produce objects which have complex designs that are not easily possible on manual machines.

Milling Machines

CNC milling machine
Courtesy: Huron

Milling machines use multi-point cutting tools that rotate at specified speeds to remove material from a workpiece. The CNC milling process includes face milling, cutting deep cavities into the blanks. It can also produce slots and threads in a workpiece.

Drilling Machines

In the drilling process using multi-point drill bits, one can produce cylindrical holes in the workpiece. In CNC drilling, the rotating drill bit operates on the working surface vertically so that they produce vertically aligned holes. Specialized machine configurations and workpiece holding devices allow angular drilling. CNC drilling capabilities include reaming, tapping, counterboring, and countersinking.

Plasma Cutters

Plasma cutters are useful to cut metals but the machine can cut other materials too. Powered by a combination of compressed air, gas, and electrical arc, a plasma torch that melts through the material. Frequently cut materials by plasma cutters are steel, stainless steel, and aluminum. Brass and copper are ofter commonly used metals.

plasma table with steel plate
Courtesy: Premier Plasma

Electric Discharge Machines

Electric discharge machines (EDM) work by molding workpieces into particular shapes with electrical sparks. EDMs, generate electric discharges between two electrodes, result in a shock heat which removes the desired material from the workpiece.

Laser Cutters

CNC laser cutter operates a highly focused laser beam that precisely cuts or engraves the material. Lasers typically are used with sheet material. A laser beam moves back and forth over the surface to create a precise cut. CNC laser engravers are often used for making decorative items such as a company logo or an inscription piece.

Water Jet Cutters

Water jets are tools that cut and carve hard materials, such as granite with high-pressure jets of water. Adding some strong abrasive material to the water increases their cutting efficiency. CNC water jet cutters are also used in applications that are sensitive to heat since there is no flame or heat which prevents any change in the material and its intrinsic properties.

CNC Programming Techniques

In CNC machines the movement of the tool is usually in the X and Y axes. Servo or stepper motors position the tool, which follows the exact movements as directed by the software program.

After designing the 2D or 3D CAD drawing of an object, the computer-aided manufacturing (CAM) software converts the CAD file to generate the digital programming code which controls the CNC machine and operates the tooling to produce the desired shape. Proper CNC programming techniques require an understanding of the CNC programming workflow and the concepts of Machine Zero and Part Zero.

CNC Programming Work Flow

CNC programming techniques workflow
Courtesy: CNC Cookbook

Programmers who are well versed in machine operations write the CNC programming code. To begin the process the program prompts the machine to initiate the machining process, and the program directs the machine during the entire process as it executes the necessary machine operations to produce the part or product. It is possible to specify the speed and position of the machine tool functions and run them in repetitive, predictable cycles, all with little involvement from human operators.

The low-level language behind CNC machining is the G-codes and M-codes.  The CNC machines operate by interpreting this special programming language. The G codes are geometric codes. They create motion such as movement of the cutting head, the spindle speed, feed rate, etc., dictating how and where a machine should move to fabricate the object.

The M-codes drive the auxiliary machine functions including starting, stopping specific actions, removal, and replacement of the machine cover at the start and end of production, etc. The M-codes also activate the PLC programs. They also include information about coolant characteristics, tool changes, program stops, and any other pertinent machine settings.

The CNC language can be quite complex and can vary from machine to machine. The basics, however, are much simpler and mostly follow an industry standard.

There are many G-Code standards and dialects. Due to a large number of users, the Fanuc dialect of G-codes is most common among professionals and the Mach-3 dialect is the more popular G-code among the hobbyists. Many machines in today’s market do not require an operator’s understanding of specific codes. Today, many CNC programming techniques do not require an in depth understanding of G-Code or M-code. A touchscreen interface is provided and the user’s input forms the basis of the programming.

Difference between Machine Zero, Work Zero, Part Zero

Machine Zero and Work Zero illustrations
Courtesy Edgar King

The CNC machine works on an object in 3–dimensions, represented by the x,y,z geometric coordinate system. The origin or x=0,y=0,z=0 position of the machine is called Machine Zero. Workpiece zero coordinates are called the Work Zero. They are often different from each other as both the origins do not coincide and there is an offset between both the geometric origins. The CNC machine knows this offset so that it can accurately operate on the workpiece. This offset can be determined by a certain procedure that is specific to each CNC machine. Once determined, this offset information feeds to the CNC machine. Now the machine can operate on the workpiece correctly as now it knows the exact position of the workpiece in its workspace. Work Zero sometimes may be referred to as Part Zero.  

Final Words

Many industries use CNC machines for producing machined components. CNC machines can produce complex designs and objects rather quickly and accurately. Using CAD software manufacturers can easily preview parts and products as 3D models before their production. CNC machine tools assure that they produce products that meet the standards for both quality and consistency.

Precision matters in safety-critical industries such as medical, defense, petrochemical, and aerospace. Component failure in these sectors could be critical and that is why these areas require the highest degree of accuracy during their manufacture. CNC machines can achieve the necessary level of precision to ensure the production of high-quality parts and are a crucial part of any modern machining system.