APIAddonObjectSaveOld​FormatHandlerProc

User supplied callback procedure for converting AddOnObjects into previous format.

    typedef GSErrCode  APIAddonObjectSaveOldFormatHandlerProc (
        API_FTypeID                           planFileType,
        const GS::Array<API_AddonObject>&     currentFormatAddOnObjectArray,
        GS::Array<API_AddonObject>&           oldFormatAddOnObjectArray
    );

 

Parameters

planFileType
[in] The old format plan version the project is being saved.
currentFormatAddOnObjectArray
[in] AddOnObject data in current format.
oldFormatAddOnObjectArray
[out] Array for the converted AddOnObject data in old format.

 

Return Values

NoError
The function has completed with success.

For other common API errors see the API Errors document.

 

Remarks

In order to save the add-on’s AddOnObject data in the proper format into a previous version project file, you need to implement this callback function, and pass it to Archicad with ACAPI_Install_AddOnObjectSaveOldFormatHandler during the Initialize phase. It is also necessary to notify Archicad about this capability of the add-on by calling ACAPI_Register_AddOnObjectHandler from the RegisterInterface function.

This handler function is called whenever the user saves the project into an older format, and the add-on has any AddOnObject stored currently into the project. The data should be constructed according to the required version into API_AddonObject structures, and these structures should be pushed into the oldFormatAddOnObjectArray array.

The memory allocated for the converted AddOnObjects by the add-on’s handler function will be released by the caller application.

If you need to delete an AddOnObject (e.g. it cannot be read by a previous version) then simply don’t push it into the array. Order of the converted API_AddonObjects is irrelevant.

You must pay attention to not create more than one API_AddonObjects with the same name if the AddOnObject is Unique.

Because Unique AddOnObjects is an API 21 (API 21 feature) feature, please pay special attention to converting AddOnObjects with UniqueAddOnObject API_AddonObjectType by either setting their type to GeneralAddOnObject or leaving them from oldFormatAddOnObjectArray.

 

Requirements

Version: API 19 or later
Header: APIdefs_Callback.h

 

See Also

API_AddonObject
ACAPI_Install_AddOnObjectSaveOldFormatHandler
ACAPI_Register_AddOnObjectHandler
AddOnObject Manager
API Functions