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(int_t model, string entityName);

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

Property model

Size: 32 bit / 4 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property entityName

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

Example (based on pure API calls)

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

using RDF;      //  include at least engine.cs within your solution

void GetInstanceProperties(Int64 model, Int64 ifcColumnInstance)
{
    Int64 isDefinedByInstances = 0,
          ifcRelDefinesByType_TYPE = IfcEngine.x64.sdaiGetEntity(model, System.Text.Encoding.UTF8.GetBytes("IFCRELDEFINESBYTYPE")),
          ifcRelDefinesByProperties_TYPE = IfcEngine.x64.sdaiGetEntity(model, System.Text.Encoding.UTF8.GetBytes("IFCRELDEFINESBYPROPERTIES"));
    IfcEngine.x64.sdaiGetAttrBN(ifcColumnInstance, System.Text.Encoding.UTF8.GetBytes("IsDefinedBy"), IfcEngine.x64.sdaiAGGR, out isDefinedByInstances);

    if (isDefinedByInstances != 0)
    {
        Int64 typeCnt = 0,
                isDefinedByInstancesCnt = IfcEngine.x64.sdaiGetMemberCount(isDefinedByInstances);
        for (Int64 i = 0; i < isDefinedByInstancesCnt; i++) {
            Int64 isDefinedByInstance = 0;
            IfcEngine.x64.sdaiGetAggrByIndex(isDefinedByInstances, i, IfcEngine.x64.sdaiINSTANCE, out isDefinedByInstance);

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

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

            GetInstanceProperties(model, ifcColumnInstance);
        }
    }
}