Skip to main content
CNC.wiki

G59 Workpiece Coordinate System 6 Selection: CNC Programming Guide

Learn to program G59 Workpiece Coordinate System 6 on Fanuc, Siemens, and Mitsubishi CNCs. Configure parameter offsets and resolve common alarm codes.

Hakan Gündoğdu
Hakan Gündoğdu

CNC CARE Co-founder

Introduction

An incorrectly registered zero offset in the G59 workpiece coordinate system shifts the physical trajectory of the machine's axes, driving the tool tip on the turret or spindle directly into workpiece clamps, a fixture vise jaw, or the rotating jaws of a spindle chuck. When the tool turret indexes and translates along this uncompensated path under a high feedrate command, the cutting tool carrier bypasses established software-defined stroke barriers (such as the G22/G23 chuck and tailstock limits). The operator is met with a sudden hard collision that shatters the carbide cutting tool, bends the axis ball screws, generates a high-current axis-overload alarm code, and converts the raw stock into a completely ruined scrap part. Properly establishing and verifying G59 workpiece coordinate system 6 is critical to maintaining safe physical clearance and avoiding catastrophic shop-floor damage.

Technical Summary

Technical AttributeSpecification
Command CodeG59
Modal GroupModal. Fanuc Group 14 (Milling) / Group 12 (Turning). Siemens Group 3 (Settable Work Offsets). Mitsubishi Group 12.
Supported BrandsFanuc, Siemens, Mitsubishi
Critical ParametersFanuc Parameter 3402 (CLR bit) & Parameter 5040 (TCT bit); Siemens MD 24000 ($MC_FRAME_ADD_COMPONENTS) & MD 28080 ($MC_NUM_USER_FRAMES); Mitsubishi Parameter #1151 (rstint).
Main ConstraintSwitching coordinate systems recalculates compensations dynamically without canceling them. Modifying Fanuc parameter 5040 is blocked under active offsets (triggers Alarm PS0368), Siemens requires MD 24000 enabled for native additive offsets (Alarm 18312), and Mitsubishi updates on screen during single-block stops are delayed until the next block.

Quick Read

  • Setup operators must physically locate the stock and accurately register these dimensions into the G59 registers before initiating automatic cycles to prevent mechanical offset drift.
  • Programmers should command safe retracts to machine coordinate zero (G53 or SUPA) prior to indexing the tool carrier.
  • Toggling Fanuc Parameter No. 5040 Bit 3 (TCT) requires canceling active tool length offsets (G49) first to avoid triggering Alarm PS0368.
  • Siemens systems require the compiler to switch to ISO mode via G291 before executing G10 L2 P6 commands, preventing syntax errors in native mode.
  • Mitsubishi controllers generate Program Error P951 if a workpiece coordinate system shift is commanded while Simple Inclined Surface Control (G176) is active.
  • Operator panel screen updates of G59 registers during a single-block stop only become active in the next block, requiring a dummy block to load coordinates safely.

Basic Concepts

Activating the G59 zero offset on CNC controls shifts the active program coordinate origin from the machine's absolute reference point (MCS) directly to a sixth localized workpiece reference point (WCS). For turning operations, G59 offsets are typically adjusted to compensate for physical coordinates relative to the chuck face. For machining center applications, the offset defines the physical distance from the basic machine zero point to the workpiece origin located on a vise jaw or fixture clamp. This spatial translation allows programmers to establish multiple independent coordinate origins across the machine bed. Operators can machine identical parts sequentially by alternating zero offsets from G54 to G59 and calling a repeating subprogram.

Active cutter radius and tool length compensations remain active during coordinate system transitions. Instead of being canceled, compensation vectors are dynamically recalculated relative to the new G59 origin, allowing the tool to move seamlessly between different workpiece locations without path interruption. However, modifying workpiece offsets during execution requires cautious timing. On Mitsubishi controls, if the G59 offset register is modified on the operator panel during a single-block stop, the new coordinates only become active from the subsequent block. Resuming cycle execution immediately causes the axes to position based on the old offset values, resulting in an uncompensated tool path that risks crashing into workholding equipment.

Command Structure

The G59 command selects the sixth adjustable workpiece coordinate system. Once commanded, all subsequent absolute positions are evaluated relative to this coordinate origin. G59 is modal and remains active in the memory until replaced by another coordinate offset selection or cleared by reset default configuration.

