Get the state of a group

GetGroupState gets the state of a group. When you use GetGroupState, it returns a number that represents the state your axis in, not a string. To know what this number means, you need to check the GroupState type. In GetAGroupState we use an array to store the strings for each group state, and convert the number to the string, so that you know what state a group is in immediately.

Copy
GetAGroupState
VOID GetAGroupState(int Group)
{
    //The group state's value starts from 2.
    string groupState[8] = { "NULL", "NULL", "groupErrorStop", "groupDisabled",
        "groupLocked", "groupStandStill", "groupHoming", "groupMoving" };

    GroupState state = groupStandStill;

    KsError nRet = GetGroupState(Group, &state);
    if (nRet != errNoError)
        RtPrintf("GetGroupState failed: %x\n\n", nRet);

    else if (nRet == errNoError)
    {
        for (int i = 0; i < 8; i++)
        {
            if (state == i)
            {
                RtPrintf("Group %d is %s.\n\n", Group, groupState[i].c_str());
                break;
            }
        }
    }
}