sdaiGetEntity

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

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall sdaiGetEntity(
            __int64 model,
            char    * entityName
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t sdaiGetEntity(
            int64_t model,
            char    * entityName
        );    

Property model

Size: 64 bit / 8 byte (value)
Handle of the model containing the IFC file, this handle is needed in many other calls and given when the model is created.

Property entityName

Size: 64 bit / 8 byte (reference)
Name of the entity (schema item/class), for example IFCWALLSTANDARDCASE as defined in IFC4.exp.

Examples

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