initializeModellingInstance

The number of vertices and number of indices needed for storing the geometry of the given IFC instance is calculated by this function.

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall initializeModellingInstance(
            __int64 model,
            __int64 * noVertices,
            __int64 * noIndices,
            double  scale,
            __int64 instance
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t initializeModellingInstance(
            int64_t model,
            int64_t * noVertices,
            int64_t * noIndices,
            double  scale,
            int64_t instance
        );    

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 noVertices

Size: 64 bit / 8 byte (reference)
The number of vertices that are needed for this instance.

Property noIndices

Size: 64 bit / 8 byte (reference)
The number of indices that are needed for this instance.

Property scale

Size: 64 bit / 8 byte (value)
Ignore this argument use 1 as default value.

Property instance

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

Examples

Here you can find code snippits that show how the API call initializeModellingInstance 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);
        }
    }
}