YCM Alliance
Published

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

Share

person working an CNC

Many of today’s machining centers come with a large quantity of work offsets. FANUC CNCs, for instance, come standard with six sets of work offsets, but they are commonly equipped with at least 48.

Invoking a work offset from within a program is simple. G54 through G59 invoke standard work offsets 1-6. G54.1 P1 through P48 invoke additional work offsets 1-48 — the P-word specifying the work offset number. There may be times when the values in the currently active work offset will need to be determined or modified. This means it will have to be determined which work offset is active from within a given program.

Determining the active work offset may be necessary when the program zero point changes from workpiece to workpiece in a production run due to the nesting method used to locate the workpiece in a fixture. This is a common issue with casting and forgings. A spindle probe might be used to determine the precise program zero location for each workpiece. The currently active work offset may be close (set from the last workpiece), but not precise enough for the next workpiece. The spindle-probing custom macro will not automatically know which work offset has been invoked, yet it must be able to modify its program zero assignment registers for every workpiece being run.

In similar fashion, a spindle probe (or aligning bar) may be used to square up the rotary axis table of a horizontal machining center — or a fixture mounted to the rotary axis — with one of the machine’s linear axes. Once squaring is accomplished, the rotary axis register of the currently active work offset must be modified. If the process is to be automated and universal, the program will have to determine which work offset is currently active.

FANUC system variables are involved with determining the work offset number for the currently active work offset. Which system variable is involved is based upon which work coordinate system set is equipped in the CNC. If the machine has only six work offsets, system variable #4014 returns the numerical value of the currently specified work offset G code (54 through 59). To determine the work offset number, simply subtract 53 from the value of #4014.

If, for instance, G56 is currently instated (work offset 3), the value of #4014 will be 56. Subtracting 53 from 56 renders the work offset number (3).

It gets a little more complicated if the FANUC CNC is equipped with more than six work offsets since personnel could be using G54 through G59 to invoke work offsets 1-6 or G54.1 Pxx to invoke additional work offsets 1-48. The P-word specifies the work offset number. This means it must first be determined which set of work offsets is being used.

System variable #4130 returns the value of the work offset when G54.1 is being used to invoke the work offset. If the current value of #4130 is 0, then G54.1 is not being used. In this case, system variable #4014 can be used to determine the currently active work offset — as previously explained.

On the other hand, if #4130 is greater than 0, G54.1 is being used to invoke the work offset. Again, #4130 will render the work offset number. Consider these commands that can be used to determine which set of work offsets is being used. In either case, local variable #33 will be set to the currently active work offset number.

  • .
  • .
  • IF [#4130 GT 0] GOTO 5 (G54.1 is being used)
  • (G54-G59 is being used)
  • #33=#4014-53 (work offset number – 1-6)
  • GOTO 10
  • N5 (G54.1 is being used)
  • #33=#4130 (work offset number – 1-48)
  • N10 (program continues)
  • .
  • .

Once a user determines which set of work offsets is being used and the currently active work offset number, they can use the data-setting command (G10) to modify registers in the currently active work offset. With G10, an L-word specifies the kind of data being set. Use L2 to specify that data is to be written into one of the G54-G59 work offsets. Use L20 to specify that data is to be written into one of the extended work offsets (again, specified with G54.1 Pxx).

As a more complete example, say a spindle probe has just measured the program zero location in each linear axis. It has stored program zero assignment values in common variables #111, #112 and #113 for the X-, Y- and Z-axes, respectively. Here are commands that will modify the X-, Y- and Z-axis registers of the currently active work offset for a machine that is equipped with both the standard set of work offsets (G54-G59) and the extended set (G54.1 Pxx).

  • .
  • .
  • IF [#4130 GT 0] GOTO 5 (G54.1 is being used)
  • (G54-G59 is being used)
  • #33=#4014-53 (work offset number – 1-6)
  • G10 L2 P#33 X#111 Y#112 Z#113
  • GOTO 10
  • N5 (G54.1 is being used)
  • #33=#4130 (work offset number – 1-48)
  • G10 L20 P33 X#111 Y#112 Z#113
  • N10 (program continues)
  • .
  • .
Campro USA
YCM Alliance
SW North America, CNC Machines and Automation
MMS Made in the USA
715 Series - 5-axis complete machining
More blasting. Less part handling.
TIMTOS
IMTS+
VERISURF
Techspex
KraussMaffei
Koma Precision

Related Content

Workholding

An Additive Manufacturing Machine Shop

Finish machining additively manufactured implants requires different pacing and workflow than cutting parts from stock — different enough for an experienced manufacturer to warrant a dedicated machine shop.

Read More
Turning Machines

4 Commonly Misapplied CNC Features

Misapplication of these important CNC features will result in wasted time, wasted or duplicated effort and/or wasted material.

Read More
Turn/Mill

5 Tips for Running a Profitable Aerospace Shop

Aerospace machining is a demanding and competitive sector of manufacturing, but this shop demonstrates five ways to find aerospace success.

Read More
Five-Axis

CNC Machine Shop Honored for Automation, Machine Monitoring

From cobots to machine monitoring, this Top Shop honoree shows that machining technology is about more than the machine tool.

Read More

Read Next

View From My Shop

Inside Machineosaurus: Unique Job Shop with Dinosaur-Named CNC Machines, Four-Day Workweek & High-Precision Machining

Take a tour of Machineosaurus, a Massachusetts machine shop where every CNC machine is named after a dinosaur! 

Read More
Machines

IMTS 2024: Trends & Takeaways From the Modern Machine Shop Editorial Team

The Modern Machine Shop editorial team highlights their takeaways from IMTS 2024 in a video recap.

Read More
Sponsored

The Future of High Feed Milling in Modern Manufacturing

Achieve higher metal removal rates and enhanced predictability with ISCAR’s advanced high-feed milling tools — optimized for today’s competitive global market.

Read More
Campro USA