0% found this document useful (0 votes)
175 views48 pages

5 PP

A CNC part program is a set of instructions that controls the machining of a workpiece using a CNC machine tool. It defines the motion of the tool or workpiece in the coordinate system. Developing a part program involves studying the part design, selecting tools and operations, and then using G-codes and M-codes to program things like tool paths, spindle speeds, coolant, and more. The program is then simulated, run through a dry run, and used to machine the first part for inspection.

Uploaded by

Patel Nikhil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
175 views48 pages

5 PP

A CNC part program is a set of instructions that controls the machining of a workpiece using a CNC machine tool. It defines the motion of the tool or workpiece in the coordinate system. Developing a part program involves studying the part design, selecting tools and operations, and then using G-codes and M-codes to program things like tool paths, spindle speeds, coolant, and more. The program is then simulated, run through a dry run, and used to machine the first part for inspection.

Uploaded by

Patel Nikhil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 48

PART PROGRAMMING

CNC part program is a detailed list of


instructions that need to be executed by
MCU to achieve the final component shape.

Set of instructions to carry out the machining


of the workpiece.

A program defining motion of tool/workpiece


in the coordinate system is known as a part
program.

Development of part program


Steps:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Study part print


Identify machine tool
Identify operations & tooling
Find feeds, speeds, d.o.c etc
Prepare Setup Sheet with tooling/fixture
Develop part program
Simulate
Dry run
Cut 1st part
Inspect
2

Types of part programming

MDI ~ Manual Data Input.


CAPP ~ 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.

Computer Aided Machining Systems


(CAM Software)

Reference Points/Axes selection

Part programming requires establishment of


some reference points either set by
manufacturer or user.

1.

Machine Origin/Zero (Fixed Datum)

Fixed point set by the machine tool builder.


It cannot be changed.
Any tool movement is measured from this point.
Controller always remembers machine origin.
4

Reference Points
2.

Program Origin/Zero (Home Position of tool)

3.

Point from where the tool starts for its motion while executing a
program and returns back at the end of the cycle.
This can be any point within the workspace of the tool which is
sufficiently away from the part.
In case of CNC lathe it is a point where tool change is carried
out.

Part Origin/Zero

It can be set at any point inside the machine's electronic grid


system.
Establishing the part origin is also known as zero shift, work
shift, floating zero or datum.
Usually part origin needs to be defined for each new setup.
Zero shifting allows the relocation of the part.5

Reference Points on Lathe & Milling

Structure of an NC Part Program


Commands are input into the controller in
units called blocks or statements.
Block Format/CNC Code Syntax:
1. Fixed sequential format
2. Tab sequential format
3. Word address format

1. Fixed sequential format


0060 01 +0025400 +0012500 -0010000 0500 08
0070 00 +0025400 +0012500 +0000000 0000 09

Information in particular format/sequence which


cannot be changed.
Difficult to work, Error prone, Lengthy

2. Tab sequential format


0060 TAB 01 TAB TAB TAB -0010000 TAB 0500 TAB 08
0070 TAB 00 TAB TAB TAB -0000000 TAB 0000 TAB 09

Information are separated by code TAB


TAB TAB ~ previous values are repeated
8

3. Word address format (most common)


N60 G01 Z-10000 F500 M08;
N70 G00 Z0 M09;

Each element of information is prefixed


by alphabetical character
Sequence is not necessary
Repetition is not necessary
Less error
Less time

; = EOB (End of Block)


* = EOB

INFORMATION NEEDED by a CNC


1. Preparatory Information: units, incremental or absolute
positioning
2. Coordinates: X,Y,Z, RX,RY,RZ
3. Machining Parameters: Feed rate and spindle speed
4. Coolant Control: On/Off, Flood, Mist
5. Tool Control: Tool and tool parameters
6. Cycle Functions: Type of action required
7. Miscellaneous Control: Spindle on/off, direction of
rotation, stops for part movement
This information is conveyed to the machine through a set
of instructions arranged in a desired sequence Program.

BLOCK FORMAT
Sample Block
N135 G01 X1.0 Y1.0 Z0.125 F5;

