APIDo_​SaveID

Saves the appropriate plan view in different file formats. For further info see Remarks.
    GSErrCode ACAPI_Automate (
        APIDo_SaveID,
        API_FileSavePars*     fileSavePars,
        API_SavePars_...*     formatPars
    );
 

Parameters

fileSavePars
[in] Parameters of the saved file; optional, if not passed default settings will be used
formatPars
[in] Parameters of the requested format. It can be either API_SavePars_Archive, API_SavePars_Ifc, API_SavePars_Plandump, API_SavePars_Object, API_SavePars_Picture or an API_SavePars_Pdf record.

Return Values

NoError
The function has completed with success
APIERR_REFUSEDCMD
the function is called from notification level, or you are running a demo version of Archicad
For other common API errors see the API Errors document.

Remarks

This function is used to save the content of the current window in different file formats. This may change in case of API_SavePars_Pdf. It cannot be called from notification level; the command is refused if other addons are running. Calling this function may notify other addons on the event. The caller addon does not get any notification. See the Notification Manager for further details. It cannot be called in the demo version of Archicad either, because the API tries to mimic the behavior of the host system. This function performs complete operations, so it cannot be called neither during undoable operations nor during non-undoable commands. See more details on this topic at Command Overview.

Example


API_FileSavePars        fsp;
API_SavePars_Picture    pars_pict;
GSErrCode               err;

BNZeroMemory (&fsp, sizeof (API_FileSavePars));
fsp.fileTypeID = APIFType_TIFFFile;

IO::Location folderLoc;
API_SpecFolderID specID = API_UserDocumentsFolderID;
ACAPI_Environment (APIEnv_GetSpecFolderID, &specID, &folderLoc);
fsp.file = new IO::Location (folderLoc, "PictTest.tif");

BNZeroMemory (&pars_pict, sizeof (API_SavePars_Picture));
pars_pict.colorDepth = APIColorDepth_256C;
pars_pict.dithered   = false;
pars_pict.view2D     = true;
pars_pict.crop       = true;

err = ACAPI_Automate (APIDo_SaveID, &fsp, &pars_pict);
if (err != NoError) {
    char msgStr[256];
    sprintf (msgStr, "Error in APIDo_SaveID (pict): %d", err);
    ACAPI_WriteReport (msgStr, true);
}

delete fsp.file;

Requirements

Version: API 2.1 or later
Header: APIdefs_Automate.h

See Also

API_FileSavePars, API_SavePars_Archive, API_SavePars_Ifc, API_SavePars_Plandump, API_SavePars_Object, API_SavePars_Picture, API_SavePars_Pdf, ACAPI_Automate, API Functions