Vous êtes sur la page 1sur 35

NC Part Programming

NC: alpha-numeric control of machine (s)


Part program: this is a set of instructions for a machine to follow a defined path

NC words:
NC words used in programming along with sequence are:
Block no. (N)
Preparatory word (G codes)
Coordinates (x, y, z)
Feed rate (F)
Cutting speed (S)
Tool selection (T)
Miscellaneous function (M)
• These words are not necessarily written in the same order as indicated above.
CNC Part Programming
(Programming Steps)
Two important steps:
Process Planning
Process plan is a detailed plan of steps involved
in machining (manufacturing) a given part: The
following are contents of process plan:
• M/C tool used
• Fixtures required
• Sequence of operations
• For each of operation, cutting tools &
process parameters required
Selection of m/c tool depends on the operation
required, accuracy requirement, m/c tool
capability & availability, cutting tools availability.
Process planning plays role in determining the
cost of part.
Example shows a typical process plan.
CNC Part Programming
(Programming Steps)

Axes selection:
The coordinate system provides means for defining
position of tool with respect to w/p.
• Each m/c has a fixed datum, usually on the left of
m/c. And thus all the tool positions are considered
positive from this reference.
• Using fixed datum in part programming create
complexity and involves extensive dimensional
calculations. Therefore, a floating datum is defined
for part programming.
CNC Part Programming
(Programming Steps)
• The determination of floating datum owes to choice
of programmer. He should select it in such a way
that the tool path calculations/length is minimum.
• If possible, keep all the part in positive quadrant so
that all the values are in plus. It helps to avoid
programming errors (Ref. Figs).
• The axes of floating coordinate system is matched
with that of m/c.
• In case of axi-symmetric part, the datum is chosen at
center of part.
Manual Part Programming Methods
• In past, a number of NC format for NC part programs were used such as
1. Fixed Sequence (for no entry, we enter 0 )
2. Tab sequential (for no entry, we enter tab key)

3. Word Address Format is being used in which each of info or data to be input in the form of
numerical digits is preceded by a word address in form of an English alphabet.
3. The word (G, F, N, M) basically is the address of register.
4. Here we don’t need to repeat feed/speed info (or the info we want to carry on in next
blocks) in each block.
5. Also we don’t need to follow fixed format, as each register has its address as A, B, G. So
their order is not as important as in fixed sequence format.
6. For example, N105 means that N is address for numerical data 105. So numerical
data 105 will be read by register named N.
Manual Part Programming Methods
(ISO standards for coding)
Many things have been standardized for NC part programming. All 26 letters of English
alphabets have been standardized and given meaning:
Manual Part Programming Methods
(ISO standards for coding)
• The program begins with beginning code %, which signifies the start of tape.
• Each block can have one or more of word addresses in a sequence. A typical ISO format
for block is shown below:
N5 G2 X53 Y30 Z30.. U V W ..I J K ..F5.. S4.. T4.. M2
This is typical sequence in which the word address should occur in block. However, not
necessary.
• If a word is not required to be written in a block, it is omitted.
• If a value need not change, the function/word will not be repeated in next block. The info
is automatically carried. For example,
N110 G01 X50 Y40 Z12 F200 S1500 T1103 M03*
N115 Y25*
• This programming format is mostly followed by m/c manufacturers. However, some
differ from this format. So, programming manual of m/c should be consulted.

N4.0 G2.0 XYZIJK2.4 F2.1 S4.0 M2.0


