APIDb_​GetElementCategoryValuesID

Returns the array of category values in the given category.

    GSErrCode ACAPI_Database (
        APIDb_GetElementCategoryValuesID,
        const API_ElemCategory*             category,
        GS::Array<API_ElemCategoryValue>*   categoryValueList
    );

 

Parameters

category
[in] The category identified by guid or categoryID.
categoryValueList
[out] The array of category values.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
categoryList is nullptr.
APIERR_BADID
Incorrect category was specified (bad guid and categoryID).

For other common API errors see the API Errors document.

 

Example


    GS::Array<API_ElemCategory> categoryList;
    ACAPI_Database (APIDb_GetElementCategoriesID, &categoryList);

    categoryList.Enumerate ([&] (const API_ElemCategory& category) {
        if (category.categoryID == API_ElemCategory_StructuralFunction || category.categoryID == API_ElemCategory_Position || category.categoryID == API_ElemCategory_ElementClassification) {
            GS::Array<API_ElemCategoryValue> categoryValueList;
            ACAPI_Database (APIDb_GetElementCategoryValuesID, (void*) &category, &categoryValueList);
            if (!categoryValueList.IsEmpty ()) {
                if (changeDefaults) {
                    err = ACAPI_Element_SetCategoryValueDefault (element.header.type, category,   categoryValueList[categoryValueList.GetSize () - 1]);
                    if (err != NoError)
                        ErrorBeep ("ACAPI_Element_SetCategoryValueDefault ()", err);
                } else {
                    err = ACAPI_Element_SetCategoryValue (element.header.guid, category,    categoryValueList[0]);
                    if (err != NoError)
                        ErrorBeep ("ACAPI_Element_SetCategoryValue ()", err);
                }
            }
        }
    });

 

Requirements

Version: API 19 or later
Header: APIdefs_Database.h

 

See Also

API_ElemCategory, API_ElemCategoryValue
APIDb_GetElementCategoriesID
ACAPI_Database
API Functions