GetObjectPropertyEx

This function gets the value(s) of a certain objectProperty in the context of an instance.
The value of card gives the actual card of the values list.
The list values of integers is a list of handles to instances, this list has a length as givin in the values card.
The return value always should be 0, if not something is wrong in the way this property is called.

This call has the same behavior as GetObjectProperty, however needs to be used in case properties are exchanged as a successive series of integers.

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall GetObjectPropertyEx(
            __int64             model,
            __int64             owlInstance,
            __int64             rdfProperty,
            __int64             ** values,
            __int64             * card
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t GetObjectPropertyEx(
            int64_t             model,
            int64_t             owlInstance,
            int64_t             rdfProperty,
            int64_t             ** values,
            int64_t             * card
        );    

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.

Property rdfProperty

Size: 64 bit / 8 byte (value)
This attribute represents a handle to the property, this can be either a datatype property (attribute), an object property (relation) or non-defined property. The handle will be static during the life-time of the model, when the model (or part of it) is saved and opened again, the handle will most probably be different.

Property values

Size: 64 bit / 8 byte (reference)
The output array for object properties content. The contents memory is allocated by the library

Property card

Size: 64 bit / 8 byte (reference)
The cardinality (i.e. number of elements) of the array as given or returned.

Example

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

#include 
#include 

int64_t model = CreateModel();

if (model) {
    //
    //  The following setting makes sure all instance handles 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.
    //
    int64_t instanceCnt = 0;
    OrderedHandles(model, nullptr, nullptr, &instanceCnt, 4, 4);
    assert(instanceCnt == 0);

    //
    //  Classes
    //
    int64_t classAbcd = CreateClass(model, "ABCD");

    //
    //  Object Properties (relations)
    //
    int64_t propertyAb = CreateProperty(model, OBJECTPROPERTY_TYPE, "Ab");

    //
    //  Instances
    //
    int64_t instanceAbcdI = CreateInstance(classAbcd, nullptr),
            instanceAbcdII = CreateInstance(classAbcd, nullptr);
    assert(instanceAbcdI == instanceCnt + 1);
    assert(instanceAbcdII == instanceCnt + 2);

    //
    //  Set Properties
    //
        
    {
        SetObjectPropertyEx(model, instanceAbcdI, propertyAb, &instanceAbcdII, 1);

        int64_t valuesAb[3] = { instanceAbcdI, instanceAbcdII, instanceAbcdI };
        SetObjectPropertyEx(model, instanceAbcdII, propertyAb, valuesAb, 3);
    }

    //
    //  Get Properties
    //

    {
        int64_t card = 0,
                * values = nullptr;
        GetObjectPropertyEx(model, instanceAbcdI, propertyAb, &values, &card);

        assert(card == 1 && values[0] == instanceAbcdII);
    }

    {
        int64_t card = 0,
                * values = nullptr;
        GetObjectPropertyEx(model, instanceAbcdII, propertyAb, &values, &card);

        assert(card == 3 && values[0] == instanceAbcdI && values[1] == instanceAbcdII && values[2] == instanceAbcdI);
    }

    //
    //  The same can be applied to existing classes and properties
    //

    //
    //  Classes
    //
    int64_t classCollection = GetClassByName(model, "Collection"),
            classCube = GetClassByName(model, "Cube");

    //
    //  Object Properties (relations)
    //
    int64_t propertyObjects = GetPropertyByName(model, "objects");

    //
    //  Datatype Properties (attributes)
    //
    int64_t propertyLength = GetPropertyByName(model, "length");

    //
    //  Instances (creating)
    //
    int64_t instanceCollectionI = CreateInstance(classCollection, nullptr),
            instanceCollectionII = CreateInstance(classCollection, nullptr),
            instanceCube = CreateInstance(classCube, nullptr);
    assert(instanceCollectionI == instanceCnt + 3);
    assert(instanceCollectionII == instanceCnt + 4);
    assert(instanceCube == instanceCnt + 5);

    double  length = 1.0;
        
    SetDatatypePropertyEx(model, instanceCube, propertyLength, &length, 1);

    int64_t values[3] = { instanceCollectionII, instanceCube, instanceCube };
    SetObjectPropertyEx(model, instanceCollectionI, propertyObjects, values, 3);
    SetObjectPropertyEx(model, instanceCollectionII, propertyObjects, &instanceCube, 1);

    //
    //  CollectionI contains 3 cubes and CollectionII contains 1 cube
    //

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