Skip to main content
CNC.wiki

G50.1 Programmable Mirror Image Cancel: CNC Programming Guide

Learn how to program G50.1 / G51.1 mirror image cancel and ON for Fanuc, Siemens, and Mitsubishi CNC controls. Prevent coordinate deviations and tool collisions.

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

CNC CARE Co-founder

Introduction to Programmable Mirror Image

Failing to activate or cancel coordinate mirroring at the exact mirror center coordinates shifts the workpiece coordinate system, causing the milling spindle or tool turret to travel on an uncompensated path that bypasses established safety zones. The operator sees the machine slide past its expected coordinate bounds, culminating in a catastrophic hard collision where the tool carrier or spindle crashes directly into workpiece clamping devices, a table-mounted clamp, or the rotating spindle chuck. This unexpected impact shatters the carbide cutting insert, damages the axis guides, throws severe overload alarm codes, and turns the raw stock into a ruined scrap part.

Implementing programmable coordinate mirroring enables the automated machining of symmetrical shapes, such as left-hand and right-hand components, from a single master program. The CNC motion kernel dynamically reverses axial signs and path vectors to duplicate geometry without manual math recalculations.

Technical Summary

FeatureSpecification
Command CodesG50.1 / G51.1 (Fanuc, Mitsubishi, Siemens ISO); MIRROR / AMIRROR (Siemens native); G62 (Mitsubishi position-relative)
Modal Group / ModalityGroup 22 modal (Fanuc, Siemens ISO); Group 19 modal (Mitsubishi); Frame transform (Siemens native)
Supported BrandsFanuc, Siemens, Mitsubishi
Critical ParametersFanuc No. 5002 (LWT/LGT) & No. 5000 (GNI); Siemens MD 10610 ($MN_MIRROR_REF_AX) & MD 18800; Mitsubishi Variable #3007 & Parameter #1003
Main ConstraintMirroring cancel must occur at the original mirror center coordinates to prevent coordinate drift. Cannot change tool offsets or switch planes while mirroring is active.

Quick Read: Best Practices

  • Symmetrical machining of left- and right-hand parts can be automated using a single subprogram by mirroring coordinates across a designated centerline.
  • Always activate and cancel programmable mirroring at the exact same coordinate point to prevent persistent coordinate system shifts.
  • Axis inversion automatically reverses circular interpolation direction (G02/G03) and cutter radius compensation vectors (G41/G42) to maintain proper climbing or conventional milling.
  • Avoid programming tool offset changes (G43, wear, or geometry offsets) while mirroring is active to prevent software interlock alarms.
  • Coordinate mirroring does not apply to machine coordinates (G53), and zero return moves (G28/G30) ignore mirroring during the final reference return leg.
  • Verify software parameter settings such as Fanuc Parameter 5000 (GNI) or Siemens MD 18800 before running external programs.

Basic Mirroring Concepts

Implementing the G51.1/G50.1 programmable mirror image function on Fanuc machining centers provides programmers with a powerful mathematical tool to machine symmetrical workpiece shapes, such as left- and right-hand components, using a single base program. Symmetrical profiles can be machined dynamically by establishing the program zero at a central coordinate position, such as the plate center plate. In multi-path machining configurations featuring integrated facing tool posts or a double turret, programmable mirror image can be applied to the basic axes to automate symmetrical cutting across opposing tools. When a single-axis mirror image is applied to the selected working plane, the control automatically reverses the arc interpolation direction (converting G02 to G03, and G03 to G02) and the cutter compensation offset vectors (converting G41 left offset to G42 right offset). This automated path inversion allows operators to utilize identical tool paths while maintaining correct climbing or conventional milling strategies on the mirrored profile.

On Siemens machining centers, programmable mirroring mathematically inverts workpiece coordinate signs with respect to the designated symmetry axis, allowing programmers to machine symmetrical workpiece shapes—such as left- and right-hand plates—using a single subprogram. The practical programming effect is that the CNC motion kernel automatically recalculates the tool center path to execute mirror-image machining. A distinct advantage of the Siemens motion kernel is that coordinate mirroring automatically adjusts path tool radius compensations (swapping G41 left offset to G42 right offset, and G42 to G41) according to the newly inverted machining direction. The same automatic inversion applies to circle directions, translating G02 clockwise moves to G03 counter-clockwise, and G03 to G02. This automated correction ensures that climbing or conventional milling strategies are maintained on the mirrored geometry without manual reprogram blocks, extending tool life and preserving part finish.

