ImportModel

This function imports a design tree on location fileName.
The design tree will be added to the given existing model.
The return value contains the first instance not referenced by any other instance or zero if it does not exist. In case the imported model is created with SaveInstanceTree() this instance is unique and equal to the instance used within the call SaveInstanceTree().

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall ImportModel(
            __int64             model,
            const char          * fileName
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t ImportModel(
            int64_t             model,
            const char          * fileName
        );    

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 fileName

Size: 32 bit / 4 byte (reference)
The file name of the file as available in the file system in ASCII (char *). The given char array will not be adjusted, on each OS the size of a char element is 8 bit / 1 byte.

Example

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

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

void    MergeModel(int64_t model, char * fileNameIN, char * fileNameOUT)
{
    //
    //  Add content from file into current model 
    //
    ImportModel(model, fileNameIN);

    //
    //  Save original and added content into a new file
    //
    SaveModel(model, fileNameOUT);
}

int main()
{
    int64_t model = OpenModel("c:\\created\\myFileFirstPart.bin");

    if (model) {
        MergeModel(model, "c:\\created\\myFileSecondPart.bin", "c:\\created\\myMergedFile.bin");

        CloseModel(model);
    }
    else {
        assert(false);
    }
}