Programming reference

programmingReferenceSet

programmingReferenceSet(value:= ReferenceType)

As an alternative to G90/G91, programmingReferenceSet can be used to set the dimensions of the subsequent movement commands to absolute or relative.

programmingReferenceGet

ReferenceType := programmingReferenceGet()

The currently active dimension for the movement commands can be read out with programmingReferenceGet.

ReferenceType

Enumeration of the following values:

referenceAbsolute
referenceRelative

Example

programmingRefGet/Set is particularly recommended for functions. At the start of a function, the currently set dimension can be read out with programmingRefGet before it is set to the dimension of the function with G90/G91 or programmingRefSet. At the end of the function, programmingRefSet is used to ensure that the dimension is reset.

{
FUNCTION TestFunction
VAR
    programmingRef : ReferenceType;
END_VAR

    programmingRef := programmingReferenceGet();
    programmingReferenceSet(value:= referenceRelative);

    !N21 G01 X10 Y-10
    !N22 G01 X10 Y-10

    programmingReferenceSet(value:= programmingRef);

END_FUNCTION
}

N10 G00 X0 Y0 Z0
N20 G01 G90 X100 Y20 F6000

!TestFunction();

N30 G01 X100 Y30
M30

Requirement

TwinCAT

TwinCAT V3.1.4024.54