sdaiSaveModelBNUnicode

This function saves the model (wchar, i.e. Unicode file name). If save operation finished succesfully the return value will be 0, in case of non-zero value: 1 - model is NULL or not recognized as a model handle 2 - file at path location cannot be created/overwritten

Syntax

//
//   Strong typing definition
//
int_t                       sdaiSaveModelBNUnicode(
                                    SdaiModel               model,
                                    const wchar_t           * fileName
                                );

static  inline  int_t   sdaiSaveModelBNUnicode(
                                SdaiModel               model,
                                wchar_t                 * fileName
                            )
{
    return  sdaiSaveModelBNUnicode(
                    model,
                    (const wchar_t*) fileName
                );
}


//
//   Weak typing definition
//
int_t   __declspec(dllexport) __stdcall sdaiSaveModelBNUnicode(
                                                int_t                   model,
                                                const wchar_t           * fileName
                                            );

static  inline  int_t   sdaiSaveModelBNUnicode(
                                int_t                   model,
                                wchar_t                 * fileName
                            )
{
    return  sdaiSaveModelBNUnicode(
                    model,
                    (const wchar_t*) fileName
                );
}
    

Property model

Size: 32 bit / 4 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 fileName

Size: 32 bit / 4 byte (reference)
The file name of the file as available in the file system in Unicode (wchar_t *). The given wchar_t array will not be adjusted. The size of each wchar_t element is depending on the OS, both 16 bit/2 bytes wchar_t elements as well as 32 bit/4 byte wchar_t elements are recognized and supported.

Example (based on pure API calls)

Here you can find code snippets that show how the API call sdaiSaveModelBNUnicode can be used.

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

void    OpenModel(
                const wchar_t   * fileNameIN,
                const wchar_t   * fileNameOUT
            )
{
    //
    //  The advised manner of opening an IFC (or ifcXML) file is by using embedded schema's that can be recognized automatically
    //

    SdaiModel   model = sdaiOpenModelBNUnicode(0, fileNameIN, L"");

    if (model) {
        SdaiInteger entityCount = engiGetEntityCount(model), instanceCount = 0;

        for (SdaiInteger i = 0; i < entityCount; i++) {
            SdaiEntity  entity = engiGetEntityElement(model, i);

            SdaiAggr    ifcInstances   = sdaiGetEntityExtent(model, entity);
            SdaiInteger noIfcInstances = sdaiGetMemberCount(ifcInstances);
                
            instanceCount += noIfcInstances;
        }

        std::cout << "entity count (schema): " << entityCount << "\n";
        std::cout << "instance count (ifc file): " << instanceCount << "\n";

        sdaiOpenModelBNUnicode(model, fileNameOUT);

        sdaiCloseModel(model);
    }
}