engiSaveModelByArray

This function saves the model as an array.

Syntax

//
//   Strong typing definition
//
void            engiSaveModelByArray(
                        SdaiModel               model,
                        unsigned char           * content,
                        int_t                   * size
                    );


//
//   Weak typing definition
//
void    __declspec(dllexport) __stdcall   engiSaveModelByArray(
                                                                        int_t                   model,
                                                                        unsigned char           * content,
                                                                        int_t                   * size
                                                                    );
    

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property content

Size: 64 bit / 8 byte (reference)
The content of this IO call, the size of the content is defined by attribute size.

Property size

Size: 64 bit / 8 byte (reference)
The size of the content as defined in number of bytes (size referenced, i.e. IN/OUT value).

Example (based on pure API calls)

Here you can find code snippits that show how the API call engiSaveModelByArray can be used.

#include    "./include/ifcengine.h"
#include    <assert.h>

void    SaveModelByArray(SdaiModel model, wchar_t * fileName)
{
    FILE    * myFileWrite = nullptr;

    _wfopen_s(&myFileWrite, fileName, L"wb");
    if (&myFileWrite) {
        int64_t length = 0;

        engiSaveModelByArray(model, 0, &length);

        unsigned char   * content = new unsigned char[(int_t) length];
        engiSaveModelByArray(model, content, &length);

        fwrite(content, 1, (size_t) length, myFileWrite);
        delete[] content;

        fclose(myFileWrite);
    }
    else {
        assert(false);
    }
}