Vous êtes sur la page 1sur 81

Chapter 6 Numerical

Control Programming
6.1 NC part programming
6.2 Manual part programming
6.3 Computer-assisted part programming
6.4 CAD part programming
6.5 NC cutter-path verification
6.6 Analytical geometry for part programming

6.1 NC PART PROGRAMMING


/
Introduction

Coordinate Systems/
NC Words/

6.1.1

Coordinate System/

Cartesian coordinate
system:
the xyz system is a righthand system
Positive motion: moving
the cutting tool away from
the workpiece.

6.1.1

Coordinate System/

Z AXIS Z // rotating spindle


workpiece-rotating machine:
Z is parallel to the spindle
tool-rotating machine:
Z is parallel to the tool axis

6.1.1

Coordinate System/

X // table
X AXIS
workpiece-rotating machine:
X is the direction of tool movement
horizontal milling machine :
X axis is parallel to the table
vertical machine :
+X axis points to the right
when the programmer
is facing the machine.

Z
X

6.1.5

NC Words/

N, G, X, Y Z, A, B, C, I, J, K, F, S, T, R, M

N: specify the sequence number

G: preparatory word
to prepare for control functions (the motion of each axis,
coordinate system, coordinate plane, cutter radius
compensation, tool length offset)

M: miscellaneous word
to control miscellaneous functions (spindle on/off,
start/stop the machine, turn on/off the coolant, change the
tool, and rewind the program tape)

6.1.5

NC Words/

6.1.5

NC Words/

M CODES
M00

Program stop

M06

Tool change

M01

Optional stop

M07

Flood coolant on

M02

End of program

M08

Mist coolant on

M03

Spindle CW

M09

Coolant off

M04

Spindle CCW

M30

End of tape

6.1.5

NC Words/

Modal codes and non modal codes/

modal functions
Modal functions stay active until some other command
changes it. Modal commands are arranged in sets called
modal groups , and only one member of a
modal group may be in forces at any given time.

non-modal functions
Non-modal functions have effect only on the lines on
which they occur.

6.1.5

NC Words/
modal groups/

6.1.5

NC Words/

M CODES

modal groups/

M00

Program stop

M06

Tool change

M01

Optional stop

M07

Flood coolant on

M02

End of program

M08

Mist coolant on

M03

Spindle CW

M09

Coolant off

M04

Spindle CCW

M30

End of tape

6.1.5

NC Words/

N, G, X, Y , Z, A, B, C, I, J, K, F, S, T, R, M

F: feed rate of the tool motion


S: cutting-speed

T: tool number

6.1.5

NC Words/

N, G, X, Y , Z, A, B, C, I, J, K, F, S, T, R, M

X, Y, Z, A, B, C: provide the coordinate positions of the


tool. X, Y, and Z define the three translational
(Cartesian) axes of a machine. A, B and C are used for
the three rotational axes about the X, Y, and Z axes.

I, J, K: specify the center for circular motion

6.1.5

NC Words/

N, G, X, Y, Z, A, B, C, I, J, K, F, S, T, R, M

R: specify the clearance height in


canned-cycle

N0010 G81 X1.000 Y2.000 Z0.000 R1.300

Operations in drill cycle G81 :


1. Rapid to location (1,2,2).
2. Rapid down to the R plane:(1,2,1.3)
3. Feed to the Z point, the bottom of the hole:(1,2,0)
4. Operation at the bottom of the hole (dwelling).
5. Rapid or feed to either the R plane or the initial height.

NC Words/

G codes

Unit selection:

Coordinates selection:

G70 (inch), G71(metric)


G90(absolute), G91(incremental)

Working plane selection:

G17(X-Y), G18(Z-X), G19(Y-Z)

Set up working coordinate

Machine zero

is unchangeable and usually is set up with the machine

23

Working coordinate
(is decided by the offset from the machine zero)
X
25.2
G92
Be defined in program
G92 X25.2 Z23.0
G54 G59
Be defined in CRT/MDI environment, not defined in program
After they are defined, they can be used in program.
G55

G56

G57

G58

G59

G54
Machine zero

Rapid traverse: G00

G00:

to make the machine move at maximum speed.


It is used for positioning motion.
G90 G00 X20.0 Y10.0
End

G90:
absolute
coordinate
s
Start

(20,10)
(10,10)

