engiGetEntityParent

Returns the direct parent entity, for example the parent of IfcObject is IfcObjectDefinition, of IfcObjectDefinition is IfcRoot and of IfcRoot is 0.

Syntax

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

[DllImport(IFCEngineDLL, EntryPoint = "engiGetEntityParent")]
public static extern Int64 engiGetEntityParent(Int64 entity);    

Property entity

Size: 64 bit / 8 byte (value)
Handle of an 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 engiGetEntityParent can be used.

Int64 WriteEntityStructure(Int64 ifcEntity)
{
    if (ifcEntity != 0)
    {
        //
        //  Iterate over the parents
        //
        Int64 attributeCnt = WriteEntityStructure(IfcEngine.x64.engiGetEntityParent(ifcEntity));

        //
        //  Print Entity name
        //
        IntPtr entityNamePtr = IntPtr.Zero;
        IfcEngine.x64.engiGetEntityName(ifcEntity, IfcEngine.x64.sdaiSTRING, out entityNamePtr);
        string entityName = Marshal.PtrToStringAnsi(entityNamePtr);
        Console.WriteLine("Entity  " + entityName);

        //
        //  Walk over attributes
        //
        while  (attributeCnt < IfcEngine.x64.engiGetEntityNoArguments(ifcEntity)) {
            IntPtr attributeNamePtr = IntPtr.Zero;
            Int64 attributeType = 0;
            IfcEngine.x64.engiGetEntityArgumentName(ifcEntity, attributeCnt, IfcEngine.x64.sdaiSTRING, out attributeNamePtr);
            IfcEngine.x64.engiGetEntityArgumentType(ifcEntity, attributeCnt, ref attributeType);
            string attributeName = Marshal.PtrToStringAnsi(attributeNamePtr);

            Console.Write("  " + attributeName + "  ");
            switch  (attributeType) {
                case  IfcEngine.x64.sdaiSTRING:
                    Console.WriteLine("STRING");
                    break;

                ...

                default:
                    break;
            }

            attributeCnt++;
        }

        return  attributeCnt;
    }

    return  0;
}