APIDo_​SaveID

Saves the content of the current window in different file formats.

    GSErrCode ACAPI_Automate (
        APIDo_SaveID,
        API_FileSavePars*     fileSavePars,
        API_SavePars_...*     formatPars
        void*                 resultData
    );

 

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, API_SavePars_Pdf or an API_SavePars_Saf record.
resultData
[out] Parameter for output data. Optionally it can be an API_IFCRelationshipData pointer while saving IFC.

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
APIERR_READONLY
The plan could not be saved either because it’s open in read-only mode, or has never been saved to a file and the fileSavePars is nullptr.

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 .

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;

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");

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, API_SavePars_Saf
ACAPI_Automate, API Functions