Introduction and Overview
CNC programming is a segment of the CNC process. CNC machining cannot be performed without CNC programming. The CNC operators need to document and send an alpha-numeric CNC code to the control panel of CNC machines, to enable an automated CNC machining process in a specific sequence.
the CNC coding is the last stage of the overall CNC process. There are pre-programming steps to be followed for successful CNC programming. This article will guide you through a process to develop efficient programs.
The input elements for this process are the technical drawing of the part to be produced, the machines and means available in the workshop.
The CNC programs are documented in reference to the CAD design of the final products. The CAD drawing gives insights into the dimensions of the workpiece and the dimensions and features of the final part.
To begin we will deal with a simple example of a part to be made on a CNC lathe.
Before creating a CNC program, the CNC programmer must develop documentation by following these steps:
1. Determine the processing sequence and the machining operation to be performed:
This involves understanding the part’s design and deciding the type of machining operation(s) needed. planning the order of operations for efficiency and accuracy. All operations carried out without changing the position of the part or the tool are grouped into sequences.

Sequence
Sketch
Tolling
05 -Define the dimensions of the stock and choose the program origin

3 jaws chuck
10 -Facing

CNMT Right Hand
20 -Contour turning: Step turning

CNMT Right Hand
30 -Finishing contour

VNMT Right Hand
40 -Groove

OD Grooving Tool
70 -Boring

ID Boring CNMT
60 -Drilling

Drill
80 -Cutoff

Cutoff Tool
2. Perform mathematical operations :
This involves calculations for determining the coordinates, angles, and dimensions necessary for the machining operations, planning how the part will be held in place during the machining process.
The programmer needs to define dimensions of CNC machining processes; therefore, the calculations must be made. The calculations include the length of tool motion, feed rate, spindle speed, drill depth, etc (Machining Cutting Conditions).

