You are on page 1of 14

Special G codes of CNC

Programming

Prepared by

M.Ganesh Murugan
Mirror Image On / Off: G15.1 /
G50.1
Function and Purpose:-

Mirror image mode can be turned on and off for each axis using G-codes. Higher priority is given to
the mirror image setting with the G-codes over setting by any other methods.

Programming Format

G51.1 X__ Y__ Z__ Mirror image ON

G50.1 X__ Y__ Z__ Mirror image OFF

Detailed:-

 Use the address and coordinates in a G51.1 block to specify the mirroring axis and mirroring center
(using absolute or incremental data), respectively

 If the coordinate word is designated in G50.1, then this denotes the axis for which the mirror image
is to be cancelled .Coordinate data, even if specified, is ignored in that case

 After mirror image processing has been performed for only one of the axes forming a plane, the
rotational direction and the offset direction become reverse during arc interpolation, tool diameter
offsetting, or coordinate rotation

 Since the mirror image processing function is valid only for local coordinate systems, the center of
mirror image processing moves according to the particular counter preset data or workpiece
coordinate offsetting data
Sample Programs
G00 G90 G40 G49 G80
M98 P100
G51.1 X0.0
M98 P100
G51.1 Y0.0
M98 P100
G50.1 X0.0
M98 P100
G50.1 Y0.0
M30.

(SUB PROGRAM O100)


O0100
G91 G28 X0.0 Y0.0
G90 G00 X20.0 Y20.0
G42 G01 X40. D.01F120
Y40. Mirror can also be performed with
X20. M21 – Mirror image along the X axis
M22 – Mirror image along the Y axis
Y20. M23 – Mirror image cancel
G40 X0.0 Y0.0
M99
G68 and G69 - Coordinate System
Rotation
 A rotation transformation can be applied to the controlled point
coordinates commanded by a part program or by the MDI line. To do this
program
G68 X__Y__R__
 The X and Y words specify the center about which the rotation is to be
applied in the current coordinate system. R is the angle of rotation in
degrees with positive values being counter-clockwise.
 If X or Y are omitted then zero is assumed. A and B can be used as
synonyms for X and Y respectively.
 To cancel rotation program G69.
 If a G68 is used while rotation is in operation a G69 is implied before it. In
other words successive G68s are not cumulative and the X and Y points
are always in an un-rotated system.
 When a rotation is in use the X and Y axis DROs will be red to remind the
operator that these values are program coordinate values which will be
rotated
An Example No relationship between program and
diagram It is just a model

G68 X0 Y0 R30
M98 P0001
G68 X0 Y0 R60
M98 P0001
G68 X0 Y0 R120
M98 P0001
G68 X0 Y0 R180
Note:
M98 P0001
• G68 may only be used in the XY plane (G17 mode)
• The effects of changing work offsets when a rotation transformation is in
And
effect will be non-intuitive so it is wiser not to program this. Indeed care
O0001 should be taken proving any program including transformations.
G83 G99 R2 Z-10 Q1 F100 • There is very little standardization of the functions of this code across

X 20 Y-20 different CNC controls so careful checks should be made on code written for
other machines.
<etc > • Jogging always takes place in the direction of the machine axes. The tool
M99 path display frame is oriented to the physical axes and will show the part at
the angle at which it will be cut
G15 and G16 - Exit and Enter Polar
Mode
 It is possible for G0 and G1 moves in the X/Y plane only to specify
coordinates as a radius and angle relative to a temporary center point;
program G16 to enter this mode. The current coordinates of the
controlled point are the temporary center
 Format
G15 to revert to normal Cartesian coordinates
G0 X2.0 Y2.0
( normal G0 move to 2.0,2.0 )
G16 - start of polar mode.
G01 X1.0 Y45
( this will move to X = 2.7071,Y = 2.7071 which is a spot on a circle) (of
radius 1.0 at 45 degrees from the initial coordinates of 2.0,2.0 )
Example - Drilling a circle of holes
 The code below moves to a circle of holes every 90 degrees on a circle of radius
2.5", center X = 0.5, Y = 0.6 and high- speed peck drills to Z = -0.6
G00 Z0.0;
G01 X0.5 Y0.6; (go to the center point)
G16; (enable Polar coordinates)
G81 X2.5 Y0.0 R0.0 Z-.6 F3;(in G16 mode the X becomes the offset from center
and the Y becomes the degrees of rotation from the center)
X2.5 Y90;
X2.5 Y180;
X2.6 Y270;
G15; (cancels the g16)
G80; (cancels the canned cycle)
G01 Z0.0;
G00 X0.0 Y0.0;
M30;

Note:
(1) You must not make X or Y moves other than by using G0 or No relationship between program and
G1 when G16 is active; diagram It is just a model
(2) This G16 is different to a Fanuc implementation in that it uses
the current point as the polar center. The Fanuc version requires
a lot of origin shifting to get the desired result for any circle not
centered on 0, 0
CIRCULAR POCKET MILLING
EXERCISE
• G12 CIRCULAR POCKET MILLING CW (or)
• G13 CIRCULAR POCKET MILLING CCW
X Position to center of pocket
Y Position to center of pocket
Z Depth of cut or increment down
I Radius of First Circle (or the
finish radius If K is not used)
K Radius of Finished Circle
(if specified)
Q Radius step over Increment
(must be used with K)
D Cutter Comp. number
(Enter cutter size into offset display register number)
L Loop count for repeating
deeper cuts
F Feedrate in inch (mm) per min
EXAMPLE: G13 ONE PASS "I" ONLY
O01041
N1 (D01 DIA. OFFSET IS .500)
N2 T1 M06 (1/2 DIA. 2 FLT END MILL)
N3 G90 G54 G00 X2.5 Y2.5 (position
to X Y center of circular pocket)
N4 M03 S2600
N5 G43 H01 Z0.1 M08
N6 G13 Z-0.5 I0.5 D01 F15. (1.0 Dia. x
.5 deep circular pocket 1 pass)
N7 G00 Z1. M09
N8 G28 G91 Y0 Z0
N9 M30
EXAMPLE: G13 MULTIPLE PASSES I,
K&Q
O01042
N1 (D01 DIA. OFFSET IS .500)
N2 T1 M06 (1/2 dia. 2 FLT end mill)
N3 G90 G54 G00 X2.5 Y2.5 (X
Y center location of circular
pocket)
N4 S2600 M03
N5 G43 H01 Z0.1 M08
N6 G13 Z-0.5 I0.3 K1.5 Q0.3 D01 F15
(3.0 Dia. x .5 dp circular pocket)
N7 G00 Z1. M09
N8 G28 G91 Y0 Z0
N9 M30
G18 ZX CIRCULAR PLANE
SELECTION
• The G18 code is used to select the ZX plane for circular motion. In the XZ plane
• (G18), circular motion is defined as clockwise for the operator looking from
the rear of the machine out toward the control panel
Pattern defined by Angle
02704 (ANGULAR ROW)
N1 G20;
N2 G17 G40 G80;
N3 G90 G54 G00 X2.0 Y2.0 S900 M03;
N4 G43 Z1.0 H01 M08;
N5 G99 G81 R0.1 Z-0.163 F3.0;
N6 G91 X3.8637 Y1.0353 L6;
N7 G80 M09;
N8 G28 Z0 M05; No relationship between program and
diagram It is just a model
N9 G28 X0 Y0;
N10 M30;
Thanks

M.Ganesh Murugan