User supplied callback procedure for handling I/O operations.

    typedef GSErrCode  APIIOCommandProc (
        const API_IOParams*     ioParams



[in] This structure contains the various parameters identifying the file to be opened or saved.


Return Values

The function has completed with success.

For other common API errors see the API Errors document.



This is the function which will be called when your add-on installed it with ACAPI_Install_FileTypeHandler.

19  From Archicad 19 you have to enclose the element creation creating in an undoable command scope during a merge file operation.
In case you pass empty string parameter to ACAPI_CallUndoableCommand, Archicad replaces it with the default “Paste” undo string.

6.1  From Archicad 9 merge and open operations can be initiated also with drag & drop:

  • dropping a file of a registered type onto the frame window (on Windows) results an IO_OPEN method call
  • dropping a file of a registered type onto the visible client area of a drawing (floorplan, section, detail) window generates an IO_MERGE operation. In this case the fromDragDrop flag of API_IOParams is set, and the dropOffset field contains the vector that points to the dropping position from the origin.
    The false value in the noDialog parameter means that the drag & drop operation was performed with the right mouse button or with pressing a modifier key (Ctrl on Windows, Alt on the Macintosh).



// -----------------------------------------------------------------------------
// I/O command callback function
// -----------------------------------------------------------------------------
GSErrCode __ACENV_CALL APIIOCommand (const API_IOParams *ioParams)

    GS::UniString path;
    ioParams->fileLoc.ToPath (&path);

    switch (ioParams->method) {
        case IO_OPEN:
            DBPrintf ("Opening file \"%T\"\n", path.ToPrintf ());
            //  ... ACAPI_Element_Create ...

        case IO_MERGE:
            DBPrintf ("Merging file \"%T\"\n", path.ToPrintf ());
            ACAPI_CallUndoableCommand (GS::UniString (fromDragDrop ? "Drop file" : "Merge file"),
                [&] () -> GSErrCode {
                    //  element.pos.x += ioParams->dropOffset.x;
                    //  element.pos.y += ioParams->dropOffset.y;
                    //  ... ACAPI_Element_Create ...

        case IO_SAVEAS:
            DBPrintf ("Saving file \"%T\"\n", path.ToPrintf ());
            //  ... ACAPI_Element_Get ... ACAPI_Element_ShapePrims ...

    return NoError;
}   // APIIOCommand



Version: API 4.1 or later
Header: APIdefs_Callback.h


See Also

API Functions