(0,0
)

Linear interpolation: G01

G01:

linear interpolation at feed speed.


G91 G0l X200.0 Y100.0 F200.0

G91:
incremental
coordinates

Y
End

100.0

Start

200.0

Circular interpolation: G02,


G03

G02, G03:
For circular interpolation, the tool destination and the circle center
are programmed in one block
G02 is clockwise interpolation, G03 is counterclockwise
interpolation
G 02
R

G17
X
__
Y
__

F __;
G 03
I __ J __
G 02
R
X
__
Z
__

G
03

I __

G18

G 02
R
G19
Y __ Z __
G 03
J __

F __;

K __

F __;

K __

End point Circle center, radius

Circular interpolation: G02,


G03
Y
X

R=-50mm

End

Specify R with
sign before it:
180 +R

Start

R=50mm

G91 G02 X60.0 Y20.0 R50.0 F300.0


G91 G02 X60.0 Y20.0 R-50.0 F300.0

>180 -R

Circular interpolation: G02,


G03
Y

End

Specify Center with I, J, K

I, J, K are the
incremental distance
from the start of the arc;

Viewing the start of arc


as the origin, I, J, K
have positive or
negative signs.

X
Start
j

Center
i

Circular interpolation: G02,


G03
N0010 G92 X200.0 Y40.0 Z0 ;
N0020 G90 G03 X140.0 Y100.0 I -60.0 F300
N0030 G02 X120. 0 Y60.0 I- 50.0
G92:
Or

To define working
coordinate

N0010 G92 X200.0 Y40.0 Z0


N0020 G90 G03 X140.0 Y100.0 R60.0 F300
N0030 G02 X120.0 Y60.0 R50.0
G90:
absolute
coordinates

Y
100
60
40

R50
R60
X

90 120 140

200

Circular interpolation: G02, G03


Annotation for Circular Interpolation

I0.0, J0.0, and K0.0 can be omitted.


If X,Y,Z are all omitted in the program, that means
start and end of arc are same points.

N0020 G02 I20.0 (a full circle)

If I, J, K, and R all appears in circular interpolation


instruction, R is valid and I, J, and K are invalid

Return to Machine Zero: G28


G28
The machine passes by the specified point, and then
move to the machine zero.
G91: incremental
G91 G28 X_, Y_, Z_

coordinates

X,Y,Z are the coordinate of specified point that is saved in


memory of machine.
Usually this instruction is used in the beginning and end of
program.
Machine
Zero
A

Specified
point

Return to the Specified point :


G29
G29
The machine passes from the machine zero by
the point that is specified in G28, and then move
to the new specified point.
G29 X_, Y_, Z_

X, Y, Z are the coordinate of new specified point


G28,G29 are usually used to change tool
Specified point
in G28

Machine
Zero

A
New specified point in
G29

Tool Compensation

Tool-Radius Compensation /

Left hand G41


Right hand G42
Cancel tool-radius compensation G40

Tool-Height Compensation/

Positive G43
Negative G44
Cancel tool-height compensation G49

Tool-Radius Compensation

Tool-radius compensations make it possible to


program directly from the drawing, and thus
eliminate the tool-offset calculation
G41 (G42) H

H: the radius of tool to compensate is saved in a memory unit


that is named H
G41/G42 is directly related with direction of tool movement and
which side of part is cut.

Start

Tool-Radius
Compensation

Note the difference between two ways:

N0010 G41 G01 X0.500 Y1.700


N0020 G01 X1.500

N0010 G41
N0020 G01 X0.500 Y1.700
N0030 G01 X1.500

Ramp on block

effective from the start

Inside Corner
in Tool-Radius
Compensation
When the cutter path determines the geometry of an
inside corner, it stops at the inside cutting point

N0010 G42
N0030 G01 X1.500 Y2.000
N0030 G01 X0.000 Y1.600

External curves
in Tool-Radius
Compensation

M96: to insert circular arc at the corner by the CNC


controller.
M97: to insert straight lines at the corner.

External curves
in Tool-Radius
Compensation
Use of M96 and M97

If a step is to be cut using a cutting tool that is larger than


the height of the step, M97 must be used. If M96 is used, the
cutter will roll over the corner and into the material
N0010 G41
N0020 G01 X1.000 Y1.000
N0030 G01 Y0.800 M96
N0040 G01 X2.000
M96

