Handling output variables

The measurement and calibration cycles contain output variables that can be used to request the result. There are two options to read out the output variables. They are described in more detail below.

Option 1: Read out the output variables per cycle variables

The first option is to create the V.CYC. output variable in the program calling the cycle. The cycle checks whether this variable already exists. If this is the case, the corresponding result value is written in the existing V.CYC. variable.

Programing Example

prg_example

Read out the output variables per cycle variables

The example describes how to read out the output variables for the cycle "SysCalibTouchprobe1.cyc". Analogously, the procedure can be transferred to all measurement and calibration cycles. In the program calling the cycle, the result values must be written to the file "result.txt". For this purpose, the output variables in which the result value is written on cycle execution are created locally.

%main.nc

#VAR

  V.CYC.SysRetOffsetX

  V.CYC.SysRetOffsetY

  V.CYC.SysRetToolRadius

#ENDVAR

T1 D1

G00 G90 Z0

L CYCLE [NAME=SysCalibTouchprobe1.ecy @P2 = 100]

G00 G90 Z50

#FILENAME[MSG="result.txt"]

#MSG SAVE["Tool Radius = %f", V.CYC.SysRetOffsetX]

#MSG SAVE["Offset in X = %f", V.CYC.SysRetOffsetY]

#MSG SAVE["Offset in Y = %f", V.CYC.SysRetToolRadius]

M30

Option 2: Read out the output variables per subroutine

The post files of the cycles created by the user can also be used to read out the result values. These post files are automatically called at the end of the cycle. The output variables are visible in them.

Diagram of output variables
Diagram of output variables

Programing Example

prg_example

Read out the output variables per subroutine

%main.nc

#VAR

  V.L.ResOffX

  V.L.ResOffY

  V.L.ResRadius

#ENDVAR

T1 D1

G00 G90 Z0

L CYCLE [NAME=SysCalibTouchprobe1.ecy @P2 = 100]

G00 G90 Z50

#FILENAME[MSG="result.txt"]

#MSG SAVE["Tool Radius = %f", V.L.ResRadius]

#MSG SAVE["Offset in X = %f", V.L.ResOffX]

#MSG SAVE["Offset in Y = %f", V.L.ResOffY]

M30

In order for the result values to be transferred to the variables created by the user within the cycle, the post subroutine "SysCalibTouchprobe1Post.nc" must be created by the user. It is then called automatically within the cycle.

%SysCalibTouchprobe1Post.nc

V.L.ResOffX = V.CYC.Offset_X

V.L.ResOffY = V.CYC.Offset_Y

V.L.ResRadius = V.CYC.ToolRadius

M17