Implementing G-code mirror imaging on a Mitsubishi machining center mathematically inverts workpiece coordinate signs with respect to the designated symmetry axis, allowing programmers to machine symmetrical workpiece shapes—such as left- and right-hand plates—using a single subprogram. The practical programming effect is that the CNC motion kernel automatically recalculates the tool center path to execute mirror-image machining. If mirror imaging is applied to only one axis of the designated plane, the control automatically reverses the arc interpolation direction (converting G02 to G03, and G03 to G02) and the tool radius compensation offset vectors (converting G41 left offset to G42 right offset, and G42 to G41). This automated correction ensures that climbing or conventional milling strategies are maintained on the mirrored geometry without manual reprogram blocks, extending tool life and preserving part finish.

Command Structure and Syntax

Programmable mirroring is initiated by defining the axis to mirror and the precise coordinate location of the mirror centerline. This centerline coordinates act as the line of symmetry. Symmetrical movements are generated automatically by the motion kernel based on this offset reference. When the work is complete, a cancel command resets the coordinate system to its unmirrored state.

The cancel block requires the designated axes to be named, but any coordinate values commanded in the cancel block are ignored by the parser. For safety, this cancellation must be commanded when the tool is at the same physical position where mirroring was originally turned on. Executing the cancel command elsewhere results in coordinate system deviation.

The standard syntax structure across platforms is defined below:

  • Fanuc / Mitsubishi / Siemens ISO:
    G51.1 Xx1 Yy1 Zz1 ; (Mirror ON, where X, Y, Z select axes and x1, y1, z1 specify the mirror center axis coordinates)
    G50.1 Xx2 Yy2 Zz2 ; (Mirror Cancel, where X, Y, Z select axes to cancel and x2, y2, z2 are dummy variables)
  • Siemens Native:
    MIRROR X0 (Absolute mirroring center on the X-axis)
    AMIRROR Y0 (Additive mirroring center on the Y-axis)
    MIRROR (Cancel all active coordinate mirroring on all axes)
  • Mitsubishi (Position-Relative):
    G62 X1 Y1 Z1 ; (Relative mirror ON centered at the current tool position)
    G62 X0 Y0 Z0 ; (Cancel relative mirror on designated axes)

Brand Applications: Fanuc, Siemens, and Mitsubishi

Fanuc

Symmetrical profiles are machined dynamically by establishing the program zero at a central coordinate position, such as the plate center. In multi-path machining configurations featuring integrated facing tool posts or a double turret, programmable mirror image can be applied to the basic axes to automate symmetrical cutting across opposing turrets. Tool offset updates are controlled by Parameter No. 5002 and Parameter No. 5001.

The Fanuc command format utilizes G51.1 X_ Y_ Z_ to activate coordinate mirroring around the specified center axis coordinates, and G50.1 X_ Y_ Z_ to cancel mirroring on the designated axes.

CategoryDetails
ParametersParameter No. 5002 (Bit 2: LWT, Bit 4: LGT), Parameter No. 5001 (Bit 6: EVO), Parameter No. 5000 (Bit 3: GNI), Parameter No. 0001 (Bit 1: FCV)
AlarmsAlarm PS0509 (Offset command in mirror mode), Alarm PS0037 (Can not change plane in G41/G42)
VersionsSeries 30i/31i/32i-B Plus (GNI default is 0); legacy Series 16i/18i/21i and 0i-C; Series 15 program format (FCV)

Mirror image commands must always be activated and canceled directly at the original mirror center coordinates to prevent coordinate deviations that bypass barriers, which can drive the tool turret into the workpiece fixture vise jaw or rotating spindle chuck.

Siemens

Symmetrical workpiece shapes, such as left- and right-hand plates, are machined using a single subprogram on Siemens machining centers by mathematically inverting coordinate signs. Frame suppression behavior is configured via MD 10760 and MD 10604.

In Siemens native mode, mirroring is activated via MIRROR X0 (absolute) or AMIRROR X0 (additive), and canceled via a naked MIRROR block. ISO dialect mode uses G51.1 and G50.1.

