sdaiGetInstanceType

...

Syntax

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

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

Property instance

Size: 64 bit / 8 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(__int64 model, __int64 ifcColumnInstance)
{
    __int64 * isDefinedByInstances = 0,
            ifcRelDefinesByType_TYPE = sdaiGetEntity(model, "IFCRELDEFINESBYTYPE"),
            ifcRelDefinesByProperties_TYPE = sdaiGetEntity(model, "IFCRELDEFINESBYPROPERTIES");
    sdaiGetAttrBN(ifcColumnInstance, "IsDefinedBy", sdaiAGGR, &isDefinedByInstances);

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

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

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

            GetInstanceProperties(model, ifcColumnInstance);
        }
    }
}