N0010 G41
N0020 G01 X1.000 Y1.000
N0030 G01 Y0.800 M97
N0040 G01 X2.000
M97

Cancel Tool Compensation:


G40

Note the difference between two ways

N0060 G40 G01 X2.000 Y1.700 M02

ramp off block

N0060 G01 X2.000 Y1.700


N0070 G40 M02

effective to the end point

Tool-Height Compensation
G43 (G44) H

H: specified memory unit used to save height


compensation of tool.

Positive compensation (G43):

real position = specified position + value saved in H

Negative compensation (G44):

real position = specified position - value saved in H

Tool-Height Compensation

Example:

N0010
N0020

G91 G00 X12.0 Y80.0


G44 Z-32.0 H02

G91:
incremental
coordinates

If we put 0.5mm into H02,


real position = -32.0 - 0.5 = -32.5

Cancel tool-height compensation: G49

M code
miscellaneous word/
miscellaneous functions:

turn the spindle on/off


start/stop the machine
turn on/off the coolant
change the tool
rewind the program (tape)

M code
M00

Program stop

M06

Tool change

M01

Optional stop

M07

Flood coolant on

M02

End of program

M08

Mist coolant on

M03

Spindle CW

M09

Coolant off

M04

Spindle CCW

M30

End of tape

modal groups/

M code: M00, M01


M00 and M01 both stop the machine in the
middle of a program.
M01 is effective only when the optional stop
button on the control panel
is depressed. The program can
be resumed through the control
panel.

M code: M03, M04, M05


M03 turns on the spindle clockwise.
M04 turns the spindle on counterclockwise.
(The spindle rpm must be specified in the
same line or in a previous line. )

M05 turns off the spindle.

M code: M07, M08, M09

M07 and M08 turn on different modes of


coolant.

M07: flood coolant on


M08: mist coolant on

M09 turns off the coolant.

M code: M06
M06 signals the tool-change operation.
On a machine equipped with an automatic
tool changer, it stops the spindle, retracts
the spindle to the tool-change
position, and then changes the tool to the
one specified in the T-code.

M code: M02, M30


M02 marks the end of the program.
M30 marks the end of the tape. It stops the
spindle and rewinds the program (tape)

Example

A 2.0-in 2.0-in. square is to be milled using a 1/2-in. end


milling cutter (end mill). Write an NC part program to
make the square.

Example
Part program

Explanation

N0010 G41 S1000 F5 M03

Begin compensation left , set feed and


speed, spindle on CW
Move to lower left corner
Plunge down the tool
Cut to upper left corner
Cut to upper right corner with external curve
Cut to lower right corner with external curve
Cut to lower left corner with external curve
Lift the tool
End the composition, stop the machine

N0020 G00 X6.000 Y6.000


N0030 G01 Z-1.000
N0040 G01 Y8.000
N0050 G01 X8.000 M96
N0060 G01 Y6.000 M96
N0070 G01 X6.000 M96
N0080 G01 Z1.000
N0090 G40 M30

6.2 MANUAL PART


PROGRAMMING/

Example part
Figure 6.10

6.2 MANUAL PART


PROGRAMMING/

Working
coordinate
zero point

Setup and
cutter path
for example part
Figure 6.11

coordinates of each point


(cutter location) /
P1:(1.75+0.375,-0.1-0.375,4)=(2.125,-0.475,4)
P1:(2.125,-0.475, 2-0.5)=(2.125,-0.474,1.5)
P2:(2.125,4+0.1,1.5)=(2.125,4.1,1.5)
P3:(3-0.375,4.1,1.5)=(2.625,4.1,1.5)
P4:(2.625,2-1+0.375,1.5)=(2.625,1.375,1.5)
P5:(3,2-1+0.375,1.5)=(3,1.375,1.5)
P6:(3,2+1-0.375,1.5)=(3,2.625,1.5)
P7:(3,2,1.5)
P8:(3-0.375,2,1.5)=(2.625,2.0,1.5)
P9:(2.625,-0.1,1.5)
P9:(2.625,-0.1,4)

Figure 6.12 Part program for the part in Figure


