getInstanceInModelling

This call will return the part of the index array representing the triangle set that visualizes the IFC instance. This call is only relevant if purely the triangulated geometry is generated (setFormat is not requesting points, lines or wireframe). For geometry also containing points, lines and/or wireframe representations the calls getConceptualFaceCnt() and getConceptualFaceEx() should be used.

Syntax

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

[DllImport(IFCEngineDLL, EntryPoint = "getInstanceInModelling")]
public static extern Int64 getInstanceInModelling(Int64 model, Int64 instance, Int64 mode, ref Int64 startVertex, ref Int64 startIndex, ref Int64 primitiveCount);    

Property model

Size: 64 bit / 8 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 instance

Size: 64 bit / 8 byte (value)
Handle of an instance within an IFC file, for example #31313 = IFCWALLSTANDARDCASE(...)

Property mode

Size: 64 bit / 8 byte (value)
...

Property startVertex

Size: 64 bit / 8 byte (reference)
The first vertex in the array of relevance for this instance (can be used to improve performance of the rendering engine).

Property startIndex

Size: 64 bit / 8 byte (reference)
The first index in the array of relevance for this instance (can be used to improve performance of the rendering engine).

Property primitiveCount

Size: 64 bit / 8 byte (reference)
The number of primitives available (for example 4 primitives and the case we have triangles means 12 following indices representing the data on the index array).

Examples

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

void GenerateGeometry(Int64 model, Int64 ifcColumnInstance)
{
    Int64	setting = 0, mask = 0;
    mask += IfcEngine.x64.flagbit2;        //    PRECISION (32/64 bit)
    mask += IfcEngine.x64.flagbit3;        //    INDEX ARRAY (32/64 bit)
    mask += IfcEngine.x64.flagbit5;        //    NORMALS
    mask += IfcEngine.x64.flagbit8;        //    TRIANGLES
    mask += IfcEngine.x64.flagbit12;       //    WIREFRAME

    setting += 0;                          //    SINGLE PRECISION (float)
    setting += 0;                          //    32 BIT INDEX ARRAY (Int32)
    setting += IfcEngine.x64.flagbit5;     //    NORMALS ON
    setting += IfcEngine.x64.flagbit8;     //    TRIANGLES ON
    setting += 0;                          //    WIREFRAME OFF
    IfcEngine.x64.setFormat(model, setting, mask);
    //  The setFormat call is not called for each column instance we are generating geometry for.
    //  This is not needed when the setting/mask are not changed, the latest setting always applies.

    Int64 noVertices = 0, noIndices = 0;
    IfcEngine.x64.initializeModellingInstance(model, ref noVertices, ref noIndices, 0, ifcColumnInstance);

    if  (noVertices != 0  &&  noIndices != 0) {
        float[] vertexArray = new float[noVertices * 6];    //    
        Int32[] indexArray = new Int32[noIndices];
        IfcEngine.x64.finalizeModelling(model, vertexArray, indexArray, 0);

        Int64 mode = 0,
              startVertex = 0, startIndex = 0, primitiveCount = 0;
        IfcEngine.x64.getInstanceInModelling(model, ifcColumnInstance, mode, ref startVertex, ref startIndex, ref primitiveCount);

        //
        //  Array's vertexArray and indexArray are filled with data.
        //
        //  startIndex points to the first index in the indexArray of relevance
        //  In total 3 * primitiveCount elements on the indexArray represent all the triangles of the object.
        //
        //  startVertex is a derived value and given as some applications can get performance gain from this information.
        //

        ...
    }
}

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

            GenerateGeometry(model, ifcColumnInstance);
        }
    }
}