0% found this document useful (0 votes)
33 views

CNC Machines 02

CNC
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

CNC Machines 02

CNC
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

1

Basic Concept of CNC Part Programming


Dr. Mokhtar Ali Amrani
CAD/CAM

LECTURE 11
Objectives:
 To understand the working principle and applications of CNC machines.
 To be able to prepare CNC part programs for machining 2-D workpiece.
 To understand the structure and flow of a CAM system.

Part programming contains geometric data about the part and motion information to move the cutting tool with
respect to the work piece. Basically, the machine receives instructions as a sequence of blocks containing
commands to set machine parameters; speed, feed and other relevant information.

A CNC program consists of blocks, words and addresses.


a. Block
A command given to the control unit is called a block. A block is equivalent to a line of codes in a part
program.

b. Word
A block is composed of one or more words. A word is composed of an identification letter and a series of
numerals, e.g. the command for a feed rate of 200 mm/min is F200.
c. Address
The identification letter at the beginning of each word is called address. The meaning of the address is in
accordance with EIA (Electronic Industries Association) standard RS-274-D. The most common 'addresses'
are listed below:
2

Programming Methods
1) Automatically Programmed Tools (APT)

 A text based system in which a programmer defines a series of lines, arcs, and points which define the
overall part geometry locations. These features are then used to generate a cutter location (CL) file.

2) CAD/CAM systems

 CAD/CAM systems allow for rapid development and modifying of designs and documentation.
 The 3D geometric model produced becomes a common element for engineering analysis (FEA),
machining process planning (including CNC part programming, documentation (including engineering
drawings), quality control, and so on.

Drives of CNC machine tool


 Hydraulic actuator: high power machine tool
 Stepping motor: small machine due to limited power and torque
 DC motor: excellent speed regulation, high torque, most widely used
3
4

1. Sequence Number (N Address)


A sequence number is used to identify the block. It is always placed at the beginning of the block and can be
regarded as the name of the block. The sequence numbers need not be consecutive. The execution sequence of
the program is according to the actual sequence of the block and not the sequence of the number. In fact some
CNC systems do not require sequence numbers.

2. Preparatory Function (G Address)


A preparatory function determines how the tool is to move to the programmed target. The most common G
addresses are listed below:
5
6

3. Co-ordinate Word (X/Y/Z Address)


A co-ordinate word specifies the target point of the tool movement (absolute dimension system) or the distance
to be moved (incremental dimension). The word is composed of the address of the axis to be moved and the
value and direction of the movement.
Example: X100 Y-200 represents the movement to (100, 200). Whether the dimensions are absolute or
incremental will have to be defined previously (using G90 or G91).

4. Parameter for Circular Interpolation (I/J/K Address)


These parameters specify the distance measured from the start point of the arc to the center. Numerals following
I, J and K are the X, Y and Z components of the distance respectively.

5. Spindle Function (S Address)


The spindle speed is commanded under an S address and is always in revolution per minute. It can be calculated
by the following formula:

The following table gives the surface cutting speeds for some common materials:
7

Example: S2000 represents a spindle speed of 2000 rpm.

6. Feed Function (F Address)


The feed is programmed under an F address except for rapid traverse. The unit may be in mm per minute (in the
case of milling machine) or in mm per revolution (in the case of turning machine). The unit of the feedrate has
to be defined at the beginning of the program. The feed rate can be calculated by the following formula:
Feed Rate = Chip Load / tooth × No of Tooth × Spindle Speed
The following table gives the chip load per tooth of milling cutters cutting some common materials:

Example: F200 represents a feed rate of 200 mm/min

7. Tool Function (T Address)


The selection of tool is commanded under a T address.
Example: T02 represents tool number 2.

8. Miscellaneous Function (M Address)


The miscellaneous function is programmed to control the machine operation other than for co ordinate
movement. The most common M functions are as follows:
8

1) Modal (retained) G codes.


A modal G code, once programmed into a block, will affect any subsequent blocks of the program
without having to be restated. Additionally, modal G codes are further split into groups according to their task
and function. A modal G code will remain active until another G code from the same group is programmed into
a block, or it is cancelled.
2) Non-modal (one-shot) G codes.
A non-modal G code must be programmed into every block when it is required, ie, it is only effective in the
block in which it is specified.
NOTE 1.
Remember there are two types of G code.
A modal G code is retained in memory - it is effective until another G code from the same modal group is
commanded.
A non-modal G code is one-shot - it is effective only within the block in which it is specified.
NOTE 2.
It is not necessary to enter a modal G code in repetitive blocks within a program.
For example : If all movements are GØ1 (linear cutting command)
then GØ1 is entered on the first block and omitted from all subsequent blocks. This G code will remain active
until an interpolation change is commanded (using GØØ, GØ2 or GØ3).
NOTE 3.
9