Restrictions on CNC blocks


Each may contain only one tool move
Each may contain any number of non-tool move G-codes
Each may contain only one feedrate
Each may contain only one specified tool or spindle speed
The block numbers should be sequential
Both the program start flag and the program number must be
independent of all other commands (on separate lines)
The data within a block should follow the sequence shown in
the above sample block

G & M Codes
Example CNC Program

N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30

G-codes: Preparatory Functions


involve actual tool moves.
M-codes: Miscellaneous Functions
involve actions necessary for
machining (i.e.spindle on/off, coolant
on/off).

G Codes

G00 Rapid traverse


G01 Linear interpolation
G02 Circular interpolation, CW
G03 Circular interpolation, CCW
G04 Dwell
G08 Acceleration
G09 Deceleration
G17 X-Y Plane
G18 Z-X Plane
G19 Y-Z Plane
G20 Inch Units (G70)
G21 Metric Units (G71)

G40 Cutter compensation cancel


G41 Cutter compensation left
G42 Cutter compensation- right
G70 Inch format
G71 Metric format
G74 Full-circle programming off
G75 Full-circle programming on
G80 Fixed-cycle cancel
G81-G89 Fixed cycles
G90 Absolute dimensions
G91 Incremental dimensions

Modal G-Codes
Most G-codes set the machine in a mode
which stays in effect until it is changed or
cancelled by another G-code. These
commands are called modal.
Eg: G01 cancelled by G02

Non Modal codes:


Turned of automatically
Eg: G04 05 (dwell time)

Modal G-Code List

G00 Rapid Transverse


G01 Linear Interpolation
G02 Circular Interpolation, CW
G03 Circular Interpolation, CCW
G17 XY Plane
G18 XZ Plane
G19 YZ Plane
G20/G70
Inch units
G21/G71
Metric Units
G40 Cutter compensation
cancel
G41 Cutter compensation left
G42 Cutter compensation right
G43 Tool length compensation
(plus)

G43 Tool length compensation


(plus)
G44 Tool length compensation
(minus)
G49 Tool length compensation
cancel
G80 Cancel canned cycles
G81 Drilling cycle
G82 Counter boring cycle
G83 Deep hole drilling cycle
G90 Absolute positioning
G91 Incremental positioning

M Codes

M00
M01
M02
M03
M04
M05
M06
M08
M09
M10
M11
M30

Program stop (pause spindle & coolant)


Optional program stop
Program end (clear all the control registers)
Spindle on clockwise
Spindle on counterclockwise
Spindle stop
Tool change
Coolant on
Coolant off
Clamps on
Clamps off
Program stop, reset to start

All M codes are Modal codes

N Codes

Gives an identifying number for each block of


information.

It is generally good practice to increment each


block number by 5 or 10 to allow additional
blocks to be inserted if future changes are
required.

X,Y, and Z Codes


X, Y, and Z codes are used to specify the
coordinate axis.
Number following the code defines the
coordinate at the end of the move relative to an
incremental or absolute reference point.

I,J, and K Codes

I, J, and K codes are used to specify the


coordinate axis when defining the center of a
circle.

Number following the code defines the


respective coordinate for the center of the
circle.

F,S, and T Codes

F-code: used to specify the feed rate

S-code: used to specify the spindle speed

T-code: used to specify the tool identification


number associated with the tool to be used in
subsequent operations.

Programming Modes

Absolute programming (G90)

Can be cancelled by G91 or M02/M30


1st Quadrants (+ values)
Few chances of error

Relative programming (G91)

Useful for fixed pattern job (eg. Equidistance holes)


Direction care (+ ve & - ve)
Error may accumulate

Unit Selection
Metric unit selection : G21 or G71
Inch unit selection : G20 or G70

Active Plane Selection


XY - Plane selection : G17
XZ - Plane selection : G18
YZ - Plane selection : G19

Active Plane Selection


G17 - XY
G18 - XZ
G19 - YZ

Preset (zero shift/ floating datum)


G92 X15.0 Y8.0 Z10.0;
Distance from machine zero to the part /
workpiece zero is 15, 8 & 10 units in X, Y
& Z axis respectively.
We have shifted machine datum to part/wp
datum.
But tool is at reference point only.
Useful in power failure.

