CNCCookbook: Software and Information for Macihnists

CNCCookbook's G-Code Course

 

 

Polar and Cartesian Coordinates Using G15 and G16

CNCCookbook's G-Code Tutorial

 

What are Polar and Cartesian Coordinates?

Until this point, we've strictly been using Cartesian Coordinates where X, Y, and Z represent distances from part zero (absolute coordinates) or from the current position (relative coordinates). Most g-code programming is done using Cartesian coordinates, but for some problems a system called Polar Coordinates can make the problem much simpler to tackle. With polar coordinates, we use an angle and a distance relative to the origin. Depending on the control, we may have both absolute part zero and current position origins to choose from. This diagram shows us a comparison of the two coordinate systems:

Cartesian vs Polar Coordinates

Cartesian vs Polar Coordinates

When using Polar Coordinates, the angle is expressed in degrees counter-clockwise from the 3 o'clock position as shown in the diagram.

 

Switching between Cartesian and Polar Coordinates

Switching between Cartesian and Polar Coordinates is very simple. G16 is used to switch to polar, and G15 is used to switch back to Cartesian coordinates.

 

Which Mode Does My Controller Use as the Default?

Interestingly, most controls will startup in relative/incremental mode (G91). This is done because it is thought to be safer if the mode is not what you expect. In other words, if you expected absolute it is thought to be safer to start in incremental than if you expected incremental and start in absolute. The truth is, not being in the mode you expect is not safe any way you look at it because the machine will do something unexpected. Therefore, make sure one of the first things you do in your program is to set it to either G90 or G91 so it does what you expect!

 

When Should We Use Polar Coordinates?

While we don't use them very often, polar coordinates can really simplify some problems. Suppose you want to make a bolt circle, a very common operation. You could pull out your calculator and use trigonometry to figure the coordinates of each bolt on the circle. Or, you could use G-Wizard's Bolt Circle Calculator to do the same thing for you. But if your control offers polar coordinates, you have a really easy way to program your bolt circle.

Consider the following example which creates a bolt circle of radius 8 having 6 holes spaced equally around the circle:

O2000 (G15-G16 Polar Coordinate Example)
N1 G20
( Safe Starting Conditions )G0 G40 G49 G50 G80 G94 G90
N2 G17
N3 G00 X0 Y0 S900 M03 (center point)
N4 G43 Z1.0 H01 M08
N5 G16 (polar coordinates on)
N6 G99 G81 X8 Y0 R0.1 Z-0.163 F3.0
N7 X8 Y60.0
N8 X8 Y120.0
N9 X8 Y180.0
N10 X8 Y240.0
N11 X8 Y300.0
N12 G15 (polar coordinates off)
N13 G80 M09
N14 G91 G28 Z0 M05
N15 G28 X0 Y0
N16 M30
%

After establishing some safe starting conditions, the program uses a G00 move to the center point of the bolt circle. For simplicity, we've made that point be 0, 0.

On block N5, we turn on the polar coordinates and on the next line we start our G81 canned cycle. Note the coordinates given: X8 and Y0. We're in polar coordinate mode, so X is the distance from the origin (8 inches) and Y is the angle (0 degrees). That origin is at X0Y0 and was established because as part of the safe conditions, we have set absolute coordinates using G90, so our origin will be at 0, 0.

Now each successive hole is easy--we just keep giving the X8 radius and step around the circle by giving the degrees values using Y. We use 60, 120, 180, 240, and 300 degrees.

Here is our g-code program as simualted by G-Wizard Editor:

G15 G16 Polar Coordinates Bolt Circle

It's hard to imagine a simpler way to visualize or program a bolt circle and you didn't have to do a lick of trigonometry!

This is the sort of thing polar coordinates are good for.

 

Configuring G-Wizard Editor for Polar Coordinates

GWE uses the following post options to configure Polar Coordinates:

GWE Polar Coordinates

 

Exercises

1. Write a g-code program that uses polar coordinates in some way.

2. Dig out the programming book for your controller and read the chapter on polar coordinates so you can see how they work.

3. Configure G-Wizard Editor properly for your controller's use of polar coordinates.

 

Try the Free Trial Version of G-Wizard G-Code Editor...

 

No credit card required--just your name and email.

 

Next Article: Canned Drilling Cycles

 

 

 

 

Home      

 

Software

  GW Calculator

  GW Editor

  Gearotic

  Conversational     

  Deals and Steals

Blog

  Software

  Techniques

  Beginner

  Cool

  Projects

  Webinars

 

 

Cookbooks

     Feeds and Speeds

     G-Code Tutorial

     CNC Machining & Manufacturing

     Lean Manufacturing

     Cost Estimating Software

     DIY CNC Cookbook

     CNC Dictionary

 

CNC Projects

Machines

     CNC Mill Retrofit

     Plasma Table

     Welding

      3D Printers

     

Resources

     Machinist's Search

     Videos

     Online Groups

     Individuals

     Reference Data

     Books

     Suppliers

     Tool Brands

Workshop

     Hall of Fame

 

About

     Support

     Customers

     Partners

     Our History

     Cheapskate Page

     Privacy Policy

 
All material © 2010-2014, CNCCookbook, Inc.