Offset registers can also be updated programmatically within the NC code by using G10 programmable data input commands. This allows coordinates to be updated dynamically without manual operator entry. The address syntax varies between milling and turning systems, as well as the active language compiler mode.

; Machining Centers (Milling):
G90 G59 G00 X__ Y__ Z__ ;

; Lathe Systems (G-code System A): G59 X__ Z__ ; (Absolute) G59 U__ W__ ; (Incremental)

; Programmable Offset Update (ISO Dialect / Fanuc): G90 G10 L2 P6 X__ Y__ Z__ ;

Address / SymbolRole in CommandApplication Context
X, Y, ZAbsolute position target coordinates.Specifies axial destinations evaluated from the G59 origin.
U, WIncremental axis coordinates.Lathe turning (G-code System A) incremental displacements.
G10Programmable data input command.Instructs the NC processor to write data to offset registers.
L2Offset data input register group.Specifies WCS offset data setting in G10 blocks.
P6Coordinate register selection code.P6 maps directly to G59 (workpiece coordinate system 6).

Brand Applications

Fanuc

Fanuc controls require specific parameter configurations to manage zero offsets. Parameter 3402 Bit 6 sets the clear state of modal G-codes at power-up or reset. Parameter 5040 Bit 3 must be set to 1 to enable tool length compensations.

In Fanuc programs, G59 is commanded in absolute mode with rapid traverse: G90 G59 G00 X150.0 Y100.0 Z50.0 ;. Programmable offset updates are written using: G90 G10 L2 P6 X-350.0 Y-200.0 Z-50.0 ;.

  • Parameter No. 3402 (Bit 6 - CLR): Sets whether WCS modal state is cleared or retained on reset.
  • Parameter No. 5040 (Bit 3 - TCT): Enables tool length compensations (G43/G44).
  • Parameter No. 5431 (Bit 0 - MDL): Assigns G60 unidirectional positioning modal group.
  • Alarm PS1144: Triggered when a tool selection T code is programmed inside a G10 block.
  • Alarm PS0368: Triggered when modifying TCT while tool offsets are active.
  • Version Differences: Lathe G-code System A uses absolute X/Z and incremental U/W directly; Systems B and C use modal G90/G91 switches. Legacy Series 15 format parses canned cycles differently than Series 16i/18i/21i.

Warning: Operators must verify that tool length compensation is canceled using G49 before modifying Parameter 5040, or Alarm PS0368 will halt the control.

Siemens

Siemens controls handle G59 zero offsets using MD 28080, which defines the total number of user-settable offsets in memory. Setting MD 24000 to 1 enables the fine offset component.

To select the offset in native Siemens mode, program G59 in a separate block: G59 Z-1.5 ;. In ISO dialect mode (G291), offsets are updated using: G10 L2 P6 X-300.0 Y-200.0 Z-50.0 ;.

  • MD 28080 $MC_NUM_USER_FRAMES: Defines the total global settable offsets (G54 to G599).
  • MD 24000 $MC_FRAME_ADD_COMPONENTS: Enables fine zero offset components (must be 1 for G59 native mode).
  • MD 18800 $MN_MM_EXTERN_LANGUAGE: Activates external NC language interpreter for ISO G-codes.
  • MD 20734 $MC_EXTERN_FUNCTION_MASK: Bit 13 forces preprocessor stop (STPPRE) during G10 write.
  • MD 10604 $MC_WALIM_GEOAX_CHANGE_MODE: Configures working area limitations during geometry axis switchover.
  • Alarm 18312: Fine offset not configured. Occurs if MD 24000 is set to 0 during G59 native execution.
  • Alarm 14800: Coordinate movement executed after G59 selection when the path feedrate F is zero.
  • Alarm 12080: Syntax error. Caused by programming G10 while the control is in native Siemens mode.
  • Version Differences: SINUMERIK 840D sl supports multi-touch screens and options like multi-edge turning (G51.2/G50.2); 802D sl has MD 10604 locked and lacks Group 20 commands.

Warning: If a movement block is executed immediately after a G59 offset switch and the path feedrate evaluates to zero, the control halts with Alarm 14800.

