You are on page 1of 23

CNC Parts Programs

CAM Lab

(version dated.23.03.2017)

Important Points with regard to CNC Part Programming

Part Program can be written

(1) manually or

(2) obtained with the help of a CAM software (NX/ MasterCAM etc)

1. One should learn the syntax/ format of the various G-codes and the input parameters
to be given along with the code. Without knowing the format and arguments/
parameters, one cannot use the codes.

Format

G94 X_ Z_ F_

G90 X_ Z_ R_ F_

G71 U_ R_

G71 P_ Q_ U_ W_;

G170 R_ P_ Q_ X_ Y_ Z_ I_ J_ K_

G171 P_ S_ R_ F_ B_ J_

2. After studying the required part geometry and features, one can write the program.
TOOL PATH is the main thing to be kept in mind while writing a part program. One
should mark the points P1, P2, P3, where the cutter is to move to achieve the given
profile and then use relevant G codes for interpolation and cutting cycles.

3. A CNC Mill Program is defined as a set of instructions given to the machine control to
move the positioning of the machine spindle, changes to the spindle RPM, and changes
to the machines other features (Tool Changes, Coolant System, Chip Control, etc).
Tool movements consist of rapid positioning commands, straight line movement of the
tool at a controlled speed, and movement along an arc.

4. A Canned cycle is a way of conveniently performing repetitive CNC machine


operations. Canned cycles are tremendous time savers when manual programming and
when you need to edit the program at the machine.

Canned cycles provide a programming method of a CNC machine to accomplish


repetitive machining operations using the G/M code language. Essentially, canned
cycles are a set of pre-programmed instructions permanently stored in the machine
controller that automate many of the required repetitive tasks. Their use eliminates the
need for many lines of programming, reduces the programming time and simplifies the
whole programming process. All CNC machining controls come with a set of helpful
machining canned cycles. These canned cycles are executed or called up by entering
a certain code together with any required variable information. Once canned cycle has
been defined it remains active until cancelled. Drilling, counter-boring, peck drilling,
pocket or slot machining are all examples of standard canned cycles.
[Q1]

Question

Write the CNC Part Program to turn the component on CNC Turning Machine
(XLTURN) and write the process sheet for the same. The drawing of the finished
component is provided.

TAPER TURNING

Answer:

Taper Turning

CNC Part Program