Tool Motion
G00 : Rapid Traverse/Positioning

Format: N_ G00 X_ Y_ Z_ ;
Move tool rapidly by any path (shortest path) to reduce
non productive time.

G01 : Linear Interpolation

Format: N_ G01 X_ Y_ Z_ F_
Linear Interpolation results in a straight line feed move.
Used when material is to be cut using Feed rate.

G00: Rapid Positioning

25
B

20

15
10
5

PositioningmotionfromAtoC
N10G00X30000Y20000F0

10

15

20

25

30

Tool Motion
G02 : Circular Interpolation (CW)

To specify that the tool should be moved to a


specified location along a circular path in a
clockwise direction.
In order to specify the path to the MCU, the end
point of the arc and the location of the center of the
arc should be specified.
The center of the arc is given by I, J & K as the
incremental distance from the start point of the arc
as measured along X, Y & Z resp.

G02 : Circular Interpolation (CW)

I,J, and K dimensions must be


preceded by sign according to the
direction as viewed from start point
of arc to the center.

N_ G02 X2 Y1 I0 J-1 F10


or
N_ G02 X2 Y1 R1
(if angle of rotation of arc is < 180 )

G02 : Circular Interpolation (CW)

25

CircularinterpolationfromAtoB
aboutacirclecenteredatC
N10G02X20000Y10000
I5000J15000F2500
I=5

20

15

J=15

10
5

B
C

10

15

20

25

30

Tool Motion
G03 : Circular Interpolation CCW
G04 : Dwell
N_ G04 X3.0; (3 sec. stoppage of controller)
Or
N_ G04 P3000; (3000 millisecond)

G94 : Feed Rate per min.


G95 : Feed Rate per rev.
G28 : Auto Return to Program Zero (Home)
G78 & G79 : Milling Cycle
G80: Cancel Cycle

Basic program Structure


1.
2.
3.
4.
5.
6.
7.

Establish the coordinate system


Call the tool & tool offset
Turn the spindle
Approach in rapid mode
Approach by faster feed rate
Program the cutting mode
Return the tool to its start position & cancel
the offset

Three Main parts of a CNC program


Part 1- Program Setup

N5 G90 G21

(Absolute units, metric)

N10 M06 T2

N15 M03 S1200