Mitsubishi

Mitsubishi controls configure WCS reset states using Parameter #1151. Parameter #1274 Bit 5 controls standard versus extended workpiece coordinates.

Select the offset with: G90 G59 G00 X150.0 Y100.0 Z50.0 ;. Write offsets programmatically using system variable registers: #5321 = -500.0 ;.

  • Parameter #1151 rstint: Retains WCS modal state on NC reset (0 = retain).
  • Parameter #1210 RstGmd/bitF: Configures modal G-code reset behavior.
  • Parameter #1274 ext10/bit5: Selects standard WCS (0) or extended WCS (1).
  • Parameter #1003 iunit: Defines coordinate input resolution (B to E) and setting boundaries.
  • Program Error P951: Triggered if WCS selection is commanded while G176 Inclined Surface Control is active.
  • Program Error P438: Local coordinate system setting (G52) commanded during extended WCS on version D4 or earlier.
  • Version Differences: Software version D4 or earlier blocks G52 during extended WCS modes, whereas newer versions allow it. M80V Type B Series blocks extended WCS during high-accuracy modes.

Warning: Programming coordinate system shifts while Simple Tool Center Point Control (G174) or Simple Inclined Surface Control (G176) is active halts execution and triggers Program Error P942 or Program Error P951.

Brand Comparison

Comparison CategoryFanucSiemensMitsubishi
Compiler ArchitectureSingle, native program flow parsing for all coordinate settings.Bilingual toggled compiler (G290 native SINUMERIK / G291 ISO dialect).Dual-format switch compiler (G188 machining center / G189 lathe).
Offset Modification SafeguardsRigid interlock blocking Parameter 5040 (TCT) modification under active offsets (throws Alarm PS0368).Preprocessor stop (STPPRE) forced by MD 20734 Bit 13 when writing offsets via G10.Version-locked check (P438) blocking G52 during extended coordinate modes on version D4 or earlier.
Retraction/SuppressionUses G53 non-modal suppression.Multi-level frame suppression (G53, G153, G500, SUPA).Uses G53 non-modal WCS suppression.
Manual Path Recovery— (no source)Rollback deselects WCS modals.Integrates G127 (Manual Arbitrary Reverse Run) WCS tracking during handwheel rollback.

Technical Analysis

The core architectural divergence between Fanuc, Siemens, and Mitsubishi is rooted in whether the control treats workpiece coordinate offsets as monolithic registers or as stackable frame layers. Fanuc and Mitsubishi utilize a single-register system where G59 represents workpiece coordinate system 6, a monolithic offset relative to the machine coordinate system. Siemens SINUMERIK, in contrast, manages zero offsets as dynamic components of a multi-level frame stack. In native mode, G59 serves as an axial programmable zero offset that replaces the additive fine offset component of the active settable frame. This allows Siemens operators to program micro-adjustments in specific axes without overwriting the baseline coarse offset. For legacy compatibility, Siemens relies on its bilingual compiler, requiring G291 to emulate standard ISO Dialect coordinate selection and G290 to return to native frame operations.

Safety interlocks during offset and coordinate transitions also reveal distinct control designs. Fanuc prevents mathematical errors by enforcing a strict motion-kernel lock on Parameter No. 5040 Bit 3 (TCT), blocking any parameter adjustments while tool length offsets are active and throwing Alarm PS0368. Siemens manages tool offsets independently in its compiler, but guards against look-ahead buffer synchronization mismatches by letting users enable MD 20734 Bit 13. This forces a preprocessor stop (STPPRE) when G10 writes occur, immediately updating the active buffer. Mitsubishi resolves synchronization risks through version-locked checks, blocking G52 local offsets during extended workpiece coordinate modes on older software versions (Program Error P438). Mitsubishi’s integration of coordinate tracking with the manual arbitrary reverse run (G127) also ensures that active G59 offsets are maintained if the operator manually rolls back the tool using the handwheel.

Program Examples

Fanuc G-Code Example

G90 G59 G00 X150.0 Y100.0 Z50.0 ;     Selects G59 WCS 6 and rapid traverses to absolute coordinates
G90 G10 L2 P6 X-350.0 Y-200.0 Z-50.0 ; Programmably updates G59 WCS (P6) offset registers
G59 U-12.0 W-5.0 ;                     Lathe G-code System A: Moves incremental values under G59

