Position and Work Offset Functions

Use the position offset functions to set the current program position to specified values, and use the work offset functions to program move targets that are relative to a fixed point in space when you do not know the absolute coordinates of those move targets.

Position Offsets

Use the position offset functions to set the current program position to specified values. When you use position offset functions, an offset is applied to the position of the axis to define a new coordinate system. Motion does not occur. You can clear the position offset manually with the PositionOffsetClear() function or you can home the axis.

Use the functions that follow or the G92 command to set the current program position.

function PositionOffsetSet($axis as axis, $programPosition as real)

Sets the program position of the specified axis to the specified value. The controller applies an offset to the current axis position so that the axis does not move. All moves that specify an absolute target-position will be relative to the new program position.

Arguments

$axis  The axis on which to set the program position.

$programPosition  The new program position to set.

function PositionOffsetSet($axes[] as axis, $programPositions[] as real)

Sets the program positions of the specified axes to the specified values. The controller applies an offset to the current axis positions so that the axes do not move. All moves that specify an absolute target-position will be relative to the new program position.

Arguments

$axes  The axes on which to set the program positions.

$programPositions  The new program positions to set.

You can use program position to set a reference point for a series of moves when the target mode of the task is absolute. To do this, set the program position to zero in the PositionOffsetSet() function. This sets the program position offset to the current axis position, and axes specified with PositionOffsetSet() have a new program position of zero.

When you set the program position to a non-zero value, the offset applied is the difference between the new program position and the original position. This can help find and set a software home position. For example, if an axis has a current position of 2 and PositionOffsetSet() has a new program position of -1, the applied offset is -3. The new software home where the program position reports as zero is actually at axis position 3.

Use the functions that follow or the G82 command to clear the position offsets.

function PositionOffsetClear($axis as axis)

Clears the program position offset on the specified axis. The program position will be restored to the current axis position.

Arguments

$axis  The axis on which to clear the program position offset.

function PositionOffsetClear($axes[] as axis)

Clears the program position offsets on the specified axes. The program positions will be restored to the current axis positions.

Arguments

$axes  The axes on which to clear the program position offsets.

IMPORTANT: When the Home() or HomeAsync() functions complete, all specified offsets are cleared.

Program Example: Position Offsets in a Motion program

// Set the motion target mode to absolute
SetupTaskTargetMode(TargetMode.Absolute)

Enable([X, Y])
Home([X, Y])

// Move the X and Y axes to (3, 3).
// - ProgramPositionCommand = (3, 3)
// - PositionCommand = (3, 3)
MoveLinear([X, Y], [3, 3])

// Set the program position of X and Y to (-1, -3) by setting position offsets.
// No motion occurs.
// - ProgramPositionCommand = (-1, -3)
// - PositionCommand = (3, 3)
PositionOffsetSet([X, Y], [-1, -3])

// Move the X and Y axes to the program position of (0, 0).
// - ProgramPositionCommand = (0, 0)
// - PositionCommand = (4, 6)
MoveLinear([X, Y], [0, 0])

// Clear the position offsets on X and Y. No motion occurs.
// - ProgramPositionCommand = (4, 6)
// - PositionCommand = (4, 6)
PositionOffsetClear([X, Y])

The PositionOffset axis signal tracks the program coordinate system offsets that are in effect when you use the PositionOffsetSet() function. The ProgramPosition, ProgramPositionCommand, and ProgramPositionFeedback axis signals track the program position of an axis. For more information on each position signal, refer to Controller Motion Signals. For examples on how to read a position signal of an axis in your AeroScript program, refer to Controller Status Functions.

Work Offsets

Use work offsets to program move targets that are relative to a fixed point in space when you do not know the absolute coordinates of those move targets. Move targets that you specify in the absolute target mode are relative to this fixed point in space, not to the zero location established by homing. Work offsets have no effect on move targets that you specify in the incremental target mode. You can use the SetupTaskTargetMode() function to change the target mode of the task.

The controller supports 100 work offsets. Work offsets are numbered 1-100.

