Configuring post for local coordinate systems

Examples of local coordinate systems include the Fanuc G92 G-code, Heidenhain's datum shift and G58 on the Siemen's control. The following examples illustrate how to implement local coordinate systems for the Fanuc 18 control.

Program start format
%
:<PROG-NAME><EOB>
{N<SEQ>}G90<EOB>
{N<SEQ>}T<TOOL>M6<EOB>
<IFNOT>[ and( and( eq(<FSHIFTX>,0), eq(<FSHIFTY>,0)), eq(<FSHIFTZ>,0))]
<THEN>
[# ]{N<SEQ>}<MOTION>G<FIXTURE>X<FSHIFTX>Y<FSHIFTY>
Z[<FSHIFTZ>+<ABS-ZRAPID>]<EOB>
[# ]{N<SEQ>}G92 X0 Y0 Z<ABS-ZRAPID><EOB>
[# ]{N<SEQ>}<MOTION>X<X-COORD>Y
<Y-COORD>S<SPEED><SPINDLE><EOB>
<ENDIF>
<IF>[ and( and( eq(<FSHIFTX>,0), eq(<FSHIFTY>,0)),
 eq(<FSHIFTZ>,0))]
<THEN>[# ]{N<SEQ>}<MOTION>G<FIXTURE>X<X-COORD>
Y<Y-COORD>S<SPEED><SPINDLE><EOB>
<ENDIF>
{N<SEQ>}G43H<TOOL>Z<Z-COORD>T<NEXT-TL><EOB>
{N<SEQ>}<COOLANT><EOB>
Tool change format
{N<SEQ>}M09<EOB>
{N<SEQ>}G91G30Z0.M19<EOB>
{N<SEQ>}M06<EOB>
[#]
[# if fixture change, reset G92 to current fixture home before changing to new fixture]
<IFNOT>[ eq(<$FIXTURE>,<FIXTURE>)]<THEN>
[#]{N<SEQ>}<MOTION>X-<$FSHIFTX>Y-<$FSHIFTY>Z[-<$FSHIFTZ>+<ABS-ZRAPID>]<EOB>
[#]{N<SEQ>}G92 X0 Y0 Z<ABS-ZRAPID><EOB>
[#]<IFNOT>[ and( and( eq(<FSHIFTX>,0), eq(<FSHIFTY>,0)), eq(<FSHIFTZ>,0))]
<THEN>
[#]{N<SEQ>}<MOTION>G<FIXTURE>X<FSHIFTX>Y<FSHIFTY>Z[<FSHIFTZ>+ <ABS-ZRAPID>]<EOB>
[#]{N<SEQ>}G92 X0 Y0 Z<ABS-ZRAPID><EOB>
[#]<ENDIF>
<ENDIF>
[#]
[# if same fixture, set new G92 location]
<IF>[ eq(<$FIXTURE>,<FIXTURE>)]<THEN>
[# ]<IFNOT>[ and( and( eq(<@FSHIFTX>,0), eq(<@FSHIFTY>,0)), eq(<@FSHIFTZ>,0))]<THEN>
[#]{N<SEQ>}<MOTION>G<FIXTURE>X<@FSHIFTX>Y<@FSHIFTY>
Z[<@FSHIFTZ>+<ABS-ZRAPID>]<EOB>
[#]{N<SEQ>}G92 X0 Y0 Z<ABS-ZRAPID><EOB>
[#]<ENDIF>
<ENDIF>
{N<SEQ>}<MOTION>G<FIXTURE>G90X<X-COORD>Y <Y-COORD>S<SPEED><SPINDLE><EOB>
{N<SEQ>}G43H<TOOL>Z<Z-COORD>T<NEXT-TL><EOB>
{N<SEQ>}<COOLANT><EOB>
Segment start format
{N<SEQ>}{<MOTION>}Z<Z-COORD><EOB>
[#]
[# if fixture change, reset G92 to current fixture home before changing to new fixture]
<IFNOT>[ eq(<$FIXTURE>,<FIXTURE>)]<THEN>
[#]{N<SEQ>}<MOTION>X-<$FSHIFTX>Y-<$FSHIFTY>Z[-<$FSHIFTZ>+<ABS-ZRAPID>]<EOB>
[#]{N<SEQ>}G92 X0 Y0 Z<ABS-ZRAPID><EOB>
[#]<IFNOT>[ and( and( eq(<FSHIFTX>,0), eq(<FSHIFTY>,0)), eq(<FSHIFTZ>,0))]<THEN>
[#]{N<SEQ>}<MOTION>G<FIXTURE>X<FSHIFTX>Y<FSHIFTY>Z[<FSHIFTZ>+<ABS-ZRAPID>]<EOB>
[#]{N<SEQ>}G92 X0 Y0 Z<ABS-ZRAPID><EOB>
[#]<ENDIF>
[#]{N<SEQ>}{<MOTION>}G<FIXTURE>X<X-COORD>Y <Y-COORD>{S<SPEED>}{<COOLANT>}<EOB>
<ENDIF>
[#]
[# if same fixture, set new G92 location]
<IF>[ eq(<$FIXTURE>,<FIXTURE>)]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