CNC Notes
CNC Notes
CNC Notes
PART PROGRAMMING
Part program is a set of instructions which instruct the machine tool about the processing
steps to be performed for the manufacture of a part. The shape and size of the finished
component is totally dependent on how well the program has been prepared. CNC code
consists of blocks, each of which contains an individual command for a movement or
specific action. Just as with conventional machines, one movement is made before the
next one. That’s why CNC codes are listed sequentially in numbered blocks.
Machining involves an important aspect of relative movement between cutting tool and
work piece. In machine tools this is accomplished by either moving the tool with respect
to work piece or vice versa. In order to define relative motion of two objects, reference
directions are required to be defined. A program defining motion of tool / work piece in
this coordinate system is known as a part program. The part program is a sequence of
instructions, which describe the work, which has to be done on a part, in the form required
by a computer. NC part programming comprises the collection of all data required to
produce the part, the calculation of a tool path along which the machine operations will be
performed and the arrangement of those given and calculated data in a standard format
that can be read and processed by the MCU.
While making the part program for a component, the programmer first studies the drawing and
decide upon the sequence of operations, the cutting tools, the path of cutter/tool, speeds and
feeds at various points, other necessary information like starting and stopping of machine etc.
The information is entered in a program sheet in a particular format acceptable by the machine
tool-control unit combination.
1
Page
3
Page
4
Page
Each tool pocket in a turret or automatic tool changer has a distinct tool number. The T
word followed by two or three digits specifies which tool must be used for the operation.
9
Page
G98 (default) will cause Z-axis to return to the initial starting point,
G99 will return Z-axis to the R (reference) plane after a cycle has been executed
and positions to a new location to execute another cycle.
11
Page
main program. If an M99 code is programmed at the end of a main program, a continuous
loop will be established. If an M99 code is followed by a block number, P_ _ _ _ , control
Page
will return to the program line with the same number as stated in P_ _ _ _.
G54~G59 – Work piece coordinate system settings #1 t0 #6; Mill and Lathe
Page
15
Page
APT processor is a very large programme which runs on mainframe computer and gives the
output called Cutter location Data (CLDATA).
The APT system consists of three parts namely
1. APT part programme –written in APT language (English statement)
2. APT programme processor- converts into cutter location file (CLDATA)
3. APT post processor-produces NC tape from cutter location data
You first write a program in APT, software converts it into a series of tool coordinates called
Cutter Location Data (CLD). Another piece of software, a translator called a Postprocessor, then
17
converts the CLD into an NC program (the G and M code program) that is understood by the
machine. You feed the NC program into the machine and cut the part.
Page
C2 = CIRCLE/P4, P5, P6
The three points must not be collinear.
There are several ways in which the check surface can be used. Four APT modifier words in the
descriptive data of the motion statement words are TO, ON, PAST, and TANTO is used. As
depicted in Figure, the word TO positions the leading edge of the tool in contact with the check
surface; ON positions the center of the tool on the check surface; and PAST puts the tool beyond
the check surface, so that its trailing edge is in contact with the check surface. The fourth
modifier word TANTO is used when the drive surface is tangent to a circular check surface, as
in Figure, TANTO moves the cutting tool to the point of tangency with the circular surface.
After the tool reaches the check surface in the preceding move, does the next move involve a
right turn or left turn or what? The answer to this question is determined by one of the following
six motion words, whose interpretation are illustrated in figure below
GOLFT commands the tool to make a left turn relative to the last move
21
GORGT commands the tool to make a right turn relative to the last move
Page
GOFWD commands the tool to move forward relative to the last move
GOBACK commands the tool to move in reverse direction relative to last move
Note that GO/TO is not the same as the GOTO command. GOTO is used only for PTP motions.
The GO/ command is used to initialize a sequence of contouring motions and may take
alternative forms such as GO/ON, GO/TO, or GO/PAST.
In engineering drawing, the sides of the part appear as lines, although they are three-dimensional
surfaces on the physical part. In cases like this, it is more convenient for the programmer to
define the part profile in terms of lines and circles rather than planes and cylinders. APT
language system allows this because in APT, lines are treated as planes and circles are treated as
cylinders, which are both perpendicular to the x-y plane. Hence, the planes around the part
outline can be replaced by lines (L1, L3, and L4). The commands can be replaced by the
following;
FROM/PTARG
GO/TO, L1, TO, PL2, TO, L3
GORGT/L3, PAST, L4
Plane PL2 has not been converted to a line. As the “part surface” in the motion statement, it
22
must maintain its status as a plane parallel to the x- and y-axes. It is not necessary to redefine the
Page
part surface in every motion command after it has been initially defined as long as it remains the same
in subsequent commands;
Auxiliary statements
Auxiliary statements are used to identify the part program, specify which postprocessor to use,
insert remarks into the program, and so on. Auxiliary statements have no effect on the
generation of tool path.
PARTNO is the first statement in an APT program, used to identify the program;
REMARK is used to insert explanatory comments into the program that are not interpreted
or processed by the APT processor.
FINI indicates the end of an APT program.
Disadvantages
1. Machine cost
2. Programming training
3. Higher maintenance cost
4. Higher skilled workers
25
Page
In numerical control (NC), an interpolator is used to co-ordinate the simultaneous movements of the
respective axes of a machine tool such that the relative motion between the tool and work piece
follows a specified path at a given constant tangential velocity.
Controlling the travel rate in two or more directions, which is proportionate to the distance
26
DDA
Digital Differential Analyser (DDA) is the simple line generation algorithm. The DDA
generates lines and curves from their differential equations. The DDA is a very popular
interpolator for NC systems. The DDA is basically a digital integrator.
DDA integrator principle
If the area under a graph is divided into very narrow strips, each strip is approximately rectangular
in shape. To perform digital integration of a continuous function, the area below the curve is
approximated by a sum of small rectangular areas.
𝑡 𝑘
In the diagram, a "typical rectangle" is shown with width Δt and height V. Its area is VΔt. If
we add all these typical rectangles, starting from t0 and finishing at t, the area is
approximately
Area under the Velocity –time curve gives the distance travelled (S).
𝑡 𝑘
𝑆𝑘 = ∑ 𝑉𝑖 ∆𝑡 + 𝑉𝑘 ∆𝑡
𝑖=0
Where
𝑆𝑘 = 𝑆𝑘−1 + ∆𝑆𝑘 -- total displacement by summing the displacement at the previous
time unit and the distance increment at the current time unit using equation
∆𝑆𝑘 = 𝑉𝑘 . ∆𝑡 − − − −distance increment at the current time
28
Page
2 axis movement
The interpolator has to provide pulses to each axis at definite rates (a and b pulses per second,
along X and y axes respectively) with respect to time.
The micro-increments of the moving point along X axis and Y axis in Δt are
∆𝑥 = 𝑉𝑥 ∆𝑡
∆𝑦 = 𝑉𝑦 ∆𝑡
The principle of DDA is that X and Y co-ordinates are simultaneously incremented in small
steps proportional to the first derivatives of x and y. The first derivative is the rate of change
of y with x, that is, dy/dx, which is interpreted as the slope and for straight line, it is a
constant. For generating a line, X and Y is incremented by Δx and Δy.
One pulse increments the integrand register contents representing one y increment unit (Δy).
One command pulse to the adder represents one x increment (Δx) and causes the addition of
the current integrand, y, to the remainder. Continual, addition to the remainder causes it to
overflow its register, periodically, at a rate determined by the rate of Δx inputs and by the
magnitude of the integrand y. Over a specific time period, the sum of the overflows
approaches the rectangular approximation, Simpson's rule, of the integrals of y and x with
respect to time.
29
Page
The velocity components Vx and Vy are computed by the circular interpolator and are
supplied as reference inputs to the computer closed loops. Tool path is traced by controlling
and coordinating the axis motors.
𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒
pulse count= 𝐵𝐿𝑈
If the BLU=0.001, for moving the table 5 mm with a feed of 6mm per minute
5
Pulse count=0.001 = 5000 𝑝𝑢𝑙𝑠𝑒𝑠
The accumulated number of pulses represents position,
The pulse frequency is proportional to the axis velocity
30
6/60
𝑝𝑢𝑙𝑠𝑒 𝑟𝑎𝑡𝑒 = = 100 𝑝𝑢𝑙𝑠𝑒/𝑠𝑒𝑠
Page
0.001
% (Start tag)
:1002; (Program Number)
N10 G90G95G21; (G90-absolute programming, G95 - feed per rev,
G21-metric mode)
N20M06T01; (M06 - tool change, T01 - tool number one)
N30M03S800; (M30 - Spindle ON, clockwise rotation, S800 -spindle
speed is set to 800 rpm)
N40M08; (M08 - Coolant ON)
N50 G00X12.5Z2; (G00 - Rapid motion)
N60 G01 Z0F0.1; Linear interpolation, feed is .01mm/rev
N70 G01 X0F0.1; (Facing operation is performed)
N80 G00Z2; (Tool moves 2 mm away in Z direction)
N90 G00 X7.5;
N100 G01Z-25 F0.1; (Turning operation is performed)
N110 G01 X12.5;
N120 G01 Z-25
N130M05; (Spindle OFF)
N140M09; (Coolant off)
31
Example 3
N20 G01 Z-100; (turning 25 mm dia)
N60 G00 X-4Z01; (Position of cut)
N65 G01 Z-60; (Cutting length)
N70 G01 X-12.5; (cut)
N85 G00 X5 Z5; (Final position of tool)
Example 5
N05 G94 M06 T0101
N10 G00 X0 Z0 M04 S360
N15 G01 X30 F30
N20 G03 X50 Z-10 R10
N25 G01 Z-40
N30 G02 X70 Z-50 R10
N35 G01 Z-100
N40 G00 X100
N45 G00 Z10
N50 M05
N55 M30
Example 6
N55 M05
N60 M30
Page
Example 8
% (Start tag)
:1004; (Program number)
N10 G90G95G21; (G90 absolute programming, G95 feed /rev, G21 metric
mode)
N20M06T01; (Tool change to tool no1)
N30M03S600; (Spindle ON with 600RPM)
N40M08; (Coolant ON)
N1 T1 M06
N2 G90 G00 X.3 Y1.2
N3 S1200 M03
N4 Z1. M08
N5 G81 Z-.6 F10
N6 X1.2 Y.3
N7 G80 G00 Z1. M09
N8 G28 G91 Z0. M05
N9 M30
36
Page
Here all the dimensions are specified with respect to the origin point.
% (Start tag)
:1004; (Program number)
N10M06T01; (Tool is changed to T01)
N20 G90G95G21; (G90 absolute programming, G95 feed/rev, G21metric)
N30 G00 X50Y100Z50; (Tool is positioned above point 1 in rapid mode)
N40Z10; (Tool is brought to 10 mm above the work , still in position1)
N50M03S500; (Spindle ON in clockwise direction speed 500RPM)
N60M08; (Coolant ON)
N70 G99 G81 Z-20R2.5F50; (G81-Canned drilling cycle code, Z-20 drilling depth,
R2.5 this is the point 2.5mm above the Hole no:1.
This is the point where the tool will come after performing
the drilling operation. G99 denotes that the drilling tool
will return back to the r-level after drilling the hole)
(As the drilling cycle is in progress only give the
of the other six holes to be drilled. Depth, feed and R
have already been mentioned in the previous block N70)
N80X100; (Drilling of hole number 2performed)
N90X150; (Drilling of hole number 3performed)
N100Y50; (Drilling of hole number 4performed)
N110X100; (Drilling of hole number 5performed)
N120X50; (Drilling of hole number 6performed)
N130G80M05; (G80-Stop canned cycle, M05 Spindle OFF)
N140M09; (Coolant OFF)
N150M30; (End of program and tape rewind)
38
Page
Example:14
The tool path of the figure shown on left side, can be programmed as follows (In absolute
mode, G90):
Example 16
%1000
T1 M6
G00 G90 G40 G94 G80
G54 X-75 Y-25 S500 M3 (Start Point)
G43 Z05
G1 Z-20 F100
G1X-50 Y0 M8 (Position 1)
G1X0 Y50 (Position 2)
G1X50 Y0 (Position 3)
G1X0 Y-50 (Position 4)
G1X-50 Y0 (Position 5)
40
G0 Z05
M30
2.000
2.000
(6,6)
Example 18
Example 20
G90 G03 X140 Y100 I-60 F300
G02 X120 Y60 I-50
******************************************
44
Page
STARTPT
PARTNOSAMPLEMILLING Labels the program as milling operation
MACNIN/MILL,01 Milling machine no:1 is selected
UNITS/MM Units is set to millimeters
REMARK Geometry Definition
STARTPT=POINT/-1, -1, 0
P1=POINT/6, 1.125,0
P2=POINT/0, 0, 0
P3=POINT/6, 0, 0
P4=POINT/1.75,4.5,0
L1=LINE/P2, P3 Geometry: - points, lines and circles
defined C1=CIRCLE/CENTER, P1, RADIUS, 1.25
L2=LINE/P4, LEFT, TANTO, C1
L3=LINE/P2, P4
PL1=PLANE/P2, P3, P4 Plane define to denote part surface (cut
depth) REMARK Motion Statements
SPINDL/600, CLW Spindle turned on to 600rpm clockwise
direction
FEDRAT/6 feed rate set to 6 inches per minute
COOLNT/ON coolant is turned on
FROM/STARTPT Tool is called from its starting location
GO/TO, L1, TO, PL1, TO, L3 Initializing contouring motion
GORGT/L1, TANTO, C1 Tool moves along L1 till tangent to C1
GOFWD/C1, PAST, L2 Tool moves along C1 till goes past L2
GOFWD/L2, PAST, L3 Tool moves along L2 till it crosses L3
GOLFT/L3, PAST, L1 Tool moves along L3 till it crosses L1
RAPID Tool is set to rapid mode
GOTO/STARTPT Tool is taken back to starting location
COOLNT/OFF Coolant is turned off
48
50
Page
51
Page
3. The outline of the part in the figure is to be profile milled using a 20 mm dia end mill
with two teeth. Cutting speed is 125 m/min and feed is 0.1 mm/tooth. The part is 10
mm thick. Use the lower left corner of the part as the origin in the X-Y axis system.
The two holes in the part have already been drilled and will be used for clamping the
part during milling.
4. Write the manual part program in the word address format. Use absolute
positioning.
5. Write an APT program for profile milling of a part shown in Question 4. (20 marks)
6. Three holes of diameter10mm.each are to be drilled on a mild steel plate of length
200 mm., breadth 120mm. Use the lower left corner of the part as the origin in the
XY system. The co-ordinate positions of the holes with respect to the origin are
(40,25),(100,60) and (160,25) respectively. The cutting speed is 50 m./min. and feed
0.06 mm./rev. Write a manual part program to drill the holes in the word address
52
7. Write an APT part program to perform drilling of three holes on a mild steel plate.
Use the part geometry and machining data given in question 11. (20marks)
*********************************************
53
Page