6.10
(without tool-radius compensation)
N0010 G70 G90 T08 M06
N0020 G00 X2.125 Y-0.475 Z4.000 S3157
N0030 G01 Z1.500 F63 M03
N0040 G01 Y4.100
N0050 G01 X3
N0060 G01 Y1.375
N0070 G01 X3.000
N0080 G03 Y2.625 I3.000 J2.000
N0090 G01 Y2.000
N0100 G01 X2.625
N0110 G01 Y-0.100
N0120 G00 Z4.000 T02 M05
N0130 F9.16 S509 M06
N0140 G81 X0.750 Y1.000 Z-0.1 R2.100 M03
N0150 G81 X0.750 Y3.000 Z-0.1 R2.100
N0160 G00 X-1.000 Y-1.000 M30

Set the machine to the inch format (G70)


and absolute dimension (G90)
programming, change to tool T08
Rapid to P1.
Down feed to P1, spindle CW.
Feed to P2.
To P3.
To P4.
To P5.
Circular interpolation to P6.
To P7.
To P8.
To P9.
To P9, spindle off, tool sign 2.
Tool change, set new feed and speed.
Drill hole 1. CW
Drill hole 2. CW
Move to home position, stop the machine.

Figure 6.12 Part program for the part in Figure


6.10
(with tool-radius compensation)
N0010 G70 G90 T08 M06
N0020 G00 X2.125 Y-0.475 Z4.000 S3157
N0030 G01 Z1.500 F63 M03
N0040 G01 Y4.100
N0050 G01 X3
N0060 G01 Y1.375
N0070 G01 X3.000
N0080 G03 Y2.625 I3.000 J2.000
N0090 G01 Y2.000
N0100 G01 X2.625
N0110 G01 Y-0.100
N0120 G00 Z4.000 T02 M05
N0130 F9.16 S509 M06
N0140 G81 X0.750 Y1.000 Z-0.1 R2.100 M03
N0150 G81 X0.750 Y3.000 Z-0.1 R2.100
N0160 G00 X-1.000 Y-1.000 M30

Set the machine to the inch format (G70)


and absolute dimension (G90)
programming, change to tool T08
Rapid to P1.
Down feed to P1, spindle CW.
Feed to P2.
To P3.
To P4.
To P5.
Circular interpolation to P6.
To P7.
To P8.
To P9.
To P9, spindle off, tool sign 2.
Tool change, set new feed and speed.
Drill hole 1. CW
Drill hole 2. CW
Move to home position, stop the machine.

Figure 6.12 Part program for the part in Figure


6.10
(with tool-radius compensation)

N0010 G70 G90 T08 M06


N0020 G00 G42 X1.75 Y-0.1 Z4.0 S3157
N0030 G01 Z1.5 F63 M03
N0040 G01 Y4.1
N0050 G01 X3.0
N0060 G01 Y3.0
N0080 G02 Y1.0 R1.0 M96
N0110 G01 Y-0.100 M96
N0120 G00 G40 Z4.000 T02 M05
N0130 F9.16 S509 M06
N0140 G81 X0.750 Y1.000 Z-0.1 R2.100 M03
N0150 G81 X0.750 Y3.000 Z-0.1 R2.100
N0160 G00 X-1.000 Y-1.000 M30

Set the machine to the inch format (G70)


and absolute dimension (G90)
programming, change to tool T08,
Rapid to PP1. radius compensation on
(right hand)
Down feed to PP1, spindle CW.
Feed to PP2.
To PP3.
To PP6.
Circular interpolation to PP5 with
additional external curve.
To PP9 Additional external curve
To PP9, radius compensation off, spindle
off, tool sign 2.
Tool change, set new feed and speed.
Drill hole 1. CW
Drill hole 2. CW
Move to home position, stop the machine.

Figure 6.12 Part program for the part in Figure


6.10
(with tool-radius compensation)

N0010 G70 G90 T08 M06

N0020 G00 G42 X1.75 Y-0.1 Z4.0 S3157


N0030 G01 Z1.5 F63 M03
N0040 G01 Y4.1
N0050 G01 X3.0
N0060 G01 Y1.0
N0080 G03 Y3.0 R1.0
N0110 G01 Y-0.100 M96
N0120 G00 G40 Z4.000 T02 M05
N0130 F9.16 S509 M06
N0140 G81 X0.750 Y1.000 Z-0.1 R2.100 M03
N0150 G81 X0.750 Y3.000 Z-0.1 R2.100
N0160 G00 X-1.000 Y-1.000 M30