N40 G20 XYZIJK24 F21 S40 M20
N4 G2 XYZIJK24 F21 S4 M2
Possible formats
with/without decimals
Manual Part Programming Methods
(ISO standards for coding)
Coordinate Function:
• The coordinate of tool tip are programmed for generating a given component geometry.
• The coordinate values are specified using word address such as X, Y, Z, U, V, W, I, J, K.
• All these word addresses are normally signed (+, -) along with decimal point depending
upon the resolution of m/c.
Feed Function:
• Feed is designated in velocity (mm/min). F word is used to represent it.
• This is actual feed with which machining is performed. However, there could be some
deviation b/w programmed and actual feed depending upon the controller calculations.
• It is modal function, i.e. once set it remains active until replaced by 2 nd F value
• The feed units can be changed from mm/min to mm/rev by writing a related G code.
Speed Function:
• The speed is directly measured in RPM and is designated by word S.
For example, S500 means 500RPM.
• In case of turning, when the work surface controls the actual cutting speed then direct
RPM program would make the cutting speed to vary when the work diameter is
changed. This is harmful from surface finish as well as tool life point of view and hence
another option for spindle speed function is constant surface speed.
V= πDN
Manual Part Programming Methods
(ISO standards for coding)
Tool Function:
• Most of m/c’s are equipped with tool turrets or magazines with automatic tool changers.
• T function is useful in pointing out the tool location and hence tool loading in spindle.
• T function could have 1 OR 2 digits depending on the magazine capacity.
• In machines where magazines are not available, the function T is used to stop the m/c for
manual tool loading.
Comments:
It is possible to add comments in program to clarify the individual functions that are used in
program. For this purpose, parentheses are used. When the controller encounters the
opening parenthesis, it ignores all the information till it reaches the closing parenthesis.
Manual Part Programming Methods
(ISO standards for coding)
Preparatory functions:
• It is a preset function associated with movement of m/c axes and associated geometry,
denoted by character G.
• It is possible to include more than one G codes in a block, provided these codes are not
mutually exclusive (e.g G02 & G03)
• No. of admissible G codes in a block depends on the controller type
• Some of the G codes are modal (i.e they behave as setting to control). Once given, they
remain operational till cancelled by another G code from the same group.
• Some of G codes are default (as G90– absolute programming)
Manual Part Programming Methods
(Preparatory Functions)
Manual Part Programming Methods
(Preparatory Functions)
Manual Part Programming Methods
(Preparatory Functions)
Manual Part Programming Methods
(Groups of Preparatory Functions)
Manual Part Programming Methods
(Groups of G codes)
Commonly used G codes in form of groups:
1. Coordinate system Group (G90, G91)
Absolute programming using G90:
- G90 is used for specifying tool position in absolute coordinate
system.
- Ref. Fig, suppose the tool has to pass through the route: O-A-
B-C. Then blocks will be:
N001 G90 G01 X5.0 Y10.0 F200
N002 X25 .0 Y15.0
N003 X35.0 Y5.0
- This system is generally advised for programming because
there are few chances of errors.
- Whatever the route of move, programmed X &Y values of
each position remain the same.
Incremental programming G91:
- G91 is generally default mode and is cancelled with G90. End
of program words (M02, M30) also cancel them.
- Ref to Fig, the incremental programming for path O-A-B-C:
- N001 G91 G01 X5.0 Y10.0 F200
- N002 X20.0 Y5.0
- N003 X10.0 Y-10.0
Manual Part Programming Methods
(Groups of G codes)
- If the route is changed, the program is changed.
- Incremental programming is useful when features are dimensioned in a continuous
chain e.g. 5 holes at 30mm apart along x-axis will simply be programmed for each
feature as X30.0 While in absolute programming, one would have to compute value for
each position, i.e. X 30.0, X60, X90 and so on.
- Both systems can be followed in programming, but carefully
- The incremental system containing error in a block carries forward whereas it does not
happen in absolute system (error restricts to one block).
2. Units Group (G70, G71)
• This group of codes specifies the units in which the program is to be interpreted.
• G70 stands for inch units while G71 stands for mm.
• Any one of these can be made as default units. In most of systems, except used in North
America, G71 is applied as default.
• G70 and G71 can not be used simultaneously
• In Fanuc systems, G20 & G21 are used in place of G70, G71
Manual Part Programming Methods
(Groups of G codes)
3. Active plane selection group (G17-G19)

• Some of the functions in NC control can only work in a