[BILLET X25 Z75 ;


G21 G98;
G28 U0 W0 ;
M06 T03
M03 S1000:
G00 X25 Z1 ;
G94 X0 Z-0.5 F50 ;
G90 X24.5 Z-45 ;
X24 ;
X23.5 Z-6;
X23 ;
X22.5 ;
X22 ;
X21.5 ;
X21 ;
X20.5 ;
X20 ;
X19.5 ;
X19 ;
X18.5 ;
X18 ;
X17.5 ;
X17 ;
X16.5 ;
X16 ;
X15.5 ;
X15 ;
X14.5 ;
X14 ;
X13.5 ;
X13 ;
X12.5 ;
X12 ;
G00 X24 Z-6 ;
G90 X24 Z-18 R-0.5 F50 ;
X24 R-1 ;
X24 R-1.5 ;
X24 R-2 ;
X24 R-2.5 ;
X24 R-3 ;
X24 R-3.5 ;
X24 R-4 ;
X24 R-4.5 ;
X24 R-5 ;
X24 R-5.5 ;
X24 R-6 ;
G00 X24 Z-24 ;
G90 X23 R0.5 Z-39 F50 ;
X22 R1 ;
X21 R1.5 ;
X20 R2 ;
X19 R2.5 ;
X18 R3 ;
X17 R3.5 ;
X16 R4 ;
X15 R4.5 ;
X14 R5 ;
X13 R5.5;
X12 R6;
G00 X24 Z-39 ;
G90 X23.5 Z-45 F50 ;
X23 ;
X22.5 ;
X22 ;
X21.5 ;
X21 ;
X20.5 ;
X20 ;
X19.5 ;
X19 ;
X18.5 ;
X18 ;
X17.5 ;
X17 ;
X16.5 ;
X16 ;
X15.5 ;
X15 ;
X14.5 ;
X14 ;
X13.5;
X13;
X12.5;
X12;
M05 ;
G28 U0 W0 ;
M30 ;

NOTE:

Understand usage of G94 and G90

Facing cycle - G94

This cycle does a single facing cut (perpendicular to the part axis).

Format
G94 X_ Z_ F_

X = X coordinate of end point of cut

Z = Z coordinate of end point of cut

F = Feed rate

Turning cycle G90

Format of G90

G90 X_ Z_ R_ F_

X = X coordinate of end point of cut, absolute

Z = Z coordinate of end point of cut, absolute

R = Taper amount, radial.

F = Feed rate

The cut starts at point P1, ends at point P2.

R = (Diameter at start of cut Diameter at end of cut) / 2

R must be specified with the proper sign.

The end point can be specified by incremental coordinates instead of absolute


coordinates. In this case: 1. Use addresses U and W instead of X and Z. 2. Use
appropriate signs with the end point, since incremental coordinates are specified with
reference to the start point.

Turning

PROCESS SHEET

Billet Size Material Program No. Metric/ Imperial


25 x 75 mm Aluminium 01 Metric

Operation Operation Spindle Feed Tool


No. Speed mm/min No. Type Radius
rpm
1 Facing 1000 50 3 Right

2 Taper 1000 50 3 Right


Turning

3 Turning 1000 50 3 Right

[Q2]

Question

Write the CNC Part Program to turn the component on CNC Turning Machine
(XLTURN) and write the process sheet for the same. The drawing of the finished
component is provided.

STEP TURNING
Answer:

Step Turning

CNC Part Program

[BILLET X 25 Z 70 ;
G21 G98 ;
G28 U0 W0 ;
M06 T03 ;
S1000 M03 ;
G00 X25 Z1 ;
G94 X0 Z-0.5 F50 ;
G90 X24.5 Z-45 ;
X24 ;
X23.5 ;
X23 ;
X22.5 ;
X22 ;
X21.5 ;
X21 ;
X20.5 Z-30;
X20 ;
X19.5 ;
X19 ;
X18.5 ;
X18;
X17.5 Z-15;
X17 ;
X16.5 ;
X16 ;
X15.5 ;
X15 ;
M05 ;
G28 U0 W0 ;
M30 ;
Turning

PROCESS SHEET

Billet Size Material Program No. Metric/ Imperial


25 x 75 mm Aluminium 01 Metric

Operation Operation Spindle Feed Tool


No. Speed mm/min No. Type Radius
rpm
1 Facing 1000 50 3 Right

2 Step Turning 1000 50 3 Right

Note:

Understand the usage of G90 (Turning cycle) and G94 (Facing)


[Q3]

Question

Write the CNC Part Program to turn the component on CNC Turning Machine
(XLTURN) and write the process sheet for the same. The drawing of the finished
component is provided.

MULTIPLE TURNING
Answer:

Multiple Turning

CNC Part Program

[BILLET X25 Z70

G21 G98;

G28 U0 W0;

M06 T03;

M03 S1000;

G00 X26 Z1 F50;

G71 U0.25 R1;

G71 P1 Q2 U0.5 W0.5;

N1 G01 X0;

G01 Z0;

G03 X10 Z-5 R5;

G01 Z-15;

G01 X20 Z-30;

G01 Z-40;

N2 G02 X25 Z-45 R5;

G70 P1 Q2 S1500;

M05;

G28 U0 W0;

M30;

Turning

PROCESS SHEET
Billet Size Material Program No. Metric/ Imperial
25 x 75 mm Aluminium 01 Metric

Operation Operation Spindle Feed Tool


No. Speed mm/min No. Type Radius
rpm
1 Facing 1000 50 3 Right
2 Turning 1000 50 3 Right
3 Taper Turning 1000 50 3 Right

Note:

Understand the usage of G71 and G70

Multiple Turning cycle G71

Format

G71 U(d)_ R_

G71 P(s)_ Q(e)_ U(u)_ W_ F_

Ns _ _ _ _ _ _

_____

_______

Ne_ _ _ _

U(d) = Depth of cut, radius value

R = Retract amount, radius value

P = Number of the first block of the shape

Q = Number of the last block of the shape

U(u) = Finishing allowance in X, diameter value

W = Finishing allowance in Z

F = Feed rate
The blocks after the second G71 block define the part contour A to B. Parameter P has
the number of the first block Ns and Q has the last block Ne

Example

G71 P1 Q2 U0.5 W0.5;

N1 G01 X0;

G01 Z0;

G03 X10 Z-5 R5;

G01 Z-15;

G01 X20 Z-30;

G01 Z-40;

N2 G02 X25 Z-45 R5;

The 1 and 2 used in P1 Q2 here correspond to N1 and N2.The code between the lines
N1 and N2 is the tool path which G71 will perform
[Q4]

Question

Write the CNC Part Program to mill the component on CNC Milling Machine (XL
Mill) and write the process sheet for the same. The drawing of the finished
component is provided.

CIRCULAR POCKET

Answer:

Circular Pocketing

CNC Part Program

G21 G94

G91 G28 Z0

G28 X0 Y0
M06 T01

S1000 M03

G90 G00 X0 Y0 Z5

G01 Z0

G170 R0 P0 Q1.5 X0 Y0 Z-3 I0 J0 K-25

G171 P75 S1000 R50 F60 B1500 J60

G00 Z10

G91 G28 Z0

G28 X0 Y0

M05

M30

Milling

PROCESS SHEET

Raw Material Size Material Program No. Metric/ Imperial


75 x 100 mm Aluminium 01 Metric

Operation Operation Spindle Feed Tool


No. Speed mm/min No. Type Radius
rpm
1 Circular 1000 50 1 End 2 mm
Pocketing Mill

NOTE:

Understand the usage of G170 and G171

G170 Circular Pocketing


R Surface if job or tool positioning

P Roughing cycle

Q Peck Improvement

X X axis

Y Y axis

Z Depth of Cut

I Side Finishing Allowance

J Bottom Finishing Allowance

K Radius of circle

G171 Circular Pocketing

P Cut width percentage

S Roughing Spindle Speed

R Roughing Feed in Z axis

F Roughing Feed in X, Y axis

B Finishing Spindle Speed

J Finishing Feed
[Q5]

Question

Write the CNC Part Program to mill the component on CNC Milling Machine (XL
Mill) and write the process sheet for the same. The drawing of the component is
provided showing the required tool path of the cutter.

CONTOUR MILLING

(understand that width of path on single cut = diameter of cutter)

Answer:

Contour (Milling)
CNC Part Program

G21 G94

G91 G28 Z0

G28 X0 Y0

M06 T1

S1000 M03

G00 X10 Y30 Z10

G01 Z-.5 F50

G01 Y80

G02 X20 Y90 R10

G01 X50

G01 Y80 X65

G01 Y20

G02 X55 Y10 R10

G01 X30

G03 X10 Y30 R20

G00 Z20

M05

G21 G28 Z0

G28 X0 Y0

M05

M30

Milling

PROCESS SHEET

Raw Material Program No. Metric/ Imperial


Material Size
75 x 100 mm Aluminium 01 Metric

Operation Operation Spindle Feed Tool


No. Speed mm/min No. Type Radius
rpm
1 Contour 1000 50 1 End Mill 2 mm
Milling
[Q6]

Question

Write the CNC Part Program to mill the component on CNC Milling Machine (XL
Mill) and write the process sheet for the same. The drawing of the finished
component is provided.

RECTANGULAR POCKET
Answer:

Rectangular Pocket

CNC Part Program

G21 G94

G91 G28 Z0

G28 X0 Y0

M06 T01

M03 S1500

G90

G00 X0 Y0 Z5

G172 I-50 J-40 K0 P0 Q1 R0 X-25 Y-20 Z-3

G173 I0 K0 P75 T1 S1000 R30 F75 B1500 J75 Z20

G00 Z10

G91 G28 Z0

G28 X0 Y0

MK05

M30

Note

Understand the Syntax/ Usage of G172 and G173

G172 I-50 J-40 K0 P0 Q1 R0 X-25 Y-20 Z-3

Input data for G172


I = Pocket X length

J = Pocket Y length

K = radius of corner roundness

P = roughing cycle

Q = pocket Z increment (peck increment in above cycle 2to 3 mm)

R = absolute Z R point

X = Pocket corner X

Y = Pocket corner Y

Absolute position relative to the X and Y Datum Position

Z = Absolute Z base of pocket (-6; depth of 6mm)

G173I0 K0 P75 T1 S1000 R30 F75 B1500 J75 Z20

Input data for G173

I = Pocket side finish (0 for roughing cycle)

K = Pocket base finish

P = Cut width percentage (75% of total dia)

T = Pocket Tool (Tool 1)

S = Spindle Speed for Roughing (3000 rpm)

R = Roughing Feed for Z (75)

F = Roughing feed for X and Y (250)

B = Finishing Spindle Feed (3500 rpm)

J = Finishing Feed (200)

Z = Safety Z (5mm, above R point)


Milling

PROCESS SHEET

Raw Material Program No. Metric/ Imperial


Material Size
75 x 100 mm Aluminium 05 Metric

Operation Operation Spindle Feed Tool


No. Speed mm/min No. Type Radius
rpm
1 Rectangular 1000 50 1 End Mill 2.5
Pocketing

You might also like