APIDo_​OpenID

Opens a new project file.

    GSErrCode ACAPI_Automate (
        APIDo_OpenID,
        API_FileOpenPars*     fileOpenPars
    );

 

Parameters

fileOpenPars
[in] Parameters for opening a project file.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
openPars or openPars->file is nullptr, or openPars->file is not a valid location, or openPars->archiveLib is nullptr if openPars->libGiven is true
APIERR_BADID
openPars->fileTypeID is unknown file type

For other common API errors see the API Errors document.

 

Remarks

This function is used to open an existing project file.

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.

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_FileOpenPars openPars;
BNZeroMemory (&openPars, sizeof (API_FileOpenPars));
openPars.fileTypeID   = APIFType_PlanFile;
openPars.useStoredLib = true;

IO::Location folderLoc;
API_SpecFolderID specID = API_ApplicationFolderID;
ACAPI_Environment (APIEnv_GetSpecFolderID, &specID, &folderLoc);
folderLoc.AppendToLocal ("ARCHICAD Examples");
folderLoc.AppendToLocal ("Residential House");
openPars.file = new IO::Location (folderLoc, "Residential House.pla");

GSErrCode err = ACAPI_Automate (APIDo_OpenID, &openPars, nullptr);
if (err != NoError)
    ACAPI_WriteReport ("Cannot open the file", true);

delete openPars.file;

 

Requirements

Version: API 2.1 or later
Header: APIdefs_Automate.h

 

See Also

API_FileOpenPars, ACAPI_Automate
Notification Manager, API Functions