plane rather than in all the 3 possible coordinate axes.
This, therefore, requires the selection of active plane.
• G17 for making XY as active plane. G17 is turn on
code.
• The plane perpendicular to cutter axes is called
working plane.
• G18 is used to make XZ plane as active plane
• G19 is used to make YZ plane as active plane
Manual Part Programming Methods
(Groups of G codes)
4. Pre-set (G92)
• G92 is used for pre-setting the zero point of program (i.e for setting up floating zero)
• Ref Fig, a block of 200*170*30 is clamped on m/c table.
• A mandrel or pre-setting tool is used for fixing zero point.
• The mandrel is made to touch at the shown location. At that instant, the program block
entered is:
N01 G92 X200.0 Y170.0 Z50.0.
The tool tip is to be set at 20mm from w/p top surface
• G53 to G56 are the other codes used for setting the programmable datum positions.
Manual Part Programming Methods
(Groups of G codes)
5. Motion Group (G00-G03)
a) Rapid positioning (G00)
• This is used for moving tool at rapid rate
• This is a modal function (stays active until
cancelled another function of this family)
• Say the tool need to move from point A to point B
at rapid rate (Ref Fig), the block will:
N01 G90 G00 X150.0 Y30.0 (Point A is already at
origin)
• In 3D case (Ref Fig), block of program for moving
from A to B
Absolute programming
N01 G90 G00 X50.0 Y45.0 Z40.0
N02 X90.0 Y90.0 Z70.0
Incremental programming (point A-B)
N01 G91 G00 X50.0 Y45.0 Z40.0
N02 X40.0 Y45.0 Z30.0
Incremental programming (point B-A)
N01 G91 G00 X90.0 Y90.0 Z70.0
N02 X-40.0 Y-45.0 Z-30.0
Manual Part Programming Methods
(Groups of G codes)
(b) Linear interpolation (G01)
• This code is used when material needs to be cut using feed rate
• Say material needs to be cut at feed rate of 250mm/min from point D-E (Fig.), the
program of block will be:
N01 G90 G00 X20.0 Y100.0 (Absolute Programming)
N02 G01 X110.0 Y30.0 F250 (F function is added)
• The blocks of program for point A-B (Fig)
N01 G90 G00 X50.0 Y45.0 Z40.0 (Absolute Programming)
N02 G01 X90.0 Y90.0 Z70.0 F250 (F function is added)
Manual Part Programming Methods
(Groups of G codes)

(c) Circular interpolation: -


• When an arc is to be traversed in a plane,
the G02 (CW) or G03 (CCW) is used.
• Ref Fig, the program block for F-G:
N01 G90 G00 X15.0 Y30.0 (CW- Absolute)
N02 G02 X65.0 Y55.0 I35.0 J-10.0 F 200.0 (I, J
can be replaced by R).
- Some m/c’s use I, J as center of arc.
- R can not be used for full circle. In such case,
I, J need to be used.
- If motion is CCW from G-F
N01 G90 G00 X65.0 Y55.0 (CCW- Absolute)
N02 G03 X15.0 Y30.0 I-15.0 J-35.0 F 200.0
Manual Part Programming Methods
(Groups of G codes)
• XY is default working plane in
milling.
• However, if the 2D interpolation is
carried in other plane such as YZ
or ZX. It becomes necessary to
specify plane using G19, G18 (Ref
Fig).
6. Dwell (G04)
• Dwell is used to stop the m/c for a
while.
• X word is used in most controllers.
P word is used in Fanuc
• Example:
N01 G04 X3.0 (other controllers)
N01 G04 P3000 (Fanuc uses no
decimal. Also, 3000 means 3seconds)
Manual Part Programming Methods
(Miscellaneous Functions)
• These functions operate some controls on the m/c tool and thus affects the running of the
m/c
• Generally only one M code is supposed to be given in a single block. However, some
controllers allow for two or more M codes in a block provided they are not mutually
exclusive, e.g. M07 (coolant on) & M09 (coolant off).
Manual Part Programming Methods
(Miscellaneous Functions)
Manual Part Programming Methods
(Commonly Used Miscellaneous Functions)
• M00: This would terminate the auto operation of m/c after completing the instructions in
block in which M00 has been programmed. This is called “program stop” and if it is
required to continue with the rest of program, the “start’ button on the console is to be
pressed. This is a pause function and is useful for changing the clamp position or to carry
out inspection of a particular dimension after a machining cut taken.
• M01: This is “optional stop” and stops the m/c, as in case of M00, only if the “Optional
stop” switch on the controller console is ‘ON’. This is useful when inspection is to be
carried out on some components and not all in given batch.
• M02: This is “End of Program” and it causes the stopping of m/c and clearing all the
control registers. This is replaceable by M30.
• M03: This is used for clock-wise rotation of spindle at speed set earlier using S word.
When it is given in a block would be the 1 st code to be executed before all the codes in a
block are acted upon.
• M04: This is used for counter clock-wise rotation of spindle at speed set earlier using S
word. When it is given in a block would be the 1 st code to be executed before all the codes
in a block are acted upon.
• M05: Used for stopping the m/c spindle. When it is given in a block will be the last code
to be executed after all the other codes in a block are acted upon.
• M06: Tool change M13: (Spindle on CW+ Coolant on) simultaneous
• M07: Coolant supply 1 on M30: End of program, tape is rewind till % sign
• M08: Coolant supply 2 on is encountered. For m/c working with RAM, the
• M09: Coolant off active program comes to be beginning
Manual Part Programming Methods
(Program Number & Sub-programs)
In latest CNC systems, there is provision for labeling the program at the start itself which
facilitate searching from stored programs. The symbol used for the program number in
Fanuc controller is O followed by its number. For example, O230. Such information does not
interfere with NC program.

