Match Functions
Functions:
MTK_BlockModel_AddMatchTriangulation
int MTK_BlockModel_AddMatchTriangulation( MTK_BlockModel* bmodel, const char* triName );
Description
Add triangulation to match blockmodel against.
Parameters
bmodel
pointer to an MTK_BlockModel struct
triName
triangulation name (const char*)
Return Value
0
success
other
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
int MTK_BlockModel_ClearMatch(MTK_BlockModel* bmodel);
Description
Clear current blockmodel match.
Parameters
bmodel
pointer to an MTK_BlockModel struct
Return Value
0
success
other
failure
MTK_BlockModel_GetBlockMatchExtent
int MTK_BlockModel_GetBlockMatchExtent( MTK_BlockModel* bmodel, double* x0, double* y0, double* z0, double* x1, double* y1, double* z1 );
Description
Return the match extent of the current matched block.
Parameters
bmodel
pointer to an MTK_BlockModel struct
x0
lower left x coordinate (double*)
y0
lower left y coordinate (double*)
z0
lower left z coordinate (double*)
x1
upper right x coordinate (double*)
y1
upper right y coordinate (double*)
z1
upper right z coordinate (double*)
Return Value
0
success
other
failure
MTK_BlockModel_GetBlockMatchVolume
double MTK_BlockModel_GetBlockMatchVolume(MTK_BlockModel* bmodel);
Description
Get current block matched volume.
Parameters
bmodel
pointer to an MTK_BlockModel struct
Return Value
double
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
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 );
Description
Set the match extent in model coordinates.
Parameters
bmodel
pointer to an MTK_BlockModel struct
x0
lower left x coordinate (double)
y0
lower left y coordinate (double)
z0
lower left z coordinate (double)
x1
upper right x coordinate (double)
y1
upper right y coordinate (double)
z1
upper right z coordinate (double)
Return Value
0
success
other
failure
MTK_BlockModel_SetMatchSelectString
int MTK_BlockModel_SetMatchSelectString( MTK_BlockModel* bmodel, const char* selection );
Description
Set a block model's match from a string of options.
Parameters
bmodel
pointer to an MTK_BlockModel struct
selection
The selection string to be used for the match (const char*)
The list of options for the selection string (multiple can be used at once):
-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()
Return Value
0
success
other
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
int MTK_BlockModel_SetUseExactVolume(MTK_BlockModel* bmodel, const int& use);
Description
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.
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 (int)
Return Value
0
success
other
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