sdaiGetInstanceType

...

Syntax

//   Visual Studio for Windows
public:
__int32 __declspec(dllexport) __stdcall sdaiGetInstanceType(
            __int32 instance
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int32_t sdaiGetInstanceType(
            int32_t instance
        );    

Property instance

Size: 32 bit / 4 byte (value)
Handle of an instance within an IFC file, for example #31313 = IFCWALLSTANDARDCASE(...)

Examples

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

void    GetInstanceProperties(__int32 model, __int32 ifcColumnInstance)
{
    __int32 * isDefinedByInstances = 0,
            ifcRelDefinesByType_TYPE = sdaiGetEntity(model, "IFCRELDEFINESBYTYPE"),
            ifcRelDefinesByProperties_TYPE = sdaiGetEntity(model, "IFCRELDEFINESBYPROPERTIES");
    sdaiGetAttrBN(ifcColumnInstance, "IsDefinedBy", sdaiAGGR, &isDefinedByInstances);

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

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

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

            GetInstanceProperties(model, ifcColumnInstance);
        }
    }
}