Sub-programs: In most of the components, there are a number of repetitive features (e.g
patterns of holes, profiles etc). Instead of writing blocks for each of them repeatedly in the
program as per process plan, the facility exists for writing sub-programs for each feature
and entering them with labels at the end of main program.
In main program where these are required, they are called by appropriate block.
For example, M98 P1001– M98 is call for sub-program (also called sub-routine) 1001. The
number after P refer to the sub-program being called.
The sub-programs are ended with the word M99.
Manual Part Programming Methods
(Example 1)
Manual Part Programming Methods
(Program Number- Example 2)
X2.0 Y18.757

R18
Cutter Radius Offset calculations in Example 2
Manual Part Programming Methods
(Cutter Radius Compensation (G40-G42)
• In contouring operations, it becomes necessary to calculate the tool path for preparing
the program by offsetting the contour by an amount equal to radius of cutter.
• Ref. Fig., the tool path is offset from the actual profile need to be machined.
• If the tool radius changes, the new program needs to made.
• The additional work of making each time new program with change in tool radius could
be avoided if tool radius compensation is enforced. In such case, the program is written
at component profile and thus no change in program would be required. It is as the
program is written with zero radius.
Manual Part Programming Methods
(Cutter Radius Compensation (G40-G42)
• The preparatory functions G40-G42 are used for radius compensation and form one
group. These are modal and can be cancelled by other function of same group.
G40: Compensation off
G41: Used when the cutter is on the left of programmed path when looking in the direction
of tool movement. (i.e. the radius compensation is considered to the left of programmed
profile)
G42: Used when the cutter is on the right of programmed path when looking in the
direction of tool movement.
• The compensation as tool diameter is also given in some systems
• The tool radius entry is always +
• If the programmed path is determined for a particular size of cutter, the compensation
value would be + or – depending on whether the cutter used for machining is oversized
or undersized.
Manual Part Programming Methods
(Cutter Radius Compensation-Example 1)
Manual Part Programming Methods
(Cutter Radius Compensation-Example 2)
60

100
60

Cutter radius compensation


G41 & G42; Component
surface is taken as zero
Manual Part Programming Methods
(Tool Length Compensation- M06, T0n)
• In case when multiple operations are to be performed on a job, there will be need of
more than one tools. In such a case, the programming becomes cumbersome if the
programmer has to take care of individual tool lengths for the purpose of programming
the Z depth in each case.
• In order to avoid above problem, tool compensation is set and activated when the
relevant tool is engaged.
• In NC practice, all tools are measured in the assembled state using a tool pre-setter, and
this info is always kept up to date. For the tools being used, the difference in length, with
respect to the pre-setting tool, is recorded and is manually entered and stored with the
associated tool number.
• When these tools are called into action by programmed instruction, the respective
compensation values are activated and automatically taken into account in the tool
motion.
•The following example explains how tool length compensation
is automatically taken care of:
N003 M06 T01
N006 M06 T02
•Whenever, the tool is ground or replaced, the new values are
entered to replace earlier ones and thus the program remains
un-changed.
•This is an essential facility without which the multiplicity of
programs for each job/tool combination would become
impossible.

Vous aimerez peut-être aussi