GetInstanceClassEx

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall GetInstanceClassEx(
            __int64             model,
            __int64             owlInstance
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t GetInstanceClassEx(
            int64_t             model,
            int64_t             owlInstance
        );    

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 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.

Example

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

int64_t model = CreateModel();

if (model) {
    //
    //  The following setting makes sure all class handled are in an ordered list
    //  In certain cases where several models are open or in case of conversion
    //  between formats this can be handy and / or time efficient.
    //
    OrderedHandles(model, nullptr, nullptr, nullptr, 1 + 2 + 4, 1 + 2 + 4);

    //
    //  Classes
    //
    int64_t classAbcd = CreateClass(model, "ABCD"),
            classCube = CreateClass(model, "Cube"),
            classMatrix = CreateClass(model, "Matrix");

    //
    //  Instances
    //
    int64_t instanceAbcd = CreateInstanceEx(model, classAbcd, nullptr),
            instanceCube = CreateInstanceEx(model, classCube, nullptr),
            instanceMatrixI = CreateInstanceEx(model, classMatrix, nullptr),
            instanceMatrixII = CreateInstanceEx(model, classMatrix, nullptr);

    assert(GetInstanceClassEx(model, instanceAbcd) == classAbcd);
    assert(GetInstanceClassEx(model, instanceCube) == classCube);
    assert(GetInstanceClassEx(model, instanceMatrixI) == GetInstanceClassEx(model, instanceMatrixII));

    //
    //  The resulting model can be viewed in 3D-Editor.exe
    //
    SaveModel(model, "c:\\created\\myFile.bin");
    CloseModel(model);
}