G15 And G16 G-Codes [Polar Coordinates And CNC Bolt Circles]
Có thể bạn quan tâm
Table of Contents
- CNCCookbook's G-Code Training: CNC Programming
- What are Polar and Cartesian Coordinates?
- Switching between Cartesian and Polar Coordinates
- Which Mode Does My Controller Use as the Default?
- CNC Bolt Circle Example for Polar Coordinates
- Configuring G-Wizard Editor for Polar Coordinates
- Polar to Rectangular Coordinates Calculator (And Back)
- [ Free Polar Coordinates Calculator ]
- Exercises
- Next Article: Canned Drilling Cycles
CNCCookbook's G-Code Training: CNC Programming
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
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!
CNC Bolt Circle Example for 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:
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:
Polar to Rectangular Coordinates Calculator (And Back)
Need a quick calculator to go from Polar to Rectangular Coordinates and back? We've got you covered:
[ Free Polar Coordinates Calculator ]
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.
4. Want to learn more about Polar Coordinates? See our Polar to Rectangular Coordinate page.
Next Article: Canned Drilling Cycles
You Might Also Like
- Polar to Cartesian Calculator: [Polar Coordinates Calculator]
- Gcode G91 & Gcode G90: CNC Absolute and Incremental Programming
- Quick G-Code Arc Tutorial [Make G02 & G03 Easy]
- CNC Lathe Programming for Turning
- G-Code Coordinate Rotation, Offsets, and Scaling
Be the first to know about updates at CNC Cookbook
Join our newsletter to get updates on what's next at CNC Cookbook.
SubscribeTừ khóa » G16 Phay Cnc
-
Lập Trình CNC Trong Hệ Tọa độ Cực G15 Và G16 - Cammech
-
G15-G16- Chuyển Giữa Hệ Trục Tọa độ Cực Và Tọa độ Đề-các
-
Hướng Dẫn Viết Tay CNC Hệ Tọa Độ Cực G16 G15 Milling Fanuc
-
Lập Trình CNC Trong Hệ Tọa độ Cực G15 Và G16 - Facebook
-
Write A Cnc Milling Program With Commands G16, G15
-
Hướng Dẫn Khoan 8 Lỗ Trên đường Tròn
-
Công Nghệ & Lập Trình Phay Cnc - P2 - Forums
-
Phay CNC
-
Công Cụ Phay CNC BMR02 012 G16 S Tốc độ Cao End Mill Cho ...
-
Công Cụ Phay CNC BMR02-012-G16-S Tốc độ Cao End Mill Cho ...
-
Giải Thích Chi Tiết Các Mã Lệnh Trong Lập Trình Phay Cnc Thường Dùng ...
-
Các Mã Lệnh Code CNC Dùng Trong CAD/CAM | Technicalvn
-
Chương 4 Kỹ THUẬT Lập TRÌNH ( Fanuc 21) CNC - Tài Liệu Text