engiGetEntityElement

This call returns a specific entity based on an index, the index needs to be 0 or higher but lower then the number of entities in the loaded schema.

Syntax

//
//   Strong typing definition
//
SdaiEntity      engiGetEntityElement(
                        SdaiModel               model,
                        SdaiInteger             index
                    );


//
//   Weak typing definition
//
int_t   __declspec(dllexport) __stdcall   engiGetEntityElement(
                                                                        int_t                   model,
                                                                        int_t                   index
                                                                    );
    

Property model

Size: 32 bit / 4 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 index

Size: 32 bit / 4 byte (value)
...

Example (based on pure API calls)

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

#include    "./include/ifcengine.h"
#include    <assert.h>

void    WalkInstances(SdaiModel model, SdaiEntity entity)
{
    char    * entityName = nullptr;
    engiGetEntityName(entity, sdaiSTRING, &entityName);
    std::cout << "Entity: " << entityName << "\n";

    SdaiAggr entityAggr = sdaiGetEntityExtent(model, entity);
    SdaiInteger instanceCnt = sdaiGetMemberCount(entityAggr);
    for (SdaiInteger index = 0; index < instanceCnt; index++) {
        SdaiInstance    ifcInstance = 0;
        sdaiGetAggrByIndex(entityAggr, index, sdaiINSTANCE, &ifcInstance);

        if (index) std::cout << ", ";
        std::cout << internalGetP21Line(ifcInstance);
    }

    std::cout << "\n";

    assert(engiGetEntityModel(entity) == model);
}

void    WalkEntities(SdaiModel model)
{
    SdaiInteger entityCount = engiGetEntityCount(model);
    for (SdaiInteger index = 0; index < entityCount; index++) {
        SdaiEntity  entity = engiGetEntityElement(model, index);
        WalkInstances(model, entity);
    }
}