APIDb_​GetElementCategoriesID

Returns the array of categories.

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

 

Parameters

categoryList
[out] The array of categories.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
categoryList is nullptr.

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.typeID, element.header.variationID, 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,
ACAPI_Database
API Functions