# Auxiliary function to calculate motion limits in the workpiece coordinate system (#GET WCS POSLIMIT)

The following command calculates the limits of a motion in the current workpiece coordinate system (WCS) in the direction of a programmed motion vector with the components (VC1, VC2, VC3). The vector components need not be specified in standardised form. The basis for path limiting are the axis-specific software limit switches. Based on these values, the controller calculates the motion limits in the current coordinate system.

Syntax:
#GET WCS POSLIMIT [ VC1=.. VC2=.. VC3=.. ]

VC1=.., VC2=.., VC3=.. | Components of direction vector, REAL number

The following global variables read out the result of the calculation for the first three axes in the coordinate system.

V.G.WCS_POSLIMIT_1 | Motion limit in the first main axis in WCS
V.G.WCS_POSLIMIT_2 | Motion limit in the second main axis in WCS
V.G.WCS_POSLIMIT_3 | Motion limit in the third main axis in WCS

## Attention

The programmed motion direction must be absolutely retained for the real executed motion, otherwise the calculated motion limits are incorrect.

In the same way, no rotary axes may be programmed when kinematic transformation (#RTCP) is active.

## Programing Example

Auxiliary function to calculate motion limits in the workpiece coordinate system

N05...

N10 G98 X-100 Y-100 Z-100 (Shift negative software limits)

N20 G99 X200 Y200 Z300 (Shift positive software limits)

N30 #ECS ON (Select effector coordinate system)

N40 # GET WCS POSLIMIT [VC1=0,VC2=0,VC3=1] (Calculate WCS motion limit)

N50 G01 G90 Z=V.G.WCS_POSLIMIT_3 F2000 (Approach WCS motion limit in Z)

N60 #ECS OFF (Deselect effector coordinate system)

N70...

Example of correct use of the command

N05...

N10 #CS ON[0,0,0,0,0,45]

N20 #GET WCS POSLIMIT [VC1=1 VC2=1 VC3=0]

N25 G01 G90 F2000

N30 X=V.G.WCS_POSLIMIT_1 Y=V.G.WCS_POSLIMIT_2 Z=V.G.WCS_POSLIMIT_3

N40 #CS OFF

N50...

Wrong, resulting motion direction does not correspond to setting:

N05...

N10 #CS ON[0,0,0,0,0,45]

N20 #GET WCS POSLIMIT [VC1=1 VC2=1 VC3=0]

N25 G01 G90 F2000

N30 X=V.G.WCS_POSLIMIT_1 Y=V.G.WCS_POSLIMIT_2

N40 Z=V.G.WCS_POSLIMIT_3

N50...

Example of motion limits in the ZX plane in the current WCS