1. Special G codes of CNCSpecial G codes of CNC
ProgrammingProgramming
Prepared by
M.Ganesh Murugan
2. Mirror Image On / Off: G15.1 /Mirror Image On / Off: G15.1 /
G50.1G50.1Function 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
4. G68 and G69 - Coordinate SystemG68 and G69 - Coordinate System
RotationRotation
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 andY 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 orY are omitted then zero is assumed.A and B can be used as
synonyms for X andY 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 andY points
are always in an un-rotated system.
When a rotation is in use the X andY axis DROs will be red to remind
the operator that these values are program coordinate values which will
be rotated
5. An ExampleAn Example
G68 X0Y0 R30
M98 P0001
G68 X0Y0 R60
M98 P0001
G68 X0Y0 R120
M98 P0001
G68 X0Y0 R180
M98 P0001
And
O0001
G83 G99 R2 Z-10 Q1 F100
X 20Y-20
<etc >
M99
Note:
• G68 may only be used in the XY plane (G17 mode)
• The effects of changing work offsets when a rotation transformation is in
effect will be non-intuitive so it is wiser not to program this. Indeed care
should be taken proving any program including transformations.
• There is very little standardization of the functions of this code across
different CNC controls so careful checks should be made on code written for
other machines.
• Jogging always takes place in the direction of the machine axes. The tool
path display frame is oriented to the physical axes and will show the part at
the angle at which it will be cut
No relationship between program and
diagram It is just a model
6.
7. G15 and G16 - Exit and Enter PolarG15 and G16 - Exit and Enter Polar
ModeMode
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.0Y2.0
( normal G0 move to 2.0,2.0 )
G16 - start of polar mode.
G01 X1.0Y45
( 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 )
8. Example - Drilling a circle of holesExample - 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.5Y0.6; (go to the center point)
G16; (enable Polar coordinates)
G81 X2.5Y0.0 R0.0 Z-.6 F3;(in G16 mode the X becomes the offset from center
and theY becomes the degrees of rotation from the center)
X2.5Y90;
X2.5Y180;
X2.6Y270;
G15; (cancels the g16)
G80; (cancels the canned cycle)
G01 Z0.0;
G00 X0.0Y0.0;
M30;
Note:
(1) You must not make X or Y moves other than by using G0 or
G1 when G16 is active;
(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
No relationship between program and
diagram It is just a model
9. 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
10. 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
11. 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
12. 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
13. Pattern defined by AnglePattern defined by Angle
02704 (ANGULAR ROW)
N1 G20;
N2 G17 G40 G80;
N3 G90 G54 G00 X2.0Y2.0 S900 M03;
N4 G43 Z1.0 H01 M08;
N5 G99 G81 R0.1 Z-0.163 F3.0;
N6 G91 X3.8637Y1.0353 L6;
N7 G80 M09;
N8 G28 Z0 M05;
N9 G28 X0Y0;
N10 M30;
No relationship between program and
diagram It is just a model