This function saves the selected instance and its dependancies in a stream.


//   Visual Studio for Windows
__int64 __declspec(dllexport) __stdcall SaveInstanceTreeS(
            __int64             owlInstance,
            const void          * callback,
            __int64             size

//   Linux, OS-X and non-Visual Studio Windows solutions
int64_t SaveInstanceTreeS(
            int64_t             owlInstance,
            const void          * callback,
            int64_t             size

Property owlInstance

Size: 64 bit / 8 byte (value)
The handle to the specific instance in the design tree. The instance handle is static within one open model but is most probably different when the same instance is opened in another model. The instance is always exactly of one unique class.

Property callback

Size: 32 bit / 4 byte (reference)
The pointer to the function that will be called within this function. Please look at the examples how to create the callback function and how it will be called. In case this is not possible or complex there is an array call, technically the same call, however the callback function is embedded within the library.

Property size

Size: 64 bit / 8 byte (value)
The (maximum) size of the content handled by the callback function.


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

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

const int_t BLOCK_LENGTH_WRITE = 20000; //  no maximum limit
FILE        * myFileWrite = nullptr;

void    __stdcall   WriteCallBackFunction(unsigned char * content, int64_t size)
    fwrite(content, (size_t) size, 1, myFileWrite);

void    SaveInstanceTreeByStream(int64_t myInstance, wchar_t * fileName)
    assert(myFileWrite == nullptr);

    _wfopen_s(&myFileWrite, fileName, L"wb");
    if (&myFileWrite) {
        SaveInstanceTreeS(myInstance, &WriteCallBackFunction, BLOCK_LENGTH_WRITE);

    else {