Match Functions

Function to manage block model matches against triangulations or other selection criteria and retrieve matched volumes.

MTK_BlockModel_AddMatchTriangulation()

Add triangulation to match blockmodel against.

Signature
int MTK_BlockModel_AddMatchTriangulation(
    MTK_BlockModel* bmodel,
    const char* triName
    );
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • triName: Triangulation name.

Returns

0 on success; any other value indicates failure.

Example

int main()
{
    // Initialise the SDK
    MTK_BlockModel* bmodel;
    bmodel = MTK_BlockModel_Open(
    "C:\\Program Files\\Maptek\\Vulcan 8.2\\SDK\\Examples\\data\\bm50x50.bmf", 0
    );
    if (!bmodel)
    {
        // Handle the error
        return 1;
    }
    status = MTK_BlockModel_AddMatchTriangulation(
    bmodel, "C:\\Program Files\\Maptek\\Vulcan 8.2\\SDK\\Examples\\data\\ore_tq1.00t"
    );
    if (status)
    {
        // Handle the error
        return 1;
    }
    double matchVolume = 0;
    status = MTK_BlockModel_FirstBlock(bmodel);
    if (status)
    {
        // Handle the error
        return 1;
    }
    while (!MTK_BlockModel_IsEof(bmodel))
    {
        double blockVolume = MTK_BlockModel_GetBlockMatchVolume(bmodel);
        if (blockVolume < 0)
        {
            // Handle the error
            return 1;
        }
        matchVolume += blockVolume;
        status = MTK_BlockModel_NextBlock(bmodel);
        if (status)
        {
            // Handle the error
            return 1;
        }
    }
    printf("Match volume without UseExactVolume set is: %f\n", matchVolume);
    status = MTK_BlockModel_SetUseExactVolume(bmodel, 1);
    if (status)
    {
        HandleError();
        return 1;
    }
    matchVolume = 0;
    status = MTK_BlockModel_FirstBlock(bmodel);
    if (status)
    {
        // Handle the error
        return 1;
    }
    while (!MTK_BlockModel_IsEof(bmodel))
    {
        double blockVolume = MTK_BlockModel_GetBlockMatchVolume(bmodel);
        if (blockVolume < 0)
        {
            // Handle the error
            return 1;
        }
        matchVolume += blockVolume;
        status = MTK_BlockModel_NextBlock(bmodel);
        if (status)
        {
            // Handle the error
            return 1;
        }
    }
    printf("Match volume with UseExactVolume set is: %f\n", matchVolume);
    if (MTK_BlockModel_Close(bmodel))
    {
        // Handle the error
        return 1;
    }
    return 0;
}
// Expected Output
// Match volume without UseExactVolume set is: 1164484.375000
// Match volume with UseExactVolume set is: 1166463.107557
            

MTK_BlockModel_ClearMatch()

Clear current blockmodel match.

Signature
int MTK_BlockModel_ClearMatch(MTK_BlockModel* bmodel);
Parameters

bmodel: Pointer to an MTK_BlockModel struct.

Returns

0 on success; any other value indicates failure.

MTK_BlockModel_GetBlockMatchExtent()

Return the match extent of the current matched block.

Signature
int MTK_BlockModel_GetBlockMatchExtent(
    MTK_BlockModel* bmodel,
    double* x0, double* y0, double* z0,
    double* x1, double* y1, double* z1
    );
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • x0: Lower left x-coordinate

  • y0: Lower left y-coordinate

  • z0: Lower left z-coordinate

  • x1: Upper right x-coordinate

  • y1: Upper right y-coordinate

  • z1: Upper right z-coordinate

Returns

0 on success; any other value indicates failure.

MTK_BlockModel_GetBlockMatchVolume()

Get current block matched volume.

Signature
double MTK_BlockModel_GetBlockMatchVolume(MTK_BlockModel* bmodel);
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

Returns
  • double: The block match volume

  • -1: Failed

Example

int main()
{
    // Initialise the SDK
    MTK_BlockModel* bmodel;
    bmodel = MTK_BlockModel_Open(
    "C:\\Program Files\\Maptek\\Vulcan 8.2\\SDK\\Examples\\data\\bm50x50.bmf", 0
    );
    if (!bmodel)
    {
        // Handle the error
        return 1;
    }
    status = MTK_BlockModel_AddMatchTriangulation(
    bmodel, "C:\\Program Files\\Maptek\\Vulcan 8.2\\SDK\\Examples\\data\\ore_tq1.00t"
    );
    if (status)
    {
        // Handle the error
        return 1;
    }
    double matchVolume = 0;
    status = MTK_BlockModel_FirstBlock(bmodel);
    if (status)
    {
        // Handle the error
        return 1;
    }
    while (!MTK_BlockModel_IsEof(bmodel))
    {
        double blockVolume = 
        MTK_BlockModel_GetBlockMatchVolume(bmodel);
        if (blockVolume < 0)
        {
            // Handle the error
            return 1;
        }
        matchVolume += blockVolume;
        status = MTK_BlockModel_NextBlock(bmodel);
        if (status)
        {
            // Handle the error
            return 1;
        }
    }
    printf("Match volume without UseExactVolume set is: %f\n", matchVolume);
    status = MTK_BlockModel_SetUseExactVolume(bmodel, 1);
    if (status)
    {
        HandleError();
        return 1;
    }
    matchVolume = 0;
    status = MTK_BlockModel_FirstBlock(bmodel);
    if (status)
    {
        // Handle the error
        return 1;
    }
    while (!MTK_BlockModel_IsEof(bmodel))
    {
        double blockVolume = 
        MTK_BlockModel_GetBlockMatchVolume(bmodel);
        if (blockVolume < 0)
        {
            // Handle the error
            return 1;
        }
        matchVolume += blockVolume;
        status = MTK_BlockModel_NextBlock(bmodel);
        if (status)
        {
            // Handle the error
            return 1;
        }
    }
    printf("Match volume with UseExactVolume set is: %f\n", matchVolume);
    if (MTK_BlockModel_Close(bmodel))
    {
        // Handle the error
        return 1;
    }
    return 0;
}
// Expected Output
// Match volume without UseExactVolume set is: 1164484.375000
// Match volume with UseExactVolume set is: 1166463.107557