Set the machine to the inch format (G70)


and absolute dimension (G90)
programming, change to tool T08,
radius compensation on (right hand)
Rapid to P1.
Down feed to P1, spindle CW.
Feed to P2.
To P3.
To P4.
Circular interpolation to P5 with
additional external curve.
To P9 Additional external curve
To P9, radius compensation off, spindle
off, tool sign 2.
Tool change, set new feed and speed.
Drill hole 1. CW
Drill hole 2. CW
Move to home position, stop the machine.

6.2 MANUAL PART


PROGRAMMING/

Summary

Adequate for many simply point-to-point


processes

Time-consuming

Error correction can be cumbersome

Errors made by the programmer are often


not discovered until the program is tested
graphically or on the machine tool

6.3 COMPUTER-ASSISTED PART


PROGRAMMING/

Automatically Programmed
Tool APT

Initially developed in 1956 at MIT


Definition
In computer-assisted part programming, generalpurpose computers are used as an aid in
programming, and special-purpose, high-level
programming languages perform the various
calculations necessary to prepare the program.

6.3 COMPUTER-ASSISTED PART


PROGRAMMING/

APT

APT

Example of APT program/


APT Y
P1

20

L3
L2

PARTNO LJBCL
5
L1
MACHIN MHC432
$$
SETPT(0,0 5
INTOL/0.01 0.01 )
TN,MILL,1,8,10 1 8 10
LOADTL/1 1
CUTTER/8 8
SPINDLE/800,CLW 800rpm
FEDRAT/100 100mm/min
COOLNT/ON

C1
X

Example of APT program/


APT Y P1
20

L3
L2

C1
L1

$$
SETPT(0,0 5
X
SETPT=POINT/0,0 SETPT
) (0,0)
L1=LINE/XAXIS,5 L1 X Y 5
L2=LINE/YAXIS,5 L2 Y X 5
P1=POINT/5,20 P1 (5,20)
L3=LINE/P1,ATANGLE,(90+45) L3 P1 X 135
C1=CIRCLE/YLARGE,L1,XSMALL,L3,RADIUS,2.5 C1 L1 L3
Y X 2.5

P1

Example of APT program/


L3
L2
APT
20

5
SETPT(0,0 5
)

C1

L1
X

$$
FROM/SETPT SETPT
GO/TO,L1,TO,L2 L1 L2
TLRGT,GORGT/L1,TANTO,C1 L1 C1
GOFWD/C1,TANTO,L3 C1 L3
GOFWD/L3,PAST,L2 L3 L2
GOLFT/L2,PAST,L1 L2 L1
GOTO/SETPT SETPT
$$
COOLNT/OFF
SPINDLE/OFF
FINI
%PM

6.3 COMPUTER-ASSISTED PART


PROGRAMMING/

APT

APT

After
APT compiler

P1

20

L3
L2

N9900 LJBCL
C1
N1 G90
5
L1
N2 G17 XY
N3 G40
SETPT(0,0 5
X
N4 T1 M06 1
)
N5 S800 M03 800rpm
N6 G90
N7 G1 X1 Y1 Z0 F100
N8 X13.964 L1
N9 G3 X18.561 Y12.096 I13.964 J7.5 C1
N10 G1 X1 Y29.657 L3
N13 M9
N11 Y1 L2
N14 M5
N12 X0 Y0
N15 G0 Z150 Z

N16 M30

6.3 COMPUTER-ASSISTED PART


PROGRAMMING/

Summary

For more complex programs


Require the programmer to translate geometric

information from one form (usually an engineering


drawing) into another, which has a significant
potential for errors in the process.

Need improvement

6.4 CAD PART PROGRAMMING/


CAD

The modern way ----

Creation of NC programs from CAD

allow geometry to be described in the form of points,


lines, arcs, and so on, just as it is on an engineering
drawing, rather than requiring a translation to a textoriented notation (compared with APT).
Use of a graphics display terminal allows the system to
display the resulting cutter-path geometry
allow earlier verification of a program, which can avoid
costly machine setups for program testing.

Several CAD/CAM systems


Computervision System
CADAM System
CATIA System
MasterCAM
UG

6.4 CAD PART PROGRAMMING/


CAD

Procedures