The machine controller has the ability to interpret a maximum of four G codes in one single block of data.
However, these G codes must be from separate modal groups. When two or more G codes from the same group
are specified in the same block, the CNC will only make the last stated G code from that modal group effective.
Steps for CNC Programming and Machining
The following is the procedures to be followed in CNC programming and machining. The most important point
is to verify the program by test run it on the machine before the actual machining in order to ensure that the
program is free of mistakes.
a. Study the part drawing carefully.
b. Unless the drawing dimensions are CNC adapted, select a suitable program zero point on the
work piece. The tool will be adjusted to this zero point during the machine set up.
c. Determine the machining operations and their sequence.
d. Determine the method of work clamping (vice, rotary table, fixtures etc).
e. Select cutting tools and determine spindle speeds and feeds.
f. Write program (translate machining steps into program blocks). If many solutions are possible,
try the simplest solution first. It is usually longer, but better to proceed in this way.
g. Prepare tool chart or diagram, measure tool geometry (lengths, radii) and note.
h. Clamp work piece and set up machine.
i. Enter compensation value if necessary.
j. Check and test program. It is a good practice to dry run the program (i) without the workpiece,
(ii) without the cutting tools, or (iii) by raising the tool to a safe height. If necessary, correct and
edit program and check again.
k. Start machining.
G-codes in Part Programming
1. Absolute and Incremental Dimensioning (G90/G91)
G90 and G91 are used to control the dimensioning system that will be used in the data input. In G90 mode, the
dimensions will be recognized as absolute while in G91 will be incremental.
2. Rapid Positioning (G00)
This is to command the cutter to move from the existing point to the target point at the fastest speed of the
machine.
3. Linear Interpolation (G01)
This is to command the cutter to move from the existing point to the target point along a straight line at the
speed designated by the F address.

4. Circular Interpolation (G02/G03)


This is to command the cutter to move from the existing point to the target point along a circular arc in
clockwise direction (G02) or counterclockwise direction (G03).
In this case, beside the target point, the radius or the center of the arc is also required. Most of the CNC systems
nowadays still require the data of the arc center rather than the radius.
The parameters of the center of the circular arc is designated by the I, J and K addresses. I is the distance along
the X axis, J along the Y, and K along the Z. This parameter is defined as the vector (magnitude and direction)
from the starting point to the center of the arc.
10

Program Format (Clockwise Direction)

G02
X
Y
I (XC - XS)
J (YC - YS)
Where
 XC and YC is the coordinate of the center,
 XS and YS is the coordinate of the start point of
the arc.

Program Format (Counterclockwise Direction)


G03
X
Y
I
J
11

5. Cutter Compensation (G40/G41/G42)


In CNC machining, if the cutter axis is moving along the programmed path, the dimension of the workpiece
obtained will be incorrect since the diameter of the cutter has not be taken into account.

Modern CNC systems are capable of doing this type of calculation which is known as cutter compensation.
What the system requires are the programmed path, the cutter diameter and the position of the cutter with
reference to the contour. Normally, the cutter diameter is not included in the program. It has to be input to the
CNC system in the tool setting process.

If the cutter is on the left of the contour, G41 is used. If the cutter is on the right of the contour, G42 will be
used. G40 is to cancel the compensation calculation.

6. Other Functions
Modern CNC systems have some specially designed functions to simplify the manual programming. However,
since most of these functions are system oriented, it is not intended to discuss them here in detail. The following
paragraphs give a brief description of commonly used functions in modern CNC systems. The user should refer
to the programming manuals of the machine for the detail programming and operation.
a. Mirror Image
This is the function that converts the programmed path to its mirror image, which is identical in dimensions but
geometrically opposite about one or two axes.
b. Program Repetition and Looping
In actual machining, it is not always possible to machine to the final dimension in one go. This function enables
the looping of a portion of the program so that the portion can be executed repeatedly.
c. Pocketing Cycle
Pocketing is a common process in machining. This is to excavate the material within a boundary normally in
zigzag path and layer by layer. In a pocketing cycle, the pattern of cutting is pre-determined. The user is
required to input parameters including the length, width and depth of the pocket, tool path spacing, and layer
depth. The CNC system will then automatically work out the tool path.
d. Drilling, Boring, Reaming and Tapping Cycle
12

