finalizeModelling

After initializeModellingInstance() this call will fill the actual vertex and index array allocated by the client application.

Syntax

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

[DllImport(IFCEngineDLL, EntryPoint = "finalizeModelling")]
public static extern Int32 finalizeModelling(Int32 model, float[] vertices, Int32[] indices, Int32 FVF);

[DllImport(IFCEngineDLL, EntryPoint = "finalizeModelling")]
public static extern Int32 finalizeModelling(Int32 model, float[] vertices, Int64[] indices, Int32 FVF);

[DllImport(IFCEngineDLL, EntryPoint = "finalizeModelling")]
public static extern Int32 finalizeModelling(Int32 model, double[] vertices, Int32[] indices, Int32 FVF);

[DllImport(IFCEngineDLL, EntryPoint = "finalizeModelling")]
public static extern Int32 finalizeModelling(Int32 model, double[] vertices, Int64[] indices, Int32 FVF);    

Property model

Size: 32 bit / 4 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 vertices

Size: 32 bit / 4 byte (reference)
The array containing the space for vertex information.

Property indices

Size: 32 bit / 4 byte (reference)
The array containing the space for index information.

Property FVF

Size: 32 bit / 4 byte (value)
Ignore this argument use 0 as default value. Its original use is covered by setFormat().

Examples

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

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

    setting += 0;                          //    SINGLE PRECISION (float)
    setting += 0;                          //    32 BIT INDEX ARRAY (Int32)
    setting += IfcEngine.x86.flagbit5;     //    NORMALS ON
    setting += IfcEngine.x86.flagbit8;     //    TRIANGLES ON
    setting += 0;                          //    WIREFRAME OFF
    IfcEngine.x86.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.

    Int32 noVertices = 0, noIndices = 0;
    IfcEngine.x86.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.x86.finalizeModelling(model, vertexArray, indexArray, 0);

        Int32 mode = 0,
              startVertex = 0, startIndex = 0, primitiveCount = 0;
        IfcEngine.x86.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(Int32 model)
{
    Int32 ifcColumnInstances = IfcEngine.x86.sdaiGetEntityExtentBN(model, "IFCCOLUMN"),
          noIfcColumnInstances = IfcEngine.x86.sdaiGetMemberCount(ifcColumnInstances);
    if (noIfcColumnInstances != 0)
    {
        for (Int32 i = 0; i < noIfcColumnInstances; i++)
        {
            Int32 ifcColumnInstance = 0;
            IfcEngine.x86.engiGetAggrElement(ifcColumnInstances, i, IfcEngine.x86.sdaiINSTANCE, out ifcColumnInstance);

            GenerateGeometry(model, ifcColumnInstance);
        }
    }
}