engiGetAggrType

...

Syntax

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

[DllImport(IFCEngineDLL, EntryPoint = "engiGetAggrType")]
public static extern void engiGetAggrType(Int64 aggregate, ref Int64 aggragateType);    

Property aggregate

Size: 64 bit / 8 byte (value)
Handle of an aggregation (i.e. sorted collection).

Property aggragateType

Size: 64 bit / 8 byte (reference)
Type of the aggregation, for example sdaiINSTANCE, sdaiREAL, ...

Examples

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

void WriteAttribute(Int64 ifcInstance, string attributeName, Int64 attributeType)
{
    switch  (attributeType) {
        case  IfcEngine.x64.sdaiAGGR:
            Int64 aggregate = 0;
            IfcEngine.x64.sdaiGetAttrBN(ifcInstance, System.Text.Encoding.UTF8.GetBytes(attributeName), IfcEngine.x64.sdaiAGGR, out aggregate);
            if (aggregate != 0)
            {
                Int64 cnt = IfcEngine.x64.sdaiGetMemberCount(aggregate);
                for (Int64 i = 0; i < cnt; i++)
                {
                    Int64 aggregateType = 0;
                    IfcEngine.x64.engiGetAggrType(aggregate, ref aggregateType);
                    switch (aggregateType) {
                        case  IfcEngine.x64.sdaiSTRING:
                            {
                                IntPtr valuePtr = IntPtr.Zero;
                                IfcEngine.x64.engiGetAggrElement(aggregate, i, IfcEngine.x64.sdaiUNICODE, out valuePtr);
                                string value = Marshal.PtrToStringUni(valuePtr);
                                ...
                            }
                            break;

                        ...

                        default:
                            break;
                    }
                }
            }
            break;

        ...

        default:
            break;
    }
}

void WriteAttributes(Int64 ifcInstance)
{
    Int64 ifcEntity = IfcEngine.x64.sdaiGetInstanceType(ifcInstance),
          attributeCnt = IfcEngine.x64.engiGetEntityNoArguments(ifcEntity);

    for (Int64 i = 0; i < attributeCnt; i++)
    {
        Int64 attributeType = 0;
        IntPtr attributeNamePtr = IntPtr.Zero;
        IfcEngine.x64.engiGetEntityArgumentName(ifcEntity, i, IfcEngine.x64.sdaiSTRING, out attributeNamePtr);
        IfcEngine.x64.engiGetEntityArgumentType(ifcEntity, i, ref attributeType);
        string attributeName = Marshal.PtrToStringAnsi(attributeNamePtr);
        WriteAttribute(ifcInstance, attributeName, attributeType);
    }
}