Set the given category of a default element.
    GSErrCode  ACAPI_Element_SetCategoryValueDefault (
        const API_ElemType&           type,
        const API_ElemCategory&       elemCategory,
        const API_ElemCategoryValue&  elemCategoryValue
    );
    
Parameters
- type
- [in] Type of the default element.
- elemCategory
- [in] The category identified by guidorcategoryID.
- elemCategoryValue
- [in] The category value informations to be set.
Return Values
- NoError
- The function has completed with success.
- APIERR_BADPARS
- elemCategoryValueor- elemCategoryis incorrect.
- APIERR_BADID
- Incorrect typewas specified.
For other common API errors see the API Errors document.
Remarks
This function is used to set category information for a default element. For available category types see API_ElemCategoryID.
To get the list of category values in a given category use APIDb_GetElementCategoryValuesID.
 From version 26 the typeID and variationID parameters were merged into a single API_ElemType parameter.
 From version 26 the typeID and variationID parameters were merged into a single API_ElemType parameter.
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: ACAPinc.h
See Also
API_ElemTypeID, API_ElemCategoryID, API_ElemCategory, API_ElemCategoryValue,
APIDb_GetElementCategoryValuesID,
Element Manager, API Functions