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

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall getInstanceInModelling(
            __int64 model,
            __int64 instance,
            __int64 mode,
            __int64 * startVertex,
            __int64 * startIndex,
            __int64 * primitiveCount
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t getInstanceInModelling(
            int64_t model,
            int64_t instance,
            int64_t mode,
            int64_t * startVertex,
            int64_t * startIndex,
            int64_t * 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 += flagbit2;        //    PRECISION (32/64 bit)
    mask += flagbit3;        //    INDEX ARRAY (32/64 bit)
    mask += flagbit5;        //    NORMALS
    mask += flagbit8;        //    TRIANGLES
    mask += flagbit12;       //    WIREFRAME

    setting += 0;            //    SINGLE PRECISION (float)
    setting += 0;            //    32 BIT INDEX ARRAY (Int32)
    setting += flagbit5;     //    NORMALS ON
    setting += flagbit8;     //    TRIANGLES ON
    setting += 0;            //    WIREFRAME OFF
    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;
    initializeModellingInstance(model, &noVertices, &noIndices, 0, ifcColumnInstance);

    if  (noVertices  &&  noIndices) {
        float   * vertexArray = new float[noVertices * 6];    //    
        __int32 * indexArray = new __int32[noIndices];
        finalizeModelling(model, vertexArray, (__int64 *) indexArray, 0);

        __int64 mode = 0,
                startVertex = 0, startIndex = 0, primitiveCount = 0;
        getInstanceInModelling(model, ifcColumnInstance, mode, &startVertex, &startIndex, &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 = sdaiGetEntityExtentBN(model, "IFCCOLUMN"),
            noIfcColumnInstances = sdaiGetMemberCount(ifcColumnInstances);
    if  (noIfcColumnInstances) {
        for  (__int64 i = 0; i < noIfcColumnInstances; i++) {
            __int64 ifcColumnInstance = 0;
            engiGetAggrElement(ifcColumnInstances, i, sdaiINSTANCE, &ifcColumnInstance);

            GenerateGeometry(model, ifcColumnInstance);
        }
    }
}