sdaiGetEntity

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

Syntax

public const string IFCEngineDLL = @"IFCEngine.dll";

[DllImport(IFCEngineDLL, EntryPoint = "sdaiGetEntity")]
public static extern Int32 sdaiGetEntity(Int32 model, string entityName);

[DllImport(IFCEngineDLL, EntryPoint = "sdaiGetEntity")]
public static extern Int32 sdaiGetEntity(Int32 model, byte[] entityName);    

Property model

Size: 32 bit / 4 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: 32 bit / 4 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(Int32 model, Int32 ifcColumnInstance)
{
    Int32 isDefinedByInstances = 0,
          ifcRelDefinesByType_TYPE = IfcEngine.x86.sdaiGetEntity(model, System.Text.Encoding.UTF8.GetBytes("IFCRELDEFINESBYTYPE")),
          ifcRelDefinesByProperties_TYPE = IfcEngine.x86.sdaiGetEntity(model, System.Text.Encoding.UTF8.GetBytes("IFCRELDEFINESBYPROPERTIES"));
    IfcEngine.x86.sdaiGetAttrBN(ifcColumnInstance, System.Text.Encoding.UTF8.GetBytes("IsDefinedBy"), IfcEngine.x86.sdaiAGGR, out isDefinedByInstances);

    if (isDefinedByInstances != 0)
    {
        Int32 typeCnt = 0,
                isDefinedByInstancesCnt = IfcEngine.x86.sdaiGetMemberCount(isDefinedByInstances);
        for (Int32 i = 0; i < isDefinedByInstancesCnt; i++) {
            Int32 isDefinedByInstance = 0;
            IfcEngine.x86.engiGetAggrElement(isDefinedByInstances, i, IfcEngine.x86.sdaiINSTANCE, out isDefinedByInstance);

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

void GetColumns(Int32 model)
{
    Int32 ifcColumnInstances = IfcEngine.x86.sdaiGetEntityExtentBN(model, System.Text.Encoding.UTF8.GetBytes("IFCCOLUMN")),
          noIfcColumnInstances = IfcEngine.x86.sdaiGetMemberCount(ifcColumnInstances);
    if (noIfcColumnInstances != 0)
    {
        for (Int32 i = 0; i < noIfcColumnInstances; i++)
        {
            Int32 ifcColumnInstance = 0;
            IfcEngine.x86.engiGetAggrElement(ifcColumnInstances, i, IfcEngine.x86.sdaiINSTANCE, out ifcColumnInstance);

            GetInstanceProperties(model, ifcColumnInstance);
        }
    }
}