(Stop for tool change, use


tool # 2)
(Turn the spindle on CW
to 1200 rpm)

Three Main parts of a CNC program


Part 2- Chip Removal

N20 G00 X1 Y1
(Rapid to X1,Y1 from origin point)
N25 Z0.125
(Rapid down to Z0.125)
N30 G01 Z-0.125 F100
(Feed down to Z-0.125 at
100 mm/min)
N35 G01 X2 Y2
(Feed diagonally to X2,Y2)
N40 G00 Z1
(Rapid up to Z1)
N45 X0 Y0
(Rapid to X0,Y0)

Three Main parts of a CNC program


Part 3- System Shutdown

N50 M05

(Turn the spindle off)

N55 M00

(Program stop)

Typical data for milling


Cutting data: (for CI)
Speed (S): 1500, 2000, 3000 rpm
Feed (F): 150 to 250 mm/min or
0.2 to 0.4 mm/teeth
Max d.o.c: 8 mm
Cutter dia.:
12 to 25 mm
Tools:
slot drill (from top)
end mill (from top & side)
Operations:
facing, profiling & pocketing

Assumptions of part program


1.
2.
3.
4.
5.
6.
7.

Part/workpiece Zero with coordinate system


Material of w/p
Type of Machine
Type of tools
Tool data:
height/width/diameter etc.
Machining parameters:
spindle speed, Feed & d.o.c
Tool Path with coordinates of tool location

EXAMPLE on CNC MILLING


MACHINE
As shown in fig. only
finish cut of the pocket
is to be machined by
using 20 mm dia. Slot
drill.
Generate part
program & show the
tool path.

Assumptions:
1.
2.
3.
4.
5.
6.
7.
8.
9.

Part/workpiece Zero is at A
Identify Coordinate system if required
Locate Rapid/Clearance plane
Material of w/p: CI or MS
Type of Machine: Vertical Milling m/c
Type of tools: Tool 1 = 20 mm dia. slot drill
Tool height: 15 mm
Spindle speed: 3000 rpm
Feed: 120 mm/min

Assumptions:
10.

Draw Tool Path with coordinates:


Tool path: A B C D E B
Location

X- coordinate

Y-coordinate

25

25

25

75

65

75

65

25

Part Program
N5 G92 X0 Y0 Z0* (abs. preset at A)
N10 G90 G20* (abs. prog. with Metric)
N15 M06 T1* (tool change Tool :1)
N20 M03 S1200* (spindle CW at 1200 rpm)
N25 G00 X25 Y25 Z2*(tool at B 2mm above)
N30 G01 Z-12 F120* (tool to full depth)
N35 Y75* (proceed to C)
N40 X65* (proceed to D)
N45 G02 Y25 I0 J-25* (cut curve till E)
N50 G01 X25* (proceed to B)
N55 Z2* (tool to rapid plane)
N60 G00 Z50 M05* (rapid & spindle stop)
N65 X0 Y0* (rapid to start position)
N65 G91 G28 X0 Y0 Z0* (rapid to home)
N70 M30* (program end & tape rewind)
Note: For calling Tool 2 for another
operation: After N65 go to N15 and use T2

EXAMPLE OPERATION on CNC


MILLING MACHINE

G-CODE PROGRAM

First pass : conventional mill to a


depth of 0.125 around edge
profile. Tool 1 is a inch dia. end
mill.
%
:1002
N5 G90 G20
N10 M06 T1
N15 M03 S1200
N20 G00 X0.125 Y0.125
N30 Z0.125
N35 G01 Z-0.125 F5
N40 X3.875
N45 Y4.125
N50 X0.125
N55 Y0.125

Second pass:
conventional mill to a
depth of 0.25 around
edge profile.
N35 Z-0.250
N40 X3.875
N45 Y4.125
N50 X0.125
N55 Y0.125
N60 Z0.125

Third pass:
conventional mill to a
depth of 0.125 around
pocket profile.
N65 G00 X1.25 Y1.0
N70 G01 Z-0.125 F5
N75 X1.75
N80 Y2.5
N85 X1.25
N90 Y1.0
N95 Z0.125

Fourth pass: climb mill to


a depth of 0.125 across
remaining material.
N100 Y2.125
N105 X2.625
N110 Z0.125
N115 G00 X-5 Y-5 Z5
N120 M05
N125 M30

Canned Cycle/Fixed Cycle


In part programming a series of motions are to be

repeated a no. of times.


These motions can be grouped & made available by

the use of preparatory functions called canned cycle.


e.g. Drilling G81
Drill Dwell G82 (dwell after full depth)
Tapping G84 (spindle direction reverses when tool retracts)
Reaming - G85 (return at feed rate)
Boring G86
Milling G78, G79 (tool to R-plane, Z to total depth with F)
G80 Canceling cycle (rapid traverse)

Mill Canned Cycle G78, G79


A w/p of 100mm x 55mm
has to be machined on
all edges with a cutter
of 20 dia. & 20mm
width. Let A is the set
point/part zero.
Generate part program
& show the tool path.

Solution:
1) Assumptions
2) Part Program

Mill Canned Cycle G78, G79


Table feed in X or/& Y
Tool to R plane
Z to full depth with F
N5 G92 X0 Y0 Z0* (abs. preset at A)
N10 G90 G20* (abs. prog. with Metric)
N15 M06 T1* (tool change Tool :1)
N20 M03 S1200* (spindle CW at 1200 rpm)
N30 G01 G78 X40 Y30 Z -52 R-33 F100*
N35 G79 X160* (proceed to C)
N40 Y105* (proceed to D)
N45 X40* (proceed to E)
N50 Y30* (proceed to B)
N60 G80 Z0 F0 M05* (cancel & spindle stop)
N65 X0 Y0* (rapid to start position)
N70 M30* (program end & tape rewind)

You might also like