MTK_BlockModel_SetMatchExtent()

Set the match extent in model coordinates.

Signature
int MTK_BlockModel_SetMatchExtent(
    MTK_BlockModel* bmodel,
    const double& x0, const double& y0, const double& z0,
    const double& x1, const double& y1, const double& z1
    );
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • x0: Lower left x-coordinate

  • y0: Lower left y-coordinate

  • z0: Lower left z-coordinate

  • x1: Upper right x-coordinate

  • y1: Upper right y-coordinate

  • z1: Upper right z-coordinate

Returns

0 on success; any other value indicates failure.

MTK_BlockModel_SetMatchSelectString()

Set a block model's match from a string of options.

Signature
int MTK_BlockModel_SetMatchSelectString(
    MTK_BlockModel* bmodel,
    const char* selection
    );
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • selection: The selection string to be used for the match. The selection string can be built from the following options (multiple options supported):

    • -t triangulation: Select by triangulation

    • -v variable value: Select by the value of a variable

    • -n top surface: Select between two surfaces (top)

    • -u lower surface: Select between two surfaces (bottom)

    • -B triangulation: Select by bounding triangulation

    • -Z: Project z axis down

    • -O: Select blocks outside the solid only

    • -bm x0 x1 y0 y1 z0 z1: Select by bounding extent (model coordinates)

    • -bw x0 x1 y0 y1 z0 z1: Select by bounding extent (world coordinates)

    • -p a b c d: Select by plane

    • -C expression: See Vulcan help at: Envisage->Core appendixes->B - Operators/Functions

    • -r offset: Plane offset

    • -X: Use proportional volumes against solids; has the same effect as using MTK_BlockModel_SetUseExactVolume().

Returns

0 on success; any other value indicates failure.

Example
status = MTK_BlockModel_SetMatchSelectString(
    bmodel,
    "-t C:\\Program Files\\Maptek\\Vulcan 8.2\\SDK\\Examples\\data\\ore_tq1.00t -X");
status = MTK_BlockModel_SetMatchSelectString(
    bmodel,
    "-bw 115405.0 115835.0 117462.5 118437.5 6200.0 6800.0");

MTK_BlockModel_SetUseExactVolume()

Set or unset the use exact volume flag. When the exact volume flag is set, the extent of the block match is modified to match the volume of the intersection between the solid and the original block extent. This is also called proportional matching.

Signature
int MTK_BlockModel_SetUseExactVolume(
    MTK_BlockModel* bmodel, const int& use);
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • use: If 1, exact intersection volumes are returned; otherwise the volume is the volume of the entire block.

Returns

0 on success; any other value indicates failure.

Example

int main()
{
    // Initialise the SDK
    MTK_BlockModel* bmodel;
    bmodel = MTK_BlockModel_Open(
        "C:\\Program Files\\Maptek\\Vulcan 8.2\\SDK\\Examples\\data\\bm50x50.bmf", 0);
    if (!bmodel)
    {
        // Handle the error
        return 1;
    }
    status = MTK_BlockModel_AddMatchTriangulation(
        bmodel, "C:\\Program Files\\Maptek\\Vulcan 8.2\\SDK\\Examples\\data\\ore_tq1.00t");
    if (status)
    {
        // Handle the error
        return 1;
    }
    double matchVolume = 0;
    status = MTK_BlockModel_FirstBlock(bmodel);
    if (status)
    {
        // Handle the error
        return 1;
    }
    while (!MTK_BlockModel_IsEof(bmodel))
    {
        double blockVolume = MTK_BlockModel_GetBlockMatchVolume(bmodel);
        if (blockVolume < 0)
        {
            // Handle the error
            return 1;
        }
        matchVolume += blockVolume;
        status = MTK_BlockModel_NextBlock(bmodel);
        if (status)
        {
            // Handle the error
            return 1;
        }
    }
    printf("Match volume without UseExactVolume set is: %f\n", matchVolume);
    status = MTK_BlockModel_SetUseExactVolume(bmodel, 1);
    if (status)
    {
        HandleError();
        return 1;
    }
    matchVolume = 0;
    status = MTK_BlockModel_FirstBlock(bmodel);
    if (status)
    {
        // Handle the error
        return 1;
    }
    while (!MTK_BlockModel_IsEof(bmodel))
    {
        double blockVolume = MTK_BlockModel_GetBlockMatchVolume(bmodel);
        if (blockVolume < 0)
        {
            // Handle the error
            return 1;
        }
        matchVolume += blockVolume;
        status = MTK_BlockModel_NextBlock(bmodel);
        if (status)
        {
            // Handle the error
            return 1;
        }
    }
    printf("Match volume with UseExactVolume set is: %f\n", matchVolume);
    if (MTK_BlockModel_Close(bmodel))
    {
        // Handle the error
        return 1;
    }
    return 0;
}
// Expected Output
// Match volume without UseExactVolume set is: 1164484.375000
// Match volume with UseExactVolume set is: 1166463.107557