RemoveInstances

This function removes all available instances for the given model from the internal structure.
Return value is the number of removed instances.

Syntax

//
//   Strong typing definition
//
int64_t         RemoveInstances(
                        OwlModel                model
                    );


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall RemoveInstances(
                                                int64_t                 model
                                            );
    

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.

Example (based on pure API calls)

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

#include    "./include/engine.h"

int64_t model = CreateModel();

if (model) {
    //
    //  Classes
    //
    int64_t classCube = GetClassByName(model, "Cube"),
            classCylinder = GetClassByName(model, "Cylinder"),
            classMatrix = GetClassByName(model, "Matrix"),
            classTransformation = GetClassByName(model, "Transformation");

    //
    //  Object Properties (relations)
    //
    int64_t propertyMatrix = GetPropertyByName(model, "matrix"),
            propertyObject = GetPropertyByName(model, "object");

    //
    //  Datatype Properties (attributes)
    //
    int64_t property_42 = GetPropertyByName(model, "_42"),
            propertyLength = GetPropertyByName(model, "length"),
            propertyRadius = GetPropertyByName(model, "radius");

    //
    //  Instances (creating)
    //
    int64_t instanceCube = CreateInstance(classCube, nullptr),
            instanceCylinder = CreateInstance(classCylinder, nullptr),
            instanceMatrix = CreateInstance(classMatrix, nullptr),
            instanceTransformation = CreateInstance(classTransformation, nullptr);

    SetObjectProperty(instanceTransformation, propertyObject, &instanceCylinder, 1);
    SetObjectProperty(instanceTransformation, propertyMatrix, &instanceMatrix, 1);

    double  lengthCube = 2.1,
            lengthCyl = 2.8,
            radiusCyl = 1.3,
            offsetY = -1.2;

    SetDatatypeProperty(instanceCube, propertyLength, &lengthCube, 1);
    SetDatatypeProperty(instanceCylinder, propertyLength, &lengthCyl, 1);
    SetDatatypeProperty(instanceCylinder, propertyRadius, &radiusCyl, 1);
    SetDatatypeProperty(instanceMatrix, property_42, &offsetY, 1);

    int64_t instanceCnt = 0;
    OrderedHandles(model, nullptr, nullptr, &instanceCnt, 0, 0);
    assert(instanceCnt == 4);

    RemoveInstances(model);

    OrderedHandles(model, nullptr, nullptr, &instanceCnt, 0, 0);
    assert(instanceCnt == 0);

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