Register or unregister your add-on to be notified if some attributes are deleted and replaced by other attributes.

    GSErrCode  ACAPI_Notify_CatchAttributeReplacement (
        APIAttributeReplacementHandlerProc*    handlerProc



[in] The callback procedure to call when notifications are sent out on replacement of attributes. Specifying nullptr here means you don’t need the notifications any more.


Return Values

The required operation finished successfully.

For other common API errors see the API Errors document.



This function enables the API tool add-on catch the deletion and replacement of the attributes in the project. This operation can be done with the Delete and Replace option in the Attribute Manager dialog.

If you do not need to catch the changes of default settings any longer, please remember to unregister by calling ACAPI_Notify_CatchAttributeReplacement for the required element type with nullptr in the handlerProc parameter.



// -----------------------------------------------------------------------------
// Attribute replacement handler function
// -----------------------------------------------------------------------------
GSErrCode __ACENV_CALL HandleAttributeReplacement (const API_AttributeReplaceIndexTable& table) 
    char    msgStr[256];

    if (table.ContainsKey (API_AttrTypeID::API_BuildingMaterialID)) {
        for (const auto& entry : table[API_AttrTypeID::API_BuildingMaterialID]) {
            sprintf (msgStr, "Changed Material: old index = %d, new index = %d", *entry.key, *entry.value);
            ACAPI_WriteReport (msgStr, false);

    return NoError;
}   // HandleAttributeReplacement

// -----------------------------------------------------------------------------
// Called after the Add-On has been loaded into memory
// -----------------------------------------------------------------------------
GSErrCode    __ACENV_CALL    Initialize (void)

    GSErrCode err = ACAPI_Notify_CatchAttributeReplacement (HandleAttributeReplacement);

    return err;
}   // Initialize



Version: API 26 or later
Header: ACAPinc.h


See Also

API Functions