CNCCookbook: Be a Better CNC'er

THREE WAYS TO SHARE

G10: Programming Tool and Work Offsets in G-Code

CNCCookbook's G-Code Tutorial

 

Why Program Tool and Work Offsets in G-Code?

In a word--to make g-code programs more idiotproof.

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

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.

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 Syntax for Fanuc 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, so it's just:

G10 L2 P.. X.. Z..

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

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 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.1

- P8 = G59.2

- P9 = G59.2

G10 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:

Conclusion

If you have a repeatable modular fixturing solution on your machine, you need to get familiar with G10. 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: Rotating the Coordinate System With G68 and G69

 
All material © 2010-2016, CNCCookbook, Inc.