SetGroupStartingPosition

SetGroupPositionOffset sets the position of a group. Before you move a group, you need to set a starting position for it, or you don't know where it starts. In SetGroupStartingPosition, we set the position to zero for a group. This can be modified depending on your needs. To make sure the position is set successfully, we use GetAGroupPosition to display the position after the setting is done.

Copy

SetGroupStartingPosition

VOID SetGroupStartingPosition(int Group)
{
    //Set the starting positions.
    const int LENGTH = 3;   //Array length. It indicates how many axes in a group.
                            /*Remember to change this value when you change the number of the
                              axes in a group.*/
    double StartingPositions[LENGTH] = { 0 };

    KsCommandStatus Position = WaitForCommand(5, FALSE, SetGroupPositionOffset(Group, LENGTH, 
        StartingPositions, FALSE, mcAxisCoordSystem, mcImmediately));
    if (Position.Error)
        RtPrintf("SetGroupPositionOffset failed: %d\n\n", Position.ErrorId);

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

    GetAGroupPosition(Group);
}