CategoryDetails
ParametersMD 10610 ($MN_MIRROR_REF_AX), MD 10612 ($MN_MIRROR_TOGGLE), MD 18800 ($MN_MM_EXTERN_LANGUAGE), MD 10760 ($MN_G53_TOOLCORR), MD 10604 ($MC_WALIM_GEOAX_CHANGE_MODE), MD 10706 ($MN_SLASH_MASK)
AlarmsAlarm 61800 (External compiler missing), Alarm 12080 (Syntax error in G291 ISO mode), Alarm 14800 (Zero path velocity following G50.1 cancel block)
VersionsSINUMERIK 840D sl (dynamic channel adjustments) vs. 802D sl (MD 10604 and MD 10706 are hard-locked)

Naked MIRROR cancels mirroring but also clears all other active coordinate transformations in the active frame stack. Programmers must ensure the program zero is defined precisely on the mirror line.

Mitsubishi

The CNC motion kernel recalculates the tool center path to execute mirror-image machining, reversing arc interpolation and tool radius compensation vectors when mirroring is applied to a single axis. Coordinate resolution is defined by Parameter #1003 and system state is stored in Parameter #8211.

G-code mirror imaging is activated using G51.1 X_ Y_ Z_ (mirror center coordinates) and canceled using G50.1 X_ Y_ Z_ (values ignored). Alternatively, relative mirroring is controlled using G62 X1 Y1 Z1 (ON at current position) and G62 X0 Y0 Z0 (OFF).

CategoryDetails
ParametersSystem Variable #3007 (Read-only Mirror Status), Parameter #1003 (iunit), Parameter #8211 (Mirror image software control), Parameter #1151 (rstint), Parameter #1210 (RstGmd bitF)
AlarmsProgram Error P801 (Mirror command during active G43.7 tool position compensation), Program Error P942 (Mirror command during active G43.4/G43.5 TCP), Program Error P941 (G174 simple TCP active), Program Error P952 (G176 simple inclined surface active), Program Error P953 (G53.1 tool axis direction active)
VersionsMachining Center (M system G50.1/G51.1 scaling vs. mirror format) vs. Lathe systems (G188 format switch maps G50.1/G51.1 to Group 19); M800V/M80V series sub-micron centering using Unit E input setting units

Symmetrical cutting can cause severe crashes if G50.1 is not executed at the mirror center. G50.1 and G51.1 must be canceled before calling advanced controls like tool position compensation G43.7 or simple inclined surface control G176.

Brand Comparison Analysis

TopicFanucSiemensMitsubishi
Command ScopeDedicated modal Group 22 G-code commands (G50.1/G51.1).Native frame system transforms (MIRROR/AMIRROR); G50.1/G51.1 available in G291 ISO dialect mode.Dedicated modal Group 19 G-code commands (G50.1/G51.1); G62 for position-relative.
Command Cancel BehaviorG50.1 cancels mirroring of specific axes independently without affecting other groups.MIRROR (naked) deactivates mirroring but cancels all other active transformations in the frame stack.G50.1 cancels mirroring of specific axes; G189 clears Group 19 commands when returning to turning.
Zero Return MaskingG28/G30 returns mask mirroring between intermediate point and machine reference position.Concept of intermediate point masking is omitted.Special G127 modal info block tracks mirroring states dynamically during reverse handwheel tracing.
Interpreter ArchitectureCompiles command sequence natively under single parser system.Bilingual interpreter model; switch via G291 (ISO dialect) and G290 (Siemens native mode).Bimodal switch via G188/G189 which dynamically remaps turn/mill tables and modal codes.
Software Interlock LimitsRigid parameter check (Alarm PS0509) halts execution on tool offset updates in mirror mode.Parameter mask (MD 10760) defines suppression vs retention of tool corrections dynamically.Specific program errors (P801, P942, P941, P952, P953) lock coordinate/TCP/inclined surface modes.

Technical Analysis: Brand and Architecture Differences

Analyzing the mechanical and compiler behavior across these CNC architectures reveals three distinct technical behaviors that separate Fanuc, Siemens, and Mitsubishi controls:

First, Fanuc isolates programmable mirror image within a dedicated modal G-code group (Group 22), whereas Siemens completely omits G50.1/G51.1. Siemens controls do not utilize G-code groups for mirror commands. Instead, Siemens manages mirroring as independent axial components within a dynamic, multi-level coordinate frame stack using the programmable frame commands MIRROR or AMIRROR programmed in separate NC blocks.