3. Write the CNC Program:
This involves writing the CNC program using a specific syntax or language, typically G-code.
The CNC program is a set of CNC codes that define different machining actions, dimensions, and process parameters for the specific machining action. These CNC codes are alpha-numeric sets defined in a numeric computer programing language. The CNC codes are of two types, namely, G-codes and M-codes.
The G-codes are codes for defining the machining parameters. These codes define what type of machining activity should be performed by the CNC machine for what dimensions, at what feed, or for what duration.
The M-codes define the miscellaneous functions of a CNC machine. This includes starting and ending locations of the CNC tools, timer settings, coolant settings, etc.
The CNC program includes multiple CNC G and M codes to strategically guide the CNC machine for performing the CNC machining process.
% |
O1001 |
N10 G98 G18 |
N11 G21 |
N12 G50 S6000 |
N13 G28 U0. |
N14 G28 W0. |
(FACE1) |
N15 T0202 |
N16 G54 |
N17 M8 |
N18 G99 |
N19 G97 S579 M3 |
N20 G0 X110. Z3. |
N21 G50 S5000 |
N22 G96 S200 M3 |
N23 G0 Z1.414 |
N24 X90. |
N25 G1 X82.828 F1. |
N26 X80. Z0. |
N27 X-1.6 |
N28 X1.228 Z1.414 |
N29 G0 X110. |
N30 Z3. |
N31 G97 S579 M3 |
(EBAUCHE DE PROFIL1) |
N32 G99 |
N33 G0 X84. Z3. |
N34 G50 S5000 |
N35 G96 S200 M3 |
N36 G0 Z1.457 |
N37 X81.5 |
N38 G71 U1.5 R1. |
N39 G71 P40 Q46 U0.4 W0.1 F1. |
N40 G0 X36.586 |
N41 G1 Z0.707 |
N42 X39.822 Z-0.911 |
N43 Z-30. |
N44 X78. |
N45 Z-46.8 |
N46 X80. |
N47 G0 X84. Z1.457 |
N48 Z3. |
N49 G80 |
N50 G97 S758 M3 |
N51 M9 |
N52 G28 U0. |
N53 G28 W0. |
(FINITION DE PROFIL1) |
N54 M1 |
N55 T0606 |
N56 G54 |
N57 M8 |
N58 G99 |
N59 G97 S637 M3 |
N60 G0 X100. Z3. |
N61 G50 S5000 |
N62 G96 S200 M3 |
N63 G0 Z1.941 |
N64 X38.609 |
N65 G1 X37.883 F1. |
N66 Z-0.059 |
N67 X39.822 Z-1.028 |
N68 Z-30.034 |
N69 X40. |
N70 Z-30.2 |
N71 G18 G2 X40.109 Z-30.45 I0.6 |
N72 G1 X50.397 Z-30. |
N73 X78. |
N74 Z-40.2 |
N75 X82. |
N76 G0 X100. |
N77 Z3. |
N78 G97 S637 M3 |
N79 M9 |
N80 G28 U0. |
N81 G28 W0. |
(RAINURAGE SIMPLE1) |
N82 M1 |
N83 T0303 |
N84 G54 |
N85 M8 |
N86 G99 |
N87 G97 S637 M3 |
N88 G0 X100. Z5. |
N89 G50 S5000 |
N90 G96 S200 M3 |
N91 G0 Z-28. |
N92 G1 X35.2 F1. |
N93 X100. |
N94 G0 Z5. |
N95 G97 S637 M3 |
N96 M9 |
N97 G28 U0. |
N98 G28 W0. |
(FILETAGE1) |
N99 M1 |
N100 T0101 |
N101 G54 |
N102 M8 |
N103 G99 |
N104 G97 S500 M3 |
N105 G0 X100. Z3. |
N106 G0 Z-0.742 |
N107 G92 X38.408 Z-25.831 F2. |
N108 G0 Z-0.911 |
N109 G92 X37.822 Z-26. F2. |
N110 X37.822 Z-26. |
N111 M9 |
N112 G28 U0. |
N113 G28 W0. |
(FORET1) |
N114 M1 |
N115 T0404 |
N116 G54 |
N117 M8 |
N118 G98 |
N119 G97 S5000 M3 |
N120 G0 X0. Z16. |
N121 G0 Z6. |
N122 G81 X0. Z-49. R4.518 F1000. |
N123 G80 |
N124 Z16. |
N125 M9 |
N126 G28 U0. |
N127 G28 W0. |
(EBAUCHE DE PROFIL2) |
N128 M1 |
N129 T0505 |
N130 G54 |
N131 M8 |
N132 G99 |
N133 G97 S4547 M3 |
N134 G0 X14. Z3. |
N135 G50 S5000 |
N136 G96 S200 M3 |
N137 G0 Z0.5 |
N138 X15. |
N139 G71 U1. R1. |
N140 G71 P141 Q143 U0. W0. F1. |
N141 G0 X30. |
N142 G1 Z-14. |
N143 X16. |
N144 G0 X14. Z0.5 |
N145 Z3. |
N146 G97 S4547 M3 |
N147 M9 |
N148 G28 U0. |
N149 G28 W0. |
(TRONONNER1) |
N150 M1 |
N151 T0707 |
N152 G54 |
N153 M8 |
N154 G99 |
N155 G97 S637 M3 |
N156 G0 X100. Z3. |
N157 G50 S5000 |
N158 G96 S200 M3 |
N159 G0 Z-44. |
N160 G1 X-1.6 F1. |
N161 X100. |
N162 G0 Z3. |
N163 G97 S637 M3 |
N164 M9 |
N165 G28 U0. |
N166 G28 W0. |
N167 M30 |
% |
Each of these steps requires careful planning and consideration to ensure the part is machined accurately and efficiently. The CNC programming software can help with creating, editing, simulating, and managing CNC programs. It’s crucial to select the appropriate software that suits the requirements and capabilities of your CNC machine.
programmer must document a CNC program. The sequence of G and M codes of CNC programming must be followed and cross-checked.
If all these above-mentioned steps are followed, a successful CNC program can be written. However, verification of the correctness of the program is essential.