L2-Part Program and G-code for Milling
L2-Part Program and G-code for Milling
Part program
o Main program:
▪ Header
▪ Core part (Operation part)
▪ End of file
o Sub-programs
Program header: It contains all ID for the programmer, the manufactured part,
the dates, the machines and others. Some examples are:
(FILE NAME …………….. O5421.CNC)
(Programmer ……………... Ziad Hosny)
(PART ID ………………… Bush for machine no. 468432)
(DATE originated ………… 10/03/2023)
(LAST Modified ………….. 12/01/2024)
(CONTROL ………………. Fanuc-301)
(UNITS …………………… Metric)
(RAW MATERIAL ………. Steel 306 block 400x200x30)
-
-
-
Operation part:
o It contains all the operational instructions (similar to the manually
done known as “operation sheet”). It is written in certain format with
a code that the machine controller can read, compile and analyse.
o The format structure and codes differ from a controller to another.
o This part consists of the different operations that will be performed.
Each operation is written in a line (known as Block). Each block is
separated from all others by a symbol “EOB”. As an example of two
separate Blocks:
N10 G00 X3 Y2.5 Z-1 T2 M06
N20 G01 X12 Y2 F4.2 S700 M03
End of file symbol: Each part program is usually ended with an end of file
symbol “%”.
Subprograms:
- It is a separate group of operations that can be executed whenever it has
been called from inside the main program.
- The main program can call any different numbers of subroutines
- The subroutine can call another subroutine as shown in fig. 1 (known as
nesting).
Sequence Block
o The contents of one block will be processed as a single unit before the
control processes any following block of instruction.
o A block includes:
- Block number N
- Preparatory commands G
- Auxiliary functions M
- Axis motion commands X Y Z A B C U V W…
- Words related to axes I J K R Q …
- Machine or tool function S F T
Block Numbering
o Block number has an address N or O.
o It is the 1st word in the block.
o used to organize the program.
o Used to delete a block, insert a block, jump to a block.
o The number that follows indicates how many digits is allowed to be
written after the address, e.g. N4 allows the programmer to mark the
blocks either N5 , N34 , N453 up to N9999.
Preparatory Functions
For CNC Machining Centre
• If feed va
• Although
motion in
G01 Linear √ N23 G01 X12 Z34 F40 • Move wit
interpolation • Feed valu
G02 Circular √
interpolation
(CW)
G03 Circular √
interpolation
(CCW)
G28 Machine zero Sends any programmed slide to its machine reference (zero) position G28 is not pro
return such as:
N67 G
N67 G
N67 G
ref
the
inte
N222 G28 Z-0
N223 G28 X9
G40 Cutter radius √ It cancels the r
compensation
cancel
G41 Cutter radius √ G41 is used w
compensation to be cut of the
– left G42 is used w
G42 Cutter radius √ to be cut of the
compensation
– right
G43 √ N50 G43 Z1.0 H05 The value registered in H05 is added to all the following
G44 √ Z movements
N55 G44 Z1.0 H06 The value registered in H06 is subtracted from all the
following Z movements
Z1.0 means 1.0 mm target position above the part zero
Programming H00 cancels tool offset
G49 Cancels the G43 or G44
G50 Scaling √
function
cancel
G51 Scaling √
function
G52 Temporary √ G52 Xxx Yyy
shift in the When the cont
active G59) by xx, yy
coordinate
system
O1453
G91 G28 X0 Y0 Z0 (Move the work
M06 101 offset to the 1st
M03 S1000 P.C.D from the
G90 G54 G43 H1
G52 X100 Y100
G54 origin)
G00 X0 Y0
G00 Z5
G16
. (Move the work
. offset to the 2nd
G15 P.C.D from the
G52 X300 Y100 G54 origin)
G00 X0 Y0
G16
G53 Machine G53 G0 X0 Y0 Z0 (Sets the machines datum as the active coordinate system This code tem
Coordinate and moves to that position) system. This c
Selection point for each
G53 will rever
G68 Coordinate
system
rotation
G69 Coordinate
system
rotation
cancel
G73 High speed √
deep hole
drilling cycle
G98 Return to √
initial level in
a fixed cycle
G99 Return to R- √
level in a
fixed cycle