Modeling
CAD drawing
Part-programming
Tool path
Verification
NC program

6.4 CAD PART PROGRAMMING/


CAD

Part-programming
Modeling

Tool path

Cutting mode selection


- Contour line rough cutting
- Contour line finishing
- Remainder cutting

Execute
calculation

Set target
shape model

Specify tool
- Tool diameter
- RPM
- Feed rate

Enter cutting conditions


- Tool origin
- Cutting pitch
- Approach
- Precision, etc.

6.4 CAD PART PROGRAMMING/


CAD

rough cutting semi-finishing finishing


with end mill to remove cavity

Straight
end mill

Work

Ball end mill

Straight end mill


Axial
cutting
depth

Axial
cutting
depth

Work

Layer by layer/

Axial
cutting
depth

Work

6.4 CAD PART PROGRAMMING/


CAD

Tool

path patterns (most popular)

direction-parallel milling

contour-parallel milling

6.4 CAD PART PROGRAMMING/


CAD

Applications

Contour Line

(Zig-Zag)

6.4 CAD PART PROGRAMMING/


CAD

Tool

path patterns (advanced)

(extra spiral at corners)

Plunge into part)

6.4 CAD PART PROGRAMMING/


CAD

Tool

path patterns (advanced)

Same roughness

6.4 CAD PART PROGRAMMING/


CAD

Part-programming

Modeling

Tool path

Cutting mode selection


- Contour line rough cutting
- Contour line finishing
- Remainder cutting

Execute
calculation

Set target
shape model

Specify tool
- Tool diameter
- RPM
- Feed rate

Enter cutting conditions


- Tool origin
- Cutting pitch
- Approach
- Precision, etc.

6.4 CAD PART PROGRAMMING/


CAD

Part-programming

Modeling

Tool path

Cutting mode selection


- Contour line rough cutting
- Contour line finishing
- Remainder cutting

Execute
calculation

Set target
shape model

Specify tool
- Tool diameter
- RPM
- Feed rate

Enter cutting conditions


- Tool origin
- Cutting pitch
- Approach
- Precision, etc.

6.4 CAD PART PROGRAMMING/


CAD

Part-programming

Modeling

Tool path

Cutting mode selection


- Contour line rough cutting
- Contour line finishing
- Remainder cutting

Execute
calculation

Set target
shape model

Specify tool
- Tool diameter
- RPM
- Feed rate

Enter cutting conditions


- Tool origin
- Cutting pitch
- Approach
- Precision, etc.

6.4 CAD PART PROGRAMMING/


CAD

Approach/Engage/Entry

Departure/Retract/Exit

6.4 CAD PART PROGRAMMING/


CAD

Part-programming

Modeling

Tool path

Cutting mode selection


- Contour line rough cutting
- Contour line finishing
- Remainder cutting

Execute
calculation

Set target
shape model

Specify tool
- Tool diameter
- RPM
- Feed rate

Enter cutting conditions


- Tool origin
- Cutting pitch
- Approach
- Precision, etc.

6.5 TOOL-PATH VERIFICATION/

Purposes/

to detect geometric error of the cutter path


to detect potential tool interference
to detect incorrect cutting conditions

6.5 TOOL-PATH VERIFICATION/

/Overcut and undercut

potential problems in sculptured surface machining

6.5 TOOL-PATH VERIFICATION/

Ways to verify a part program/

To make a dry cut on the machine without the


workpiece
to actually machine a prototype in wax, plastic, wood,
foam, or some other soft material.
In a CAD-based system, cutter-path abnormalities can
be detected by visual inspection i.e. the display of an
animation sequence that shows the tool moving along
its generated path which is superimposed on the part
geometry.

6.5 TOOL-PATH VERIFICATION/

6.5 TOOL-PATH VERIFICATION/

Almost most of the cutter-pathgeneration packages are based


on the wire-frame model.

There is no way of detecting


interference between the tool and
the part and the fixture

Some systems have begun to


use solid models directly

The entire machining


environment, including stock, part
volume, tools, and fixtures, can be
modeled and used to generate a
collision-free cutter path.

Review

Coordinate systems
Typical NC words
Three types of part programming

Manual/APT/CAD

Potential problems in sculptured


surface machining

Homework
6.2
6.3
6.4

Vous aimerez peut-être aussi