BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

APIERR_BADWINDOW when save as ifc

Not applicable

I am trying to save as an IFC file in ArchiCAD 22.

But I got the APIERR_BADWINDOW error code from ACAPI_Automate(APIDo_SaveID, &fsp, &pars_ifc).

The following are the parameters entered before running ACAPI_Automate.
GS::UniString filePath = L"C:\\...............ifc";
API_FileSavePars fsp;
API_SavePars_Ifc pars_ifc;
BNZeroMemory(&fsp, sizeof(API_FileSavePars));
BNZeroMemory(&pars_ifc, sizeof(API_SavePars_Ifc));
fsp.fileTypeID = APIFType_IfcFile;
fsp.file = new IO::Location(filePath);
pars_ifc.subType = API_IFC;

I don't know why I got this error.

It works on the computer I've been developing on, but I get errors on a few other computers.
Viktor Kovacs
APIERR_BADWINDOW usually means that the required operation is not possible over the currently opened window type. IFC export works only when you are in a 2D or 3D window, but it doesn't available when you are in, for example, a section window. The API works the same as Archicad, it returns APIERR_BADWINDOW if you are in a window where the command is not available.
Learn and get certified!