Understanding G27, G28, G29 And G30 - Modern Machine Shop
- Economics 13 Mar 2026 No Slowing Down – Metalworking Index Continues Climb
- Workforce Development 11 Mar 2026 4 Key Growth Opportunities to Boost the CNC Machining Workforce
- Measurement 9 Mar 2026 Achieving More Versatility from Three-Point Gaging
- Measurement 6 Mar 2026 Building a Profitable Grinding Niche
- Automation 4 Mar 2026 Physical AI Eases Automation of High-Mix Manufacturing
- Turn/Mill 2 Mar 2026 Why Setups Are the Real Bottleneck in High-Mix Machining
- SPONSORED 1 Mar 2026 Tool Presetters Reduce Downtime, Human Errors and Scrap
- Grinding 27 Feb 2026 Studer Motion Meeting 2026 Emphasizes Strong Foundations
- Workforce Development 25 Feb 2026 Bridging the Blue-Collar Skills Shortage
- Shop Management Software 23 Feb 2026 Quoting in a Changing Industrial Landscape
Take a closer look at these reference position commands.
- Software
- CNC & Machine Controls
- CNC Tech Talks
- Basics
Mike Lynch Founder and President, CNC Concepts Inc. Share
VISIT SITE VISIT SHOWROOM Komo Machine, Inc.
Komo Machine, Inc. is a leading U.S. manufacturer of advanced, precision CNC machining systems engineered for demanding manufacturing applications. Wi...READ MORE
Featured Content
View MoreFeatured Videos
View More
VISIT SITE VISIT SHOWROOM PrecisionX Group
PrecisionX Group is a leading custom contract manufacturer specializing in precision metal fabrication for critical-use applications across growth-ori...READ MORE
Featured Content
View More
VISIT SITE VISIT SHOWROOM Mayfran International
Mayfran International is the world’s leading provider of quality material handling, filtration, and chip removal solutions. With an unrivaled...READ MORE
Featured Content
View MoreFeatured Videos
View More
VISIT SITE VISIT SHOWROOM Phillips Corporation - Education
Featured Content
View More
VISIT SITE VISIT SHOWROOM Phillips Corporation
Featured Content
View More
VISIT SITE VISIT SHOWROOM GROB Systems, Inc.
For almost 100 years, GROB has been known worldwide for the development and manufacturing of machines and production lines. GROB is a family-owned com...READ MORE
Featured Content
View MoreFeatured Videos
View More
VISIT SITE VISIT SHOWROOM Jergens, Inc.
Manufacturing Efficiency for 75 Years In 1942, Jergens Inc. opened its doors and began its journey to grow into one of the world’s largest m...READ MORE
Featured Content
View MoreFeatured Videos
View More
VISIT SITE VISIT SHOWROOM Haitian Precision USA
Haitian Precision USA has been selling industrial machine tools since 2000 under the Absolute Group of Companies. Absolute started by selling and s...READ MORE
Featured Content
View MoreFeatured Videos
View More
Photo Credit: Getty Images A few months ago I compared using the return to reference (zero return) position (G28) to the motion relative to the machine coordinate system command (G53). I received a few questions regarding other commands related to a machine’s reference position, and I’d like to explain them here.
In order to understand G27, G29 and G30, you must have a firm understanding of G28. This return to reference position is a two-step command. Indeed, if the single block switch is turned on, you must press the cycle start button twice to fully execute a G28 command.
Featured Content
For any axis letter addresses included in the G28 command, the machine first will move (at rapid) to an intermediate position in those axes. Then, it will rapid to the zero return position in the commanded axes. Consider this G28 command:
G91 G28 X1.0 Y2.0 Z1.5
First, the machine will simultaneously move 1.0 (plus) in X, 2.0 (plus) in Y and 1.5 (plus) in Z. This is the intermediate position. Next, all three axes will simultaneously move to the zero return position. A special light—the axis origin light—will be illuminated as each axis reaches the zero return position.
Since most programmers want the machine to go straight to the zero return position, they give this command:
G91 G28 X0 Y0 Z0
Now the intermediate position is nothing in each axis from the current position (incremental motion of zero in each axis), so the machine stays put during the first step of G28. In the second step, all three axes will simultaneously move to the zero return position for each axis.
G27 – Reference position (zero) return check
This command tests whether a positioning movement ends at the zero return position. Consider this command:
G27 G00 X9.5373
If the positioning movement ends with the X axis at its zero return position, the X axis origin light will be lit and the machine will continue. If not, an alarm will be sounded.
I don’t see much need for this command any more. Prior to fixture offsets on machining centers and geometry offsets on turning centers, G92 and G50 were used to assign program zero. With old machines made prior to about 1982, the machine had to be in its planned position in each axis before the cycle could be activated. Many programmers chose the zero return position as the planned starting point.
It was also often important to confirm that a positioning movement truly ended at the zero return position. Consider these commands:
G50 X8.3765 Z10.3776 (Assign program zero; machine is at zero return position) T0101 (Index to station one, invoke offset one) (Machine with this tool) G00 G27 X8.3765 Z10.3776 T0100 (Move to turret index position)
In this example, G27 is being used to confirm that the machine truly ended up at the same position that it started (X and Z values match G50 command and tool offset was canceled).
G29 – Return from reference position
G29 is also a two-step command. First, it causes the machine to move (in the axes commanded) to the intermediate position used in the most recent G28 command. Second, it causes the machine to move to the position included in the G29 command. Consider this command:
G90 G29 X1.0 Y1.0
The machine will first simultaneously move in X and Y to the intermediate position of the most recent G28 command. Then it will simultaneously move to X1.0 and Y1.0 (relative to program zero).
While this could be helpful when you must avoid some kind of obstruction, you must be very careful when using G29. If the intermediate position changes from tool to tool, and if tools are run out of sequence (as is often necessary when rerunning tools), a tool may not move to its expected intermediate position. For this reason, I recommend programming any obstruction-clearing motions with basic positioning commands (G00, G01, etc.), and avoiding G29.
G30 – Return to second reference position
G30 is an optional feature and may not be included on your machines. It works much like G28, except the ending position is now definable through parameter settings. G30 is often used when a machine tool builder must define a special position in each axis, such as with pallet changers on machining centers. The zero return position may not make a good pallet-change position, so the builder may incorporate a second reference position for X and Y. Then, a G30 command is given when a pallet change is required:
G91 G30 X0 Y0
G30 is programmed just like G28. First, the machine moves to an intermediate position (zero from the current position in X and Y, in our case). Second, the machine rapids simultaneously in X and Y to the second reference position.
Again, the physical location for the second reference position is set in parameters, so if you should ever need to incorporate a special reference position, you will be able to do so with G30.
Related Content
Obscure CNC Features That Can Help (or Hurt) You
You cannot begin to take advantage of an available feature if you do not know it exists. Conversely, you will not know how to avoid CNC features that may be detrimental to your process.
Read MoreHow to Determine the Currently Active Work Offset Number
Determining the currently active work offset number is practical when the program zero point is changing between workpieces in a production run.
Read More3 Task Simplifications That Reduce Production Time
A little ingenuity goes a long way toward improving machine utilization.
Read More4 Commonly Misapplied CNC Features
Misapplication of these important CNC features will result in wasted time, wasted or duplicated effort and/or wasted material.
Read MoreRead Next
Modern Machine Shop’s 2026 Top Shops Benchmarking Survey Goes Live Feb. 1
Modern Machine Shop is proud to announce the 2026 Top Shops Benchmarking Survey, opening February 1 through March 31, 2026.
Read More
Loading Why am I seeing this?
The page you’re on features premium MMS editorial content.
To continue enjoying the articles, videos and podcasts from the MMS editorial team, please key in your name and email address, as well as your company and title info. Doing so unlocks MMS’ premium web content on this device.
Why does the gate appear repeatedly for me? If the gate continues to show up on premium content after you’ve already provided your information, it could be for one of these reasons:
- Your cookie settings: Please allow cookies for www.mmsonline.com
- You’re browsing in incognito mode. Switching out of private browsing mode may help.
- You are viewing on a different device or browser. Your login is connected to the browser and device on which you originally unlocked MMS’ premium web content.
Welcome! You’ve unlocked premium content.
If you have time, please tell us a little more about yourself.
Country
Select a country United States of America Canada Mexico OtherIndustries Served
Aerospace/Aviation Appliance Automotive/Transportation Die/Mold Computers / Electrical / Electronics Industrial Machinery & Equipment Medical/Dental Military/Defense Offroad/Construction/Agricultural Oil & Gas Pumps & Valves Renewable EnergyOperations Performed
3DP/Additive Manufacturing CAD/CAM CNC Operations Drilling EDM Five-Axis Machining Gear Cutting & Rolling Grinding High Speed Machining Inspection Laser Cutting Micro Machining Milling Multitasking Machines Robotics & Automation Titanium Machining Turning Waterjet Machining SubmitWelcome to Modern Machine Shop!
Unlimited access to our free premium content requires a little more information from you.
Please enter authentic details to continue
First Name Last Name Job Title Company Email Also, please subscribe me to the MMS Extra and MMS The Shop e-newsletters! Registering RegisterYour email address will be used to communicate with you about Modern Machine Shop subscription offers, related products and services. Refer to our Privacy Policy for more information. Wondering why you’re seeing this? Read more here.
Từ khóa » G30 Trong Cnc
-
G28 G30- Di Chuyển Về Vị Trí Zero (vị Trí Home)
-
TRỞ VỀ TỪ ĐIỂM ZERO MÁY - Kỹ Thuật Chế Tạo
-
Giải Thích Chi Tiết Các Mã Lệnh Trong Lập Trình Phay Cnc Thường Dùng ...
-
Chi Tiết Về Các Mã Lệnh G Trong Máy Phay CNC
-
Cấu Trúc Chương Trình Và Mã Lệnh Trong Lập Trình CNC | Technicalvn
-
TRAINING CNC | Bài 4 G28 - G30 - G90 - G91 CNC CODE - YouTube
-
Một Số Mã Lệnh Cơ Bản Trong Lập Trình Máy CNC
-
Tổng Hợp Các Mã Lệnh Gia Công Trong CNC đầy đủ Nhất
-
Mã G Và Mã M Trong Lập Trình CNC Là Gì?
-
Thiết Lập điểm Thay Dao Cho Máy Tiện CNC Theo ý Muốn - Cammech
-
Hướng Dẫn Lập Trình Tiện CNC Hệ Fanuc - Cammech
-
Các Chữ Cái Chương Trình Có ý Nghĩa Gì Trong Gia Công CNC?