Returns a handle to an instance.
If input instance is zero, the handle will point to the first relevant instance.
If all instances are past (or no relevant instances are found), the function will return 0.


//   Visual Studio for Windows
__int64 __declspec(dllexport) __stdcall GetInstancesByIterator(
            __int64             model,
            __int64             owlInstance

//   Linux, OS-X and non-Visual Studio Windows solutions
int64_t GetInstancesByIterator(
            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.


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

int64_t GetInstanceCnt(int64_t model)
    int64_t instanceCnt = 0,
            myIteratedInstance = GetInstancesByIterator(model, 0);
    while (myIteratedInstance) {
        char    * instanceName = nullptr,
                * className = nullptr;
        GetNameOfInstance(myIteratedInstance, &instanceName);
        GetNameOfClass(GetInstanceClass(myIteratedInstance), &className);
        //  The name of the class can be checked by placing a breakpoint after this point while debugging
        myIteratedInstance = GetInstancesByIterator(model, myIteratedInstance);

    return  instanceCnt;

int _tmain(int argc, _TCHAR* argv[])
    int64_t model = CreateModel();

    if (model) {
        int64_t instanceCnt = GetInstanceCnt(model);

        //  Add a new class
        CreateInstance(GetClassByName(model, "Collection"), "CreatedInstanceToTestInstanceCnt");

        assert(GetInstanceCnt(model) == instanceCnt + 1);

        int64_t instanceCntThroughAPI = 0;
        OrderedHandles(model, nullptr, nullptr, &instanceCntThroughAPI, 0, 0);

        assert(GetInstanceCnt(model) == instanceCntThroughAPI);


    return  0;