Second, Fanuc applies a strict hybrid-motion masking rule to G51.1 during machine zero returns (G28/G30). Under Fanuc rules, if a reference position return is executed while G51.1 is active, the mirror image remains valid strictly from the start point to the intermediate point. However, the mirror image is automatically ignored during movement from the intermediate point to the reference position, allowing the axes to return safely to machine coordinate zero. Siemens has no concept of intermediate point masking, and Mitsubishi relies instead on its specialized modal information storage block to dynamically recover non-modal coordinates during manual handwheel reverse tracing.

Third, Fanuc enforces a rigid, parameter-dependent software interlock (Alarm PS0509) to prevent coordinate drift. If a tool offset or offset value change is specified while programmable mirror image mode is active and coordinate system shifts are enabled (LWT = 1, LGT = 0, or EVO = 1), Fanuc immediately halts execution and triggers Alarm PS0509. Siemens and Mitsubishi controls manage coordinate transitions dynamically during bimodal program format switching (such as G188/G189), resolving modal states via compile-time format checkers rather than throwing hardware-level parameter conflicts.

Program Examples and Dry Run Guidelines

Fanuc Example:

N10 G90 G00 G54 X150.0 Y100.0 ; Position tool at initial coordinate before mirroring
N20 G51.1 X100.0 Y50.0 ; Activate X/Y axis mirroring around mirror center coordinates X100.0, Y50.0
N30 G01 X150.0 Y100.0 F500 ; Machining path (mirrored path in X and Y)
N40 G50.1 X0 Y0 ; Cancel X and Y mirroring at the original mirror center line

Before running production, perform a dry run of the Fanuc program. Verify that the tool coordinates return precisely to the initial starting position after G50.1 cancel is executed. If coordinates deviate, check Parameter No. 5002 (LWT/LGT) and ensure G50.1 is executed at the exact same physical coordinates as G51.1 to prevent any unexpected offset shifting before the spindle approaches fixtures.

Siemens Example:

N10 G17 G54 T01 D01 M03 S1500 ; Select plane, coordinate offset, tool edge, and start spindle
N20 AMIRROR X0 ; Add additive coordinate mirroring on the X-axis (negates X coordinates)
N30 G01 X50.0 Y50.0 F500 ; Machining path with mirrored X coordinates
N40 MIRROR ; Cancel coordinate mirroring on all axes by commanding MIRROR without parameters
N50 G291 ; Switch interpreter to ISO Dialect Mode to compile legacy codes
N60 G51.1 X100.0 Y50.0 ; Activate programmable mirroring on X and Y axes around center X100, Y50
N70 G50.1 X0 Y0 ; Cancel programmable mirroring on X and Y axes (coordinate values are ignored)
N80 G290 ; Switch back to native SINUMERIK mode

Perform a dry run to verify the Siemens native mirroring transition. In native mode, check if the naked MIRROR command successfully cancels the coordinate mirroring without accidentally wiping out necessary offset transformations (such as TRANS or ROT) that should remain active. For ISO mode, ensure the interpreter switch G291 is correctly configured via MD 18800 before running.

Mitsubishi Example:

N10 G90 G00 G54 X150.0 Y100.0 ; Absolute rapid position in normal coordinates
N20 G51.1 X100.0 Y50.0 ; Activates mirror imaging on X and Y axes around center coordinates X100, Y50
N30 G01 X150.0 Y100.0 F500 ; Mirrored path execution
N40 G50.1 X0 Y0 ; Cancels mirror imaging on the X and Y axes (coordinate values are ignored)

Conduct a dry run to verify the Mitsubishi mirroring states. Ensure that no conflicts exist with active tool position compensation G43.7 or Tool Center Point Control (G43.4/G43.5) before activating G51.1. Confirm that System Variable #3007 is cleared after G50.1 cancellation is completed.

Error Analysis and Resolution

