engiGetAggrType

...

Syntax

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

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

Property aggregate

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

Property aggragateType

Size: 32 bit / 4 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(Int32 ifcInstance, string attributeName, Int32 attributeType)
{
    switch  (attributeType) {
        case  IfcEngine.x86.sdaiAGGR:
            Int32 aggregate = 0;
            IfcEngine.x86.sdaiGetAttrBN(ifcInstance, System.Text.Encoding.UTF8.GetBytes(attributeName), IfcEngine.x86.sdaiAGGR, out aggregate);
            if (aggregate != 0)
            {
                Int32 cnt = IfcEngine.x86.sdaiGetMemberCount(aggregate);
                for (Int32 i = 0; i < cnt; i++)
                {
                    Int32 aggregateType = 0;
                    IfcEngine.x86.engiGetAggrType(aggregate, ref aggregateType);
                    switch (aggregateType) {
                        case  IfcEngine.x86.sdaiSTRING:
                            {
                                IntPtr valuePtr = IntPtr.Zero;
                                IfcEngine.x86.engiGetAggrElement(aggregate, i, IfcEngine.x86.sdaiUNICODE, out valuePtr);
                                string value = Marshal.PtrToStringUni(valuePtr);
                                ...
                            }
                            break;

                        ...

                        default:
                            break;
                    }
                }
            }
            break;

        ...

        default:
            break;
    }
}

void WriteAttributes(Int32 ifcInstance)
{
    Int32 ifcEntity = IfcEngine.x86.sdaiGetInstanceType(ifcInstance),
          attributeCnt = IfcEngine.x86.engiGetEntityNoArguments(ifcEntity);

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