CNC | Part Programming Techniques


A CNC machine is only as good as the part programs being used for machining. The role of the machine operator is generally limited to clamping and unclamping the workpiece, for which even a semiskilled worker would be good enough. The quality and efficiency of production depends mainly on the programming skill of the programmer. The programmer need not be an expert machinist, but he must have a very good knowledge of shop floor practices. In addition, he must know the available control features of his machine. It is only then, efficient part programs, producing good results, can be developed. A CNC machine works just like an “obedient slave,” doing exactly what it is instructed to do, in a very precise manner. Hence, a CNC machine would be worth its name, only if the instructions given to it, through the part programs, offer the best possible solution to perform a given task.

Broadly speaking, there are four different ways of preparing part programs, described in brief in the following sections.

Conventional Part Programming

Conventional part programming, which is a simple G-code/ M-code programming, suffers from several limitations and has limited scope. If one needs to machine only limited types of workpieces in a routine manner, without bothering much about the efficiency of the production activity, conventional part programming would generally be adequate. The limitation of conventional programming is that it does not allow the use of variables, mathematical operations, functions, logical statements, looping, and the like in a program. In other words, it does not have even the basic features of a typical computer language such as PASCAL. It is just a rigid type program for a particular requirement. This obviously limits the scope of programs to a great extent. It is not possible to write an “intelligent” part program with built-in logic for different requirements. In fact, as we will see later, there are a number of applications where conventional part programming cannot be used. It only serves the limited purpose for which it was designed.

Conversational Part Programming

Even conventional part programming is fairly complex. So, for the purpose of simplifying programming for certain common applications, conversational or lead-through programming (referred to as blue print programming or direct dimension programming) was introduced, which enables users to even without having adequate programming experience, easily develop suitable part programs. The programmer need not know the part programming language in detail; he only has to know what is to be done in what sequence, and with what cutting parameters. The control prompts him for all the required information, in an interactive manner. This method of programming, however, suffers from the inherent limitation of being applicable only to certain specific geometries. So, even though it is possible to quickly write efficient programs for some common applications, this method is useless for special requirements. In reality, conversational programming is only a small subset of what can be done with conventional part programming technique. In fact, conversational programming is not meant for qualified engineers.

Part Programming Using CAM Software

As long as only two axes of a machine are required to be simultaneously controlled (including helical interpolation), which is usually the case in most of the practical applications, it is possible to write suitable part programs manually, unless the geometry is nonstandard, for example, involving a parabolic segment. For nonstandard and/ or three- dimensional geometries, such as die machining, manual development of part programs might become too tedious or even impossible in certain cases. Several CAM software’s have been developed, which generate the required toolpath for the desired machining, and automatically prepare a part program to suit the selected control version. However, the basic purpose of CAM software is to calculate what cannot be calculated manually (e.g., the toolpath for a S-axis machining where it is desirable to always keep the axis of the tool perpendicular to the surface it is machining). So, even though it can generate a complex toolpath, and give certain machining-related information such as machining time, interference check, etc., this is all it can do. Broadly speaking, it does not add additional features to conventional part programming. The difference between conventional part programming and computer-aided part programming is very much like the difference between manual arithmetic calculations and calculations using a calculator. So, CAM software is useful only for the purpose for which it is designed. It does not offer total manufacturing solution. There are requirements, as we will see later, for which it becomes simply useless.

Macro Programming

In the 1990s, basic features of high-level computer languages were incorporated in the conventional part programming language. The new programming language was called macro programming, the features of which closely resemble the BASIC computer language. Over the years, macro programming has seen steady development. It is now quite advanced, except that alphanumeric characters still cannot be used as variable names, among certain other limitations. Macro programming, as we will see later, has completely changed the way CNC machines are programmed these days, opening up endless possibilities, limited only by the imagination of the programmer.

Comparison among the Four Methods

Each out of the four ways to prepare part programs has its own area of application, serving its specific purpose. Any comparison among these is thus meaningless. Macro programming, however, offers several tools for enhancing productivity, which is not possible with any of the other three methods. The emphasis today is not just on automation, to boost productivity; it is also on flexible automation, so as to respond quickly to the fast-changing market requirements. Macro programming can make the part programs so flexible with built-in logic that the same program can be used for different machining requirements. Moreover, in many cases, a CNC machine can be programmed to make its own decision in different situations, without any intervention from the operator. All this results in unparalleled productivity enhancement.