BrandAlarm CodeTrigger ConditionOperator SymptomRoot Cause / Fix
FanucAlarm PS0509Tool offset programmed or changed when shift-offset is enabled (LWT=1 or LGT=0) or when EVO=1 during active mirror image.Program halts, CNC screen displays Alarm PS0509, spindle stops.Cancel mirror mode via G50.1 before programming tool offsets, or change parameters.
FanucAlarm PS0037Switch working planes (G17/G18/G19) during active compensation or mirroring modes.Motion stops, PS0037 alarm message is displayed.Deactivate compensation or mirroring before executing plane commands.
SiemensAlarm 61800External CNC system compiler missing. Command G50.1/G51.1 or G291 when MD 18800 is disabled.Execution stops, Alarm 61800 is displayed.Set machine data MD 18800 to 1 to enable the external ISO compiler.
SiemensAlarm 12080Syntax error/Unknown block in G291 ISO Dialect mode when native command is parsed and extern mask Bit 3 is 0.CNC program processing fails, Alarm 12080 is triggered.Correct syntax errors, or set Bit 3 of extern mask parameter to 1.
SiemensAlarm 14800Programmed path velocity is zero. Motion commanded following G50.1 cancel block but no feedrate F is active.Spindle stays on but axis motion halts with Alarm 14800.Ensure a valid feedrate F is commanded before or during the movement block.
MitsubishiProgram Error (P801)Mirror image cancel (G50.1) or ON (G51.1) command issued while G43.7 (Tool Position Compensation) is active.Red error light, program execution halts.Deactivate tool position compensation by commanding G49 before calling mirror commands.
MitsubishiProgram Error (P942)G50.1 or G51.1 commanded while G43.4/G43.5 (Tool Center Point Control) or G174 is active.System stops execution and displays Program Error P942.Cancel tool center point control before commanding mirror image changes.

Application Note: Avoiding Hard Collisions

A critical requirement for ensuring tooling safety during coordinate mirroring is the spatial matching of the activation and cancellation locations. Performing a G50.1 mirror cancellation at coordinate registers other than the original G51.1 mirror center induces a persistent displacement in the machine coordinate system. The tool turret travels along an uncompensated path that bypasses workpiece safety zones, such as the tailstock or chuck barrier. If subsequent movements are executed in proximity to workholding fixtures, this coordinate deviation drives the spindle directly into table-mounted clamps, a workpiece fixture vise jaw, or the rotating spindle chuck. The resulting hard collision shatters the carbide cutting insert, deforms the axis guides, triggers axis overload alarms, and destroys the workpiece. To eliminate this risk, programmers must command the cancellation block G50.1 or MIRROR at the exact center coordinates of the mirror line, or force a complete coordinate reset by executing an absolute positioning command G90 followed by a machine reference zero return (G28 or G30) before the tool approaches the turret change position.

Related Command Network

  • G51.1: Activates programmable mirror image on designated axes around a specified coordinate center.
  • G62: Enables position-relative mirror imaging on Mitsubishi controls centered at the current tool location.
  • MIRROR / AMIRROR: Establishes absolute and additive frame transformations for mirroring on native Siemens controls.
  • g30-reference-position-return: Returns axes to reference zero points, resetting any coordinate shifts caused by off-center mirror cancellations.
  • g40-compensation-cancel: Cancels active cutter compensation, which must be deactivated before plane switching or tool offset adjustments in mirror mode.
  • g50-scaling-cancel-milling: Cancels scaling mode, which shares G-code naming conventions but operates on part size multipliers rather than coordinate symmetry.

Conclusion

Maintaining coordinate system integrity when using programmable mirror imaging requires strict positioning discipline. Always program coordinate cancellation commands at the exact centerline coordinates where the mirroring was initiated. If coordinate shifting occurs, immediately issue a reference zero return block to synchronize the absolute registers and prevent tool crash damage.

Frequently Asked Questions (FAQ)

Why does my CNC machine crash after I cancel the mirror image?

This happens because the mirror cancellation command (G50.1 or MIRROR) was executed at a coordinate position different from the original mirror center, causing a persistent shift in the active coordinate system. To fix this, always call the cancellation block at the original mirror center coordinates, or execute a G28 reference point return before commanding any subsequent tool movements.

How does axis mirroring affect circular interpolation and cutter compensation?

When mirroring is applied to a single axis in the active plane, the control automatically reverses the arc directions (G02 becomes G03, and G03 becomes G02) and swaps cutter compensation directions (G41 becomes G42, and G42 becomes G41). Operators must verify that these automated path inversions match their intended climbing or conventional milling strategies before machining the mirrored profile.

What causes Alarm PS0509 on Fanuc controls during mirrored machining?

This alarm is triggered when a tool offset or offset value change is programmed while mirror imaging is active and offset shift parameters are enabled (such as LWT=1, LGT=0, or EVO=1). Programmers must deactivate the mirror mode via G50.1 before making tool offset updates, or configure the relevant system parameters to allow offsets.

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