InferenceInstance

This function fills in values that are implicitly known but not given by the user. This function can also be used to identify default values of properties if not given.

Syntax

//
//   Strong typing definition
//
int64_t         InferenceInstance(
                        OwlInstance             owlInstance
                    );


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall InferenceInstance(
                                                int64_t                 owlInstance
                                            );
    

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 (based on pure API calls)

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

#include    "./include/engine.h"

int64_t model = CreateModel();

if (model) {
    //
    //  Classes
    //
    int64_t classInverseMatrix = GetClassByName(model, "InverseMatrix"),
            classMatrix = GetClassByName(model, "Matrix");

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

    //
    //  Datatype Properties (attributes)
    //
    int64_t property_21 = GetPropertyByName(model, "_21"),
            property_33 = GetPropertyByName(model, "_33"),
            property_42 = GetPropertyByName(model, "_42");

    //
    //  Instances (creating)
    //
    int64_t instanceInverseMatrix = CreateInstance(classInverseMatrix, nullptr),
            instanceMatrix = CreateInstance(classMatrix, nullptr);

    SetObjectProperty(instanceInverseMatrix, propertyMatrix, &instanceMatrix, 1);

    double  translationY = 2.8;

    SetDatatypeProperty(instanceMatrix, property_42, &translationY, 1);

    int64_t card = 0;
    double  * values = nullptr;
    GetDatatypeProperty(instanceMatrix, property_21, (void**) &values, &card);
    assert(card == 0);

    GetDatatypeProperty(instanceMatrix, property_33, (void**) &values, &card);
    assert(card == 0);

    GetDatatypeProperty(instanceInverseMatrix, property_42, (void**) &values, &card);
    assert(card == 0);

    GetDatatypeProperty(instanceInverseMatrix, property_33, (void**) &values, &card);
    assert(card == 0);

    //
    //  Force to apply a calculation of the tree,
    //  CalculateInstance without further non-zero arguments has the same effect.
    //
    UpdateInstance(instanceInverseMatrix);

    //
    //  Assign all implicitely known values
    //
    InferenceInstance(instanceInverseMatrix);

    GetDatatypeProperty(instanceMatrix, property_21, (void**) &values, &card);
    assert(card == 1 && values[0] == 0.);

    GetDatatypeProperty(instanceMatrix, property_33, (void**) &values, &card);
    assert(card == 1 && values[0] == 1.);

    GetDatatypeProperty(instanceInverseMatrix, property_42, (void**) &values, &card);
    assert(card == 1 && values[0] == -translationY);

    GetDatatypeProperty(instanceInverseMatrix, property_33, (void**) &values, &card);
    assert(card == 1 && values[0] == 1.);

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