G10: Setting Tool and Work Offsets in GCode

Do you want to be a better CNC'er in 37 Seconds?

Get Better Tool Life, Surface Finish, and Material Removal Rates Fast.

It's that easy. You can install and get results now.

G10 G-Code: Quick & Automatic Tool and Work Offsets in G-Code the Easy Way

CNCCookbook’s G-Code Tutorial

 

Why Program Tool and Work Offsets with G10 G-Codes?

It’s simple: G10 g-codes eliminate data entry errors and save setup time.  

Suppose you have a fixture plate on the machine.  It allows you to install fixtures at repeatable known locations.  But, you need to set that up by making sure the work offsets are properly set for the particular fixtures you’re using.  Typically, this requires the operator to set up the work offsets.  But what if that could be automated and made a part of the cnc program?

In that case, the operator mounts the fixture on the fixture plate, loads the correct CNC Program, and presses the Green button.  The first thing the CNC program does is setup the work offsets for the fixture it expects.  If you want to be extra robust and idiotproof, perhaps the next thing it does is verify the correct fixture is in place.  It could do this by asking the operator to verify fixture #<Serial number that’s on the fixture> is there or we can even automate that step by probing for expected features.

Pretty slick, right?

Using G10 to set up Tool and Work Offsets can be a real power tool in your g-code programming arsenal, because it lets you automate things the operator would normally have to take care of manually each time at the CNC Machine’s control panel.

G10 is all about automating manual operations…

You know the drill when you’re setting up the machine for a job:

            – Enter the proper tool offsets in the tool table for any new tools you’ve added to the tool changer (or will be loading manually to run the job).

            – Enter the proper work offsets that your part program expects to find. For a big fixture plate that holds 8 parts, this means going through 8 sets of coordinates by hand and making sure they’re right.

With G10, you can set up either one of those things completely automatically using G-Code.

Setting Up Tool Data from a Tool Presetter and G10 G-Codes

Suppose you’ve got a Tool Presetter. Here’s a typical unit:

A Tool Presetter…

You put the tool in your toolholder, drop the tool holder into the presetter, and measure the tool height and diameter using the presetter. A really nice presetter will then let you push a button and it will output a simple G-Code program that uses G10’s to transfer the values to your CNC Machine’s tool table so you don’t risk making a data entry error doing it manually.

But, you could also write G10’s yourself in a little code snippet to set or change Tool Offsets if you needed to.

G10 G-Code Work Offsets Example: A Big Fixture Plate

If you don’t have a presetter, or if you use a tool touchsetter to set tool offsets automatically right on the machine, you probably won’t get into G10 much for tool offsets. But work offsets are another matter. This can come up all the time.

Let’s say you’ve invested in modular fixturing for your machine. You’ve got a fixture plate sitting on the machine table:

Fixture plate provides repeatability when installing the vises on the machine. Image courtesy of NYCCNC.com.

For example, a Fixture Plate can provide repeatability when installing the vises on the machine. Now if you can ensure those vises wind up in exactly the same place within relatively tight tolerances, why bother indicating part zero and setting up a work offset for each one? The whole point of the modular fixturing is to save you time doing things like that.

What you can do is measure those positions once for a particular location on the plate, and then put that data into a little g-code program that uses G10’s to set up the work offsets on the machine any time you want to use the vises in that configuration.

The savings are even greater when you have a big fixture plate that holds a lot of parts. And, aside from saving time, you’ll       be saving errors. You’re automating away the problem of making a data entry error of some sort.

So let’s take a closer work at the syntax for using G10 so you can see how it works.

G10 G-Code Syntax for Fanuc, Haas and compatible controls

When setting work offsets, the standard G10 syntax on Fanuc controls for mills looks like this:

      G10 L2 P.. X.. Y.. Z..

on a lathe, there’s typically no Y:

If we break it down, the L2 tells the G10 we’re setting standard work offsets. The value of the P-word tells which work offset:

      – P0 = Active coordinate system

      – P1 = G54

      – P2 = G55

      – P3 = G56

      – P4 = G57

      – P5 = G58

      – P6 = G59

What happens with XYZ depends on whether the machine is in G90 (absolute) or G91 (relative) mode.

If it’s G90 (absolute), the XYZ values replace the selected work offset’s values. For example, this code:

G10 L2 P1 X10 Y20 Z0

Will set G54 to X10, Y20, and Z0.

If the mode is G91 (relative), then XYZ offset the current work offset’s coordinates, just as you’d expect.

Accessing Additional Work Offsets in G10 G-Codes

We’ve seen how to access G54..G59, but on most machines there are a lot more work offsets. Accessing them is easy. We can use L20 in the G10:

     G10 L20 P.. X.. Y.. Z..

Now P can be used to select G54.1P1 through G54.1 P48 to pick up another 48 offsets.

Tip:

If you have an older control that doesn’t have very many work offsets, you can use G10 to reuse the available work offsets with different coordinates.

LinuxCNC G10 G-Code Syntax

The G10 syntax for LinuxCNC is pretty similar to Fanuc, just with a little different P-values:

     – P0 = Active coordinate system

     – P1 = G54

     – P2 = G55

     – P3 = G56

     – P4 = G57

    – P5 = G58

    – P6 = G59

    – P7 = G59.

    – P8 = G59.2

   – P9 = G59.2

G10 G-Code Functions in G-Wizard Editor

Our G-Wizard Editor software has extensive G10 functions. You can use its simulator to develop and test your G10 programs and to learn how G10 works.

G-Wizard Editor also has a G10 function that will generate a G10 program based on the Tool Offset information you enter into the Tool Crib:

Generate a G10 program from offset information in the Tool Crib…

So, for example, if you are using a tool presetter that lacks the ability to create G10 programs, you could enter the offsets in GW Editor and use this feature to output a little g-code program to set all the tool offsets for the tools in your ATC.

Conclusion

If you have a repeatable modular fixturing solution on your machine, you need to get familiar with G10 g-codes to unlock the full power of modular fixture. It will allow you to automate setup to an unprecedented degree and avoid manual data entry errors.

Exercises

     1. Get out your machine’s programming handbook and see what the G10 syntax is for it. Which work offsets can you modify with your machine’s G10? All of them, or just a few?

     2. Fire up G-Wizard Editor and create a G10 program that sets up the work offsets for a multi-part fixture (even just 2 vises on the table). Run it to set up work offsets for a part program that makes multiple parts.

Next Article: G51: Scaling the Coordinate System

G10: Setting Tool and Work Offsets in GCode
3 (60%) 2 votes

 

Do you want to be a better CNC'er in 37 Seconds?

Get Better Tool Life, Surface Finish, and Material Removal Rates Fast.

It's that easy. You can install and get results in a matter of minutes.

 

Start Now, It's Free!

Home

Software

  GW Calculator

  GW Editor

  Gearotic

  Conversational

  Deals and Steals

CNC Blog

  Software

  Techniques

  Beginner

  Cool

  Projects

 

Cookbooks

     Feeds and Speeds

     G-Code Tutorial

     CNC Machining & Manufacturing

     DIY CNC Cookbook

     CNC Dictionary

CNC Projects

Resources

     Machinist's Search

     Videos

     Online Groups

     Individuals

     Reference Data

     Books

     CNC Dictionary

     Suppliers

     Tool Brands

Workshop

     Hall of Fame

     Organization: Soon!

 

About

     Customers

     Partners

     Our History

     Privacy Policy

 
All material © 2017, CNCCookbook, Inc.

Pin It on Pinterest

Share This