This is similar to pocketing cycle. In this function, the drilling pattern is pre-determined by the CNC system.
What the user has to do is to input the required parameters such as the total depth of the hole, the down feed
depth, the relief height and the dwell time at the bottom of the hole.

Example 02 of Absolute axis coordinate.

O0002  program number.


(Centre Drill) Tool name. this is
a message.

N005 G54 G90 S600 M03


N005 sequence number indicates the
line number.
G54 fixture offset is invoked from
the origin. It is a word tells the
machine where to look to find the
program zero assignment values.
G90 : Absolute mode is selected for
dimensions.
S600 M03: spindle is started at 600
rpm forward.

N010 G00 X0.5 Y0.5


N010: sequence line No.
G00  Rapid move to position for first hole from shortest path. Note that the program is specified from
program zero.
X0.5 Y0.5  means move 0.5 inches on x-axis and also 0.5 inches on Y-axis.

N015 G43 H01 Z0.1


This function means rapid move to clearance position in Z axis.
G43 states the position to prevent the crush. It is an important function before starting doing the holes to make
the tool near the hole. This function is written once in the program.
Again; note that the coordinate is specified from program zero.

N020 G81 R0.1 Z-0.2 F5.0


This function is direct order to the machine to do the hole.
G81  draw hole of Radius R0.1 0.1 inches depth Z-0.2 0.2 inches to down. And the Feed is 5 inches per
minutes.
While we haven’t yet explained canned cycle, note that the coordinate is specified from program zero.

N025 Y3.0
This is an order to move 3.0 inches on Y-axis for the origin. Note that no need to repeat the value of X-axis
since the hole on the same axis. Also, no need to write the G81 function again.
13

N030 X2.25 Y3.0


It means move 2.25 inches on x-axis and 1.75 inches on y-axis starting from the origin.

N035 X4.0 Y3.0


It means move 4.0 inches on x-axis and 3.0 inches on y-axis starting from the origin.

N040 Y0.5
Here no need to write the move on X-axis since the tool on the same axis.

N045 G80
It means cancel the order of G81 to draw holes.

N050 ……………

Program Example 03:


14
15

Incremental Mode of Coordinate system


In this system; G91 is the function describing this mode.
In the next figure, the configuration of the functions of both modes is identified. G90 absolute mode, G91
incremental mode.

In incremental mode: if you make an


error in the first function, all
remaining function will give also
errors. However, in absolute mode, any
mistake will affect only the process of
the function where the mistake is taken
place.
16

Example 05

N01 G71 G90 G94


N02 G00 X-20 HOW TO READ THE PROGRAM
N03 G00 Z-10 N01 means sequence at the start of each block,
N04 G01 G42 D02 X0.0 Y0.0 S1000 F200 M03 G71 means metric dimension is used,
N05 G01 X70 G90 means absolute programming is used,
N06 G03 X85 Y15 I0.0 J15 G94 means feed in mm/minute,
N07 G01 Y35 G00 means rapid traverse,
N08 G03 X70 Y90 I-15 J0.0 G01 means linear interpolation,
N09 G01 X60 G42 means cutter diameter compensation right,
N10 G01 X50 Y65 D02 means the cutter is at centerline with Dia. 02
N11 G01 X45 Y50 mm,
N12 G01 X35
S1000 means the spindle rotates at 1000 rpm,
N13 G01 X30 Y35
F200 means the feed of the tool is 200 mm/min,
N14 G01 X15 Y65
M03 means the tool is spindle,
N15 G01 X0.0 Y65
G03 means curve cutting CCW,
N16 G01 Y35
N17 G01 X15 Y25 I0 J15 means the center is 0 distance from the start
N18 G01 X0.0 Y15 point on x-axis and 15 from y-axis,
N19 G01 X0.0 Y0.0 G40 means cancel G42,
N20 G40
M30 means stop the program.
N21 G00 X-20 Z20
N22 M30
17

Example 06: CNC milling circular interpolation program example to illustrate the use of G02 G03 Circular
Interpolation G-Codes.
18

Example 07: CNC milling programming for cnc programmers/cnc machinists to understand the usage of G-code
G02 circular interpolation milling programming

Example 08: Circular Interpolation Programming


Although this example drawing looks a bit complex, but it is very easy to program. Before going through this exercise you must
first read circular interpolation articles.
19
20

Example 09:The cnc G code G02 Circular Interpolation Clockwise is used in this programming example. Actually
the arc is clockwise, therefore I am using G02 the cnc G code for programming the Clockwise arc.

Example 09: NUM CNC Mill Program Example with G45 Pocket Milling G81 G84 G87
21

You might also like