sdaiGetEntity

This call retrieves a handle to an entity based on a given entity name.

Syntax

//
//   Strong typing definition
//
SdaiEntity      sdaiGetEntity(
                        SdaiModel               model,
                        SdaiString              entityName
                    );

static  inline  SdaiEntity  sdaiGetEntity(
                                    SdaiModel               model,
                                    char                    * entityName
                                )
{
    return  sdaiGetEntity(
                    model,
                    (SdaiString) entityName
                );
}


//
//   Weak typing definition
//
int_t   __declspec(dllexport) __stdcall sdaiGetEntity(
                                                int_t                   model,
                                                const char              * entityName
                                            );

static  inline  int_t   sdaiGetEntity(
                                int_t                   model,
                                char                    * entityName
                            )
{
    return  sdaiGetEntity(
                    model,
                    (const SdaiString) entityName
                );
}
    

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 entityName

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

Example (based on pure API calls)

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

#include    "./include/ifcengine.h"
void    GetInstanceProperties(int_t model, int_t ifcColumnInstance)
{
    int_t   * isDefinedByInstances = 0,
            ifcRelDefinesByType_TYPE = sdaiGetEntity(ifcModel, "IFCRELDEFINESBYTYPE"),
            ifcRelDefinesByProperties_TYPE = sdaiGetEntity(ifcModel, "IFCRELDEFINESBYPROPERTIES");
    sdaiGetAttrBN(ifcColumnInstance, "IsDefinedBy", sdaiAGGR, &isDefinedByInstances);

    if (isDefinedByInstances) {
        int_t   typeCnt = 0,
                isDefinedByInstancesCnt = sdaiGetMemberCount(isDefinedByInstances);
        for (int_t i = 0; i < isDefinedByInstancesCnt; ++i) {
            int_t isDefinedByInstance = 0;
            sdaiGetAggrByIndex(isDefinedByInstances, i, sdaiINSTANCE, &isDefinedByInstance);

            if (sdaiGetInstanceType(isDefinedByInstance) == ifcRelDefinesByType_TYPE) {
                ...
            }
            else if (sdaiGetInstanceType(isDefinedByInstance) == ifcRelDefinesByProperties_TYPE) {
                ...
            }
            else {
                ...
            }
        }
    }
}

void    GetColumns(int_t model)
{
    int_t   ifcColumnInstances = sdaiGetEntityExtentBN(model, "IFCCOLUMN"),
            noIfcColumnInstances = sdaiGetMemberCount(ifcColumnInstances);
    if (noIfcColumnInstances) {
        for (int_t i = 0; i < noIfcColumnInstances; ++i) {
            int_t   ifcColumnInstance = 0;
            sdaiGetAggrByIndex(ifcColumnInstances, i, sdaiINSTANCE, &ifcColumnInstance);

            GetInstanceProperties(model, ifcColumnInstance);
        }
    }
}