SetAxisStartingPosition

SetAxisPositionOffset sets the position of an axis. Before you move an axis, you need to set a starting position for it, or you don't know where it starts. The starting position doesn't have to be zero, but by setting this position to zero, we can tell how far an axis moves at a glance. In SetAxisStartingPosition, we set the position to zero for an axis. This can be modified depending on your needs. To make sure the position is set successfully, we use GetAnAxisPosition to display the position after the setting is done.

Copy

SetAxisPositionOffset

VOID SetAxisStartingPosition(int Index)
{
    //Set the starting positions.
    double setPosition = 0;

    KsCommandStatus Position = WaitForCommand(5, FALSE, SetAxisPositionOffset(Index,
        setPosition, FALSE, mcImmediately));
    if (Position.Error)
        RtPrintf("SetAxisPositionOffset failed: %d\n\n", Position.ErrorId);

    //Wait a few cycles for the set position to be set.
    Sleep(5);

    GetAnAxisPosition(Index);
}