dry run

During a dry run of the Fanuc program, the control executes the first block by shifting the active workpiece coordinate system reference from machine home directly to the G59 workpiece origin. The machine axes rapid traverse to absolute coordinates X150.0, Y100.0, and Z50.0. The second block, G10 L2 P6, programmably overwrites the G59 offset registers in the NC memory without triggering immediate axis motion. In the final block, under lathe G-code System A, the controller interprets U and W as incremental displacements relative to the current position, moving the tool carrier incremental distances of U-12.0 and W-5.0 under the active G59 system.

Siemens G-Code Example

G290 ; Switch compiler to native Siemens SINUMERIK mode
G54 G17 G90 G01 X100.0 Y50.0 Z10.0 F1000 ; Select G54 zero offset, XY plane, absolute, linear feed
G59 Z-1.5 ; Replaces additive programmable fine offset component on Z axis
G291 ; Switch compiler to ISO Dialect mode
G10 L2 P6 X-300.0 Y-200.0 Z-50.0 ; ISO Dialect: Programmably load coordinate offsets into G59 register
SUPA G00 Z0 D0 M5 ; Suppress active zero offsets and tool offsets to retract Z-axis safely

dry run

During a dry run of the Siemens program, the control switches the compiler to native mode using G290. The first movement block selects G54 workpiece coordinates and interpolates to absolute coordinates X100.0, Y50.0, and Z10.0 at a feedrate of F1000. In the next block, G59 Z-1.5 replaces the programmable additive fine offset component on the Z-axis, executing a micro-adjust shift without other axis movements. The compiler then toggles to ISO Dialect mode via G291 to process the G10 data setting block, which programmably updates the G59 register offsets in memory. Finally, the program commands SUPA, which temporarily suppresses all active frames, zero offsets, and tool offsets, moving the Z-axis safely back to physical machine coordinate zero.

Mitsubishi G-Code Example

G90 G59 G00 X150.0 Y100.0 Z50.0 ; Selects G59 workpiece coordinate system and rapid positions
G90 G10 L2 P6 X-500.0 Y-300.0 Z-100.0 ; Updates G59 register programmatically via G10
#5321 = -500.0 ; Directly updates X axis G59 offset register using system variable

dry run

During a dry run of the Mitsubishi program, the controller selects workpiece coordinate system 6 using G59 and rapid traverses the tool to absolute coordinates X150.0, Y100.0, and Z50.0. The G10 L2 P6 command executes to programmably rewrite the G59 workpiece zero coordinates in memory. In the final block, the system variable write #5321 directly updates the X-axis offset value to -500.0. Because offset register changes made during execution only become valid starting from the subsequent block, the axes do not perform movement during this block write, requiring a subsequent motion command to apply the coordinate shift.

Error Analysis

BrandAlarm CodeTrigger ConditionOperator SymptomRoot Cause / Fix
FanucAlarm PS1144 ("G10 FORMAT ERROR")Commanding a tool selection T code inside a G10 programmable offset input block.The program aborts immediately at the G10 block, and the screen displays the format error message.Remove the T code from the G10 data setting block. Perform tool changes in a separate program block.
FanucAlarm PS0368Modifying tool length compensation parameter TCT (Parameter No. 5040 Bit 3) while tool offsets are active.Control halts and throws a system error during parameter adjustment.Deactivate all active tool offsets by commanding G49 before executing parameter updates.
SiemensAlarm 18312 ("frame: Fine offset not configured")Programming G59 native fine shift while machine data parameter MD 24000 (FRAME_ADD_COMPONENTS) is set to 0.NC interpreter halts block execution and displays fine offset configuration error.Set machine data parameter MD 24000 to 1, enabling the fine offset frame components.
SiemensAlarm 14800Commanding a coordinate movement under G59/G58 offsets when the path feedrate F evaluates to zero.Axis motion halts instantly, displaying a zero feedrate warning.Program a valid non-zero feedrate (F word) or verify that fixed feedrates are enabled in control settings.
SiemensAlarm 12080 ("Syntax error")Executing ISO G10 commands in native Siemens mode (G290).Program scanning stops, indicating an unrecognized command or syntax error.Switch compiler to ISO mode by commanding G291 before executing G10 blocks.
MitsubishiProgram Error (P35)Executing G10 L2 Pn with an out-of-range P7+ argument or an axial offset exceeding maximum limits.Program execution halts, displaying a data entry error.Use correct P value (P0 to P6) and verify coordinate values are within travel limits.
MitsubishiProgram Error (P951)Selecting G59 workpiece coordinate system while Simple Inclined Surface Control (G176) is active.Motion halts, displaying coordinate selection error.Deactivate G176 inclined surface control before calling a new workpiece coordinate system.
MitsubishiProgram Error (P438)Commanding G52 local coordinate setting during active extended coordinate mode on software version D4 or earlier.Control halts cycle execution and raises program error.Upgrade control system software version or cancel the extended coordinate mode before selecting G52.

