Mastering G16: Polar Coordinate Programming on CNC Lathes and Mills
In CNC machining, the G16
G-code is used to activate polar coordinate mode. This powerful feature allows you to define positions using a radius and an angle, rather than the traditional Cartesian coordinates (X, Y, Z). This can significantly simplify programming for certain types of features, especially those with circular or radial symmetry. Its counterpart, G15
, cancels polar coordinate mode.
This article provides a comprehensive guide to understanding and using G16
(and G15
) on both CNC lathes (with live tooling) and machining centers. We’ll cover:
- The difference between Cartesian and polar coordinates.
- The general syntax and parameters of
G16
andG15
. - Specific applications and examples for CNC Lathes.
- Specific applications and examples for CNC Machining Centers.
- Control-specific considerations (Fanuc, Siemens, Haas, Mazak, and Mitsubishi).
- Troubleshooting tips.
- The role of CAM software.
Crucial Note: Before using any G-code, always consult the programming manuals for your specific CNC control system and machine tool. The details of polar coordinate programming can vary between manufacturers and control models.
1. Cartesian vs. Polar Coordinates: A Fundamental Difference
- Cartesian Coordinates (X, Y, Z): The standard system. A position is defined by its distances along the X, Y, and Z axes from a defined origin (the work offset, typically
G54
-G59
). This is like using a street address (number and street name). - Polar Coordinates (R, A): A position is defined by:
R
(Radius): The distance from a defined origin (the pole) to the point.A
(Angle): The angle between a reference direction (usually the positive X-axis) and the line connecting the origin to the point. This is like using directions (“go 1 mile northeast”).
2. G16 and G15: Enabling and Canceling Polar Coordinate Mode
G16
: Enables polar coordinate mode. After aG16
command, the control interprets certain axis words as radius and angle values, instead of Cartesian coordinates.G15
: Cancels polar coordinate mode. After aG15
command, the control returns to standard Cartesian coordinate programming.
It is absolutely essential to use G15
to cancel polar coordinate mode when you’re finished using it. Failing to do so will lead to misinterpretation of subsequent coordinate values and potentially dangerous machine movements.
3. General Syntax and Parameters (Focus on Fanuc)
The general syntax on Fanuc and similar controls is:
G16 ; Enable polar coordinate mode
; ... (Program movements using polar coordinates) ...
G15 ; Cancel polar coordinate mode
The active plane (G17
, G18
, or G19
) determines which two axes are used for polar coordinates, after entering the polar coordinate mode using G16
. The active work coordinate system (G54
- G59
) will determine the pole, or center point, of the polar coordinates.
G17
(XY Plane - Milling):X
: Typically represents the radius (R).Y
: Typically represents the angle (A). This is the most common usage on machining centers.
G18
(XZ Plane - Turning):- Highly machine-dependent. On a lathe without live tooling, polar coordinate mode is generally not useful. On a lathe with live tooling,
G18
(XZ plane) selection can be very confusing in polar mode. The best approach, even on a lathe, is almost always to useG17
(XY plane) in conjunction with a virtual C-axis for the angle, even if you don’t have a physical C-axis. Always check your manual. X
: Represents the radius (or, more commonly, the diameter).Z
: Can potentially represent the angle, but this is unusual.
- Highly machine-dependent. On a lathe without live tooling, polar coordinate mode is generally not useful. On a lathe with live tooling,
G19
(YZ Plane):Y
: Typically represents the radius.Z
: Typically represents the angle.
Absolute vs. Incremental Angle (G90
/G91
):
G90
(Absolute Mode): The angle is interpreted as an absolute angle, measured from the reference direction (usually the positive X-axis of the active work offset).G91
(Incremental Mode): The angle is interpreted as an incremental angle, measured from the current tool position’s angle.
The radius is almost always treated as an absolute value from the defined origin (pole) of the polar coordinate system.
4. CNC Lathe Applications and Examples (with Live Tooling)
Polar coordinate mode on a CNC lathe is primarily useful when the lathe is equipped with live tooling (a milling spindle) and a C-axis (or a virtual C-axis). It allows you to mill features on the face of the workpiece, treating the face as if it were an XY plane.
Important: Even on lathes with live tooling, you’ll often use G17
(XY plane selection) for polar coordinate operations on the face. This is because you’re essentially performing a milling operation.
Example 1: Milling a Slot on the Face (Fanuc, G17, Live Tooling):
; Assume workpiece zero (G54) is at the center of the face.
G28 U0 W0 ; Home
T0101 M06 ; Select milling tool
G97 S2000 M03 ; Spindle on (constant RPM - for milling tool)
G00 X0 Z5.0 C0 ; Rapid to a safe position, C-axis engaged
G17 ; Select XY plane <-- IMPORTANT for milling on the face!
G16 ; Enter polar coordinate mode
G01 Z-2.0 F100 ; Feed to depth
X1.0 Y0.0 F5.0 ; Move to starting point (radius 1", angle 0)
G01 Y45.0 ; Mill slot to 45 degrees
G01 Y90.0; Mill to 90 degrees
G00 Z5.0 ; Rapid retract
G15 ; Cancel polar coordinate mode <-- ESSENTIAL!
G28 U0 W0 C0; Home
M30 ; Program end
%
Example 2: Drilling Holes on the Face (Fanuc, G17, Live Tooling):
G28 U0 W0; Home
T0202 M06 ; Select drill
G97 S1500 M03 ; Spindle on
G00 X0 Z5.0 C0 ; Rapid to safe position, C-axis engaged
G17 ; Select XY plane
G16 ; Enter Polar Coordinate Mode
; Drill 3 holes at radius 2", angles 0, 120, and 240 degrees
G81 Z-5.0 R2.0 F100 ; Drilling canned cycle
X2.0 Y0.0 ; First hole
Y120.0 ; Second hole
Y240.0 ; Third hole
G80 ; Cancel drilling cycle
G15 ; Cancel Polar Coordinate Mode
G28 U0 W0 C0; Home
M30;
%
5. CNC Machining Center Applications and Examples
Polar coordinate mode is more commonly used on machining centers than on lathes without live tooling. It’s particularly useful for:
- Bolt Hole Circles: The most common application.
- Radial Slots: Slots arranged radially around a center point.
- Circular Patterns: Any feature that repeats in a circular pattern.
Example 1: Bolt Hole Circle (Fanuc, G17, G90): (This is the same example as in the previous version, but I’m including it here for completeness within the Machining Center section).
O0001 (Bolt Hole Circle - Polar)
G21 G17 G90 ; Metric, XY plane, Absolute
T01 M06 ; Select tool
G00 G54 X50.0 Y50.0 Z10.0 ; Rapid to circle center (using G54)
S2000 M03 ; Spindle on
G16 ; Enter Polar Coordinate Mode
; Drill 6 holes around a circle with radius 25mm
G81 Z-5.0 R2.0 F100 ; Drilling canned cycle
X25.0 Y0.0 ; First hole (radius 25, angle 0)
Y60.0 ; Second hole (radius 25, angle 60)
Y120.0 ; Third hole
Y180.0 ; Fourth hole
Y240.0 ; Fifth hole
Y300.0 ; Sixth hole
G80 ; Cancel drilling cycle
G15 ; Cancel Polar Coordinate Mode <-- ESSENTIAL!
G00 Z10.0 ; Rapid retract
G28 G91 Z0;
M30 ; Program end
%
Example 2: Radial Slots (Fanuc, G17, G91 - Incremental Angle):
O0002 (Radial Slots - Polar)
G21 G17 G90 ; Metric, XY plane, Absolute
T01 M06 ; Select tool
G00 G54 X50.0 Y50.0 Z10.0 ; Rapid to circle center
S2000 M03 ; Spindle on
G16 ; Enter Polar Coordinate Mode
; Mill 4 radial slots, each 10mm long, spaced 90 degrees apart
G01 Z-2.0 F100 ; Feed to depth
X20.0 Y0.0 ; Position at starting radius for the first slot (radius 20, angle 0)
G91 ; Incremental Angle Mode
G01 X30.0 F50 ; Mill slot (radius increases to 50)
G00 X20.0 ; Rapid back
G90 ; Set to Absolute
G01 Y90.0 ; Position for next slot
G91; Incremental Mode
G01 X30.0 ; Mill Slot
G00 X20.0; rapid back
G90; Absolute Mode
G01 Y180.0 ; position for next slot
G91; Incremental
G01 X30.0; Mill Slot
G00 X20.0;
G90;
G01 Y270.0;
G91;
G01 X30.0;
G00 X20.0
G90;
G80 ; Cancel any canned cycles
G15 ; Cancel Polar Coordinate Mode <-- ESSENTIAL!
G00 Z10.0 ; Rapid retract
G28 G91 Z0;
M30 ; Program end
%
6. Combining G16 with Other G-Codes
G00
(Rapid Traverse): Use with caution in polar mode. Movements will be in polar coordinates (radius and angle).G01
(Linear Interpolation): The most common way to move the tool afterG16
is enabled.G02
/G03
(Circular Interpolation): Possible, but center point offsets (I
,J
,K
) are relative to the starting point of the arc, not the polar origin. CAM software is usually better for complex curves in polar mode.- Canned Cycles (G81, G83, etc.): Often used with
G16
for operations like drilling bolt hole circles.
7. Control-Specific Variations
- Fanuc:
G16
to enable,G15
to cancel. Plane selection (G17
,G18
,G19
) is crucial. - Siemens: Siemens uses different commands for polar programming and coordinate transformations (e.g.,
TRANS
,ROTS
,SCALE
,MIRROR
).G15
andG16
are not typically used in the same way as Fanuc. Consult the Siemens documentation for details on polar programming. - Haas: Haas controls might use
G15
andG16
similarly to Fanuc, but always check the manual. They may have alternative methods or specific syntax variations. - Mazak:
- Mazatrol: Polar coordinate programming is handled within the conversational programming environment, not typically with
G15
orG16
. - EIA/ISO: Consult the specific Mazak control documentation.
- Mazatrol: Polar coordinate programming is handled within the conversational programming environment, not typically with
- Mitsubishi: * MELDAS: The function of
G15
andG16
is control-series specific. It is best to avoid using, unless documentation confirms. - Other Controls: Always consult your documentation.
8. Troubleshooting
- Unexpected Movements:
- Forgetting
G15
: The most common error. You must cancel polar coordinate mode. - Incorrect Plane Selection: Using
G16
with the wrong plane active. - Incorrect Radius/Angle Values: Double-check your calculations.
- Incorrect Work Offset: The polar origin is usually the active work offset.
- Forgetting
- Incorrect Coordinate Interpretation: If tool is not moving as expected, ensure that the polar mode is cancelled.
9. CAM Software
For any complex application of polar coordinates, CAM software is highly recommended. The CAM system:
- Allows you to define the geometry in a natural way.
- Automatically generates the correct G-code, including
G16
,G15
, and the appropriate axis movements. - Handles tool compensation.
- Optimizes the toolpath.
10. Frequently Asked Questions (FAQ)
- Q: What’s the difference between G15 and G16?
- A:
G16
enables polar coordinate mode.G15
cancels it.
- A:
- Q: Can I use G16 on any CNC machine?
- A:
G16
for polar coordinate mode is common on Fanuc and compatible controls, but always check your machine’s documentation. Other controls may use different methods.
- A:
- Q: How do I program a bolt hole circle without G16?
- A: You can use a canned cycle (if your control has one specifically for bolt circles), a subprogram with incremental moves and calculations, or (best option) CAM software.
- Q: How does G16 work with G90/G91?
- A: G90 will use an absolute angle, and G91 will use an incremental angle. The radius is generally always absolute.
11. Conclusion
The G16
command enables polar coordinate programming on many CNC lathes (with live tooling) and machining centers, simplifying the creation of features with circular or radial symmetry. G15
is used to cancel polar coordinate mode, and it’s essential to use it to avoid programming errors. While G16
can be useful for simpler tasks, CAM software is generally the preferred method for complex geometries or when working with polar coordinates extensively. Always consult your machine’s and control system’s programming manuals to verify the correct syntax and usage of all G-codes.