engiGetEntityCount

Returns the total number of entities within the loaded schema.

Syntax

//
//   Strong typing definition
//
SdaiInteger     engiGetEntityCount(
                        SdaiModel               model
                    );


//
//   Weak typing definition
//
int_t   __declspec(dllexport) __stdcall   engiGetEntityCount(
                                                                        int_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 engiGetEntityCount 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);
    }
}