sdaiGetInstanceType

Returns the entity based on an instance.

Syntax

//
//   Strong typing definition
//
SdaiEntity      sdaiGetInstanceType(
                        SdaiInstance            instance
                    );


//
//   Weak typing definition
//
int_t   __declspec(dllexport) __stdcall   sdaiGetInstanceType(
                                                                        int_t                   instance
                                                                    );
    

Property instance

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

Example (based on pure API calls)

Here you can find code snippits that show how the API call sdaiGetInstanceType 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);
        }
    }
}