Application Note

Catastrophic machine crashes, shattered carbide tools, and bent ball screws are the direct consequences of executing movements under incorrectly registered G59 workpiece coordinate offsets. If a setup operator registers inaccurate dimensions on the control panel, subsequent absolute commands run with a physical shift, causing the tool tip to travel on an uncompensated path. Under these conditions, the tool carrier can index and translate directly into fixture clamps, vise jaws, or a rotating spindle chuck, bypassing software-defined barriers like the G22/G23 tailstock limits. To mitigate these risks, setup operators must physically verify zero offsets using edge-finders and run the initial program cycles in single-block mode with dry-run active. Programmers can also define working area limits (using G25/G26 on Siemens or WALIMON) to establish virtual travel envelopes that force an emergency stop before a physical collision occurs.

Related Command Network

  • G54 to G58: Standard adjustable workpiece coordinate systems 1 through 5, which function as the preceding offsets in the same modal group as G59.
  • G53: Machine coordinate system selection command that temporarily suppresses active workpiece zero offsets to reference absolute machine zero during tool changes or axis retractions.
  • G52: Local coordinate system command that establishes a temporary, child offset relative to the active G59 workpiece coordinate system.
  • G10: Programmable data input command used to update the G59 coordinate offset registers directly from within the NC program.

Conclusion

Rigorous verification of the G59 workpiece coordinate system registers prior to executing automatic cycles is the primary defense against shop-floor collisions. Programmers must ensure all active tool compensations are retracted safely to machine zero using G53 commands before tool indexes, while setup operators must verify register values to keep toolpaths aligned with the raw stock.

FAQ

How do you programmatically modify G59 offset values?

To update the G59 registers programmatically, execute a G10 L2 P6 block followed by the new coordinate values. On Siemens controls, you must first switch the compiler to ISO mode using G291 before commanding G10, then return to native mode using G290 to prevent syntax errors. Always perform a preprocessor stop after writing offsets to ensure the new values synchronize with path planning.

Why does a G59 selection command trigger a zero feedrate alarm?

On Siemens controls, selecting G59 followed by a linear motion command (G01) without defining a feedrate triggers Alarm 14800 because the control cannot calculate axis velocities. Program a feedrate (F word) in or before the motion block, or ensure that fixed feedrates are enabled on the operator panel to allow the axes to move.

What is the safety risk of altering WCS offsets during a single-block stop?

Changing offset values on the control panel screen during a single-block stop does not apply the shift immediately. On Mitsubishi controls, the new offset only becomes valid in the subsequent program block, so resuming execution immediately causes the tool to travel along the old offset path. Programmers must include an explicit block stop or dummy motion block after any offset update to force the controller to load the new values before the tool approaches workholding.

Still not resolved?

Ask our AI assistant about this topic in natural language. Grounded in verified sources, no hallucinations.

Ask AI Assistant
Hakan Gündoğdu
Hakan Gündoğdu
  • CNC CARE Co-Founder (May 2025 - Present)
  • Mitsubishi Electric NC Sales & Service Section Manager (2008 - 2025)
  • Reis CNC Service Engineer (2003 - 2008)
  • Ören Kalıp CNC Mold Line Team Leader (1999 - 2002)

With over 25 years of experience working in all areas of the CNC machine industry, I continue my activities as a co-founder of CNC CARE, where we offer brand-independent consulting, engineering, and original spare parts services.

Related Articles

Other articles on this topic