CNC Lathe Programming Guide & Tips – How to Make CNC Turning Program | CNCLATHING


CNC machines are a combination of electronic information technology and traditional machining processes, utilizing precision machinery, computer, communication, and more techniques to provide an effective solution for complex, precise, small-batch parts production. Take the lathe machine as an example, how to make CNC turning program? Here we bring some CNC lathe programming tips and examples.

CNC Lathe Program Examples

Check out the following two simple CNC lathe programming examples of different instructions. 

CNC Lathe Programming Example 1 – Lathe Program of Chamfering Instruction:

N10 G92 X70 Z10 (set up the coordinate system and define the position of tool setting point)

N20 G00 U-70 W-10 (from the programming starting point to the center of the front end face of the workpiece) 

N30 G01 U26 C3 F100 (chamfering 3 × 45 °right angle) 

N40 W-22 R3 (chamfering R3 fillet)

N50 U39 W-14 C3 (inverted side length is 3 isosceles right angle) 

N60 W-34 (machining Φ 65 outer circle)

N70 G00 U5 W80 (back to the starting point of programming)

N80 M30 (spindle stop, main program end and reset)

CNC Lathe Programming Example 2 – Lathe Program of Circular Interpolation G02/G03 Instruction:

N1 G92 X40 Z5 (set up the workpiece coordinate system and define the position of tool setting point) 

N2 M03 S400 (the spindle rotates at 400R / min)

N3 G00 X0 (to workpiece center)

N4 G01 Z0 F60 (contact workpiece blank)

N5 G03 U24 W-24 R15 (machining R15 arc section) 

N6 G02 X26 Z-31 R5 (machining R5 arc section) 

N7 G01 Z-40 (machining Φ 26 outer circle) 

N8 X40 Z5 (tool return the setting point)

N9 M30 (spindle stop, main program end and reset)

Popular CNC Lathe Cycle Program

G70 – Finishing Cycle

G71 – Roughing Cycle

G72 – Facing Cycle

G73 – Pattern Repeating Cycle

G75 – Peck Grooving Cycle

G76- Screw Thread Cycle

G83 – Z-axis Peck Drilling Cycle

G84 – Z-axis Tapping Cycle

G87 – X-axis Peck Drilling Cycle

G88 – X-axis Tapping Cycle

How to Program CNC Lathe? - CNC Turning Programming Tips & Guide

To make CNC program for a lathe machine, there are some tips can be applied in the programming process. Check the following CNC lathe programming tips. 

1. Reasonable and efficient use of the inherent cycle program

1) Make full use of the CNC cycle program

– In FANUCO―TD CNC system, the CNC lathe has more than 10 kinds of cycle programs, such as G70 and G71, each instruction has its own characteristics, the machining accuracy of the workpiece after processing and their programming methods are different. We should carefully analyze and reasonably select in order to process high precision parts.

– In Siemens system, there are standard machining cycles LCYC82、LCYC83、LCYC840、LCYC85、LCYC93、LCYC94、LCYC95、LCYC97, etc., among them, grooving cycle LCYC93, thread cutting LCYC97 and blank cutting cycle LCYC95 play a decisive role in high efficiency programming, especially LCYC95 and LCYC93. As long as the starting point and end point of the contour are given, the parts can be guaranteed to achieve the part drawing requirements and process requirements, more importantly, programming is fast and convenient. Therefore, it is necessary to understand the fixed cycle programming instructions of the machine tool when operating the CNC machine tool. As long as it is flexibly and comprehensively used, the programming debugging time can be shortened when processing small batch parts, so as to improve the programming efficiency and production efficiency.

2) Apply in practice 

In the actual CNC turning operation, a certain fixed processing operation often occurs repeatedly. This part of operation can be written into subroutines, stored in memory in advance, and called at any time according to the need, so that the programming becomes simple and fast.


2. Select a proper feed (tool) path

The feed path is the motion track of the cutting tool in the whole machining process, that is the path the tool pass through starts feeding from the setting point to returns to the point when the machining program is ended.   

1) Try to shorten the tool path, reduce the empty travel and improve the production efficiency

– Use the starting point skillfully. For example, in the cycle processing, according to the actual processing situation of the workpiece, separate the tool starting point and tool setting point. Under the premise of ensuring safety and meeting the tool change needs, the tool starting point should be as close to the workpiece as possible to reduce the idle tool travel, shorten the feed path, and save the execution time in the machining process.

– When rough machining or semi finishing machining, the blank allowance is large, so the appropriate cycle processing method should be adopted. Taking into account the rigidity of the parts to be processed and the processing technology requirements, the shortest cutting feed path should be adopted to reduce the idle stroke time, improve the production efficiency and reduce the tool wear.

2) Ensure the safety of the processing process

Avoid the interference between the tool and the non-machined surface, and avoid the collision between the tool and the workpiece. If the workpiece needs to be machined when encountering a groove, it should be noted that the feed and retreat point should be perpendicular to the groove direction, and the feed rate can’t be “G0”. “G0” command should avoid “X, Z” moving at the same time.

3) Reasonably call motion instructions to minimize program segments

According to each individual geometric element (straight line, oblique line and arc, etc.), work out the corresponding processing program, which constitutes each program segment of the machining program. In the actual production operation, a certain fixed processing operation often occurs repeatedly. This part of operation can be written into subroutines, stored in memory in advance, and called at any time according to the need, so that the programming becomes simple and fast. 


3. Flexibly use special G-code, ensure the CNC parts machining quality and precision

1) Return to Machine Zero Point – G28, Bed Leveling – G29 

The reference point is a fixed point on the machine tool. The tool can be easily moved to this position through the reference point return function. In practical processing, the precision of products can be improved by skillfully using the instruction of returning to reference point. In order to ensure the machining accuracy of the main dimensions, the tool can return to the reference point before machining the main dimension, and then run to the machining position again. The purpose of this practice is actually to re check the benchmark to determine the dimensional accuracy of machining.

2) Dwell Time – G04 

– Temporarily limit the operation of the machining program. 

– In order to reduce the operator’s misoperation caused by fatigue or frequent buttons, G04 command is used instead of the start-up of the first part. The part processing program is designed as a cycle subroutine, and G04 instruction is designed in the main program calling the cycle subroutine. If necessary, the plan stop M01 instruction is selected as the end or check of the program.

– When tapping the central thread with a tap, it is necessary to tap the thread with an elastic cylinder chuck to ensure that the tap will not break when tapping to the bottom of the thread. A G04 delay command is set at the bottom of the thread to make the tap perform non feed cutting. The delay time should ensure that the spindle stops completely. After the spindle stops completely, it reverses according to the original forward rotation speed, and the tap moves backward according to the original lead.

3) Incremental programming – G91, Absolute programming – G90 

Incremental programming takes the position of the tool tip as the coordinate origin, and the tool tip moves relative to the coordinate origin to program. In the whole process of machining, absolute programming has a relatively uniform reference point, that is, coordinate origin, so its cumulative error is smaller than that of relative programming. In CNC turning, the accuracy of radial dimension of workpiece is higher than that of axial dimension. Therefore, absolute programming is better for radial dimension in programming. Considering the convenience of machining, relative programming is adopted for axial dimension, but absolute programming can also be used for important axial dimension.