Use the WorkOffsetConfigureOffset() function to configure the axis program positions that define the origin of the coordinate system for the specified work offset. You can use the WorkOffsetResetConfiguration() function or home the axis to reset all work offsets. You do not have to reset work offsets to configure them again.

function WorkOffsetConfigureOffset($offsetNumber as integer, $axes[] as axis, $programPositions[] as real)

Configures the specified work offset on the specified axes and values. Previously configured axes will retain their values unless overwritten.

Arguments

$offsetNumber  The index of the work offset to configure. An integer between and including 1 and 100.

$axes  The axes on which to configure work offset values.

$programPositions  The program positions to set as the work offset origin.

function WorkOffsetResetConfiguration()

Erases the work offset configurations on all axes. All work offsets must first be disabled.

You can use the WorkOffsetEnable() function or the G54, G55, G56, G57, G58, and G59 commands to enable the work offsets. When you enable a work offset, all absolute moves are relative to the values configured by the work offset. Motion does not occur when you enable work offsets.

IMPORTANT: The WorkOffsetEnable() function lets you specify any one index, but all G-code commands can only enable work offsets 1 - 6.

When you enable work offsets, you do not have to specify the axes.

  • If you do not specify axes, all axes in the work offset configuration will have their configured work offsets applied to the current axis positions.

  • If you do specify axes, only the axes that you specify will have their configured work offsets applied to the current axis positions. The axes you specify must include an axis that already exists in the specified work offset configuration.

function WorkOffsetEnable($offsetNumber as integer)

Activates the specified work offset and applies offsets to all configured axes.

Arguments

$offsetNumber  The index of the work offset to enable. An integer between and including 1 and 100.

function WorkOffsetEnable($offsetNumber as integer, $axes[] as axis)

Activates the specified work offset and applies offsets to the specified axes.

Arguments

$offsetNumber  The index of the work offset to enable. An integer between and including 1 and 100.

$axes  The axes on which to enable the specified work offset.

Use the WorkOffsetDisable() function or the G53 command to disable work offsets on the specified axes. Motion does not occur. You can also home the axis to disable works offsets on the axis. All axes that have work offsets enabled must not be moving for this function to execute correctly.

When you disable work offsets, you do not have to specify the axes.

  • If you do not specify axes, all axes with an active work offset go back to their current axis positions.

  • If you do specify axes, only the specified axes go back to their current axis positions.

function WorkOffsetDisable()

Deactivates all active work offsets.

function WorkOffsetDisable($axes[] as axis)

Deactivates work offsets for all axes on the controller.

Arguments

$axes  The axes on which to disable work offsets.

IMPORTANT: For G-code motion only, to temporarily disable work offsets on a program line, you can specify G153 on that same line. With G153, work offsets stay active.

To get the one-based index of the work offset that is currently being applied to an axis, you must get the WorkOffsetIndex item. To get the work offset value that is currently being applied to an axis, you must get the WorkOffsetValue item. See the example that follows.

Program Example: Use and Get a Work Offset Value

// Set the motion target mode to absolute
SetupTaskTargetMode(TargetMode.Absolute)

Enable([X, Y, Z])
Home([X, Y, Z])

// Configure work offset 1.
WorkOffsetConfigureOffset(1, [X, Y, Z], [10, 10, 10])

// Enable work offset 1 on axes X and Y.
WorkOffsetEnable(1, [X, Y])

// This will return 1, which is the enabled offset.
var $workOffsetIndex
$workOffsetIndex = StatusGetAxisItem(X, AxisStatusItem.WorkOffsetIndex)

// This will return -10, which is the configured value negated.
var $workOffsetValue
$workOffsetValue = StatusGetAxisItem(X, AxisStatusItem.WorkOffsetValue)

// Axes X and Y will move to (10, 10), but Z will not move since it is still at 0.
MoveLinear([X, Y, Z], [0, 0, 0])

// This will disable work offset 1 on axes X and Y but not on Z.
WorkOffsetDisable([X, Y])