Create Vein Surface: Automation
Note: This topic is aimed at users familiar with COM-aware scripting languages, and the vein-from-samples command. For an overview of scripting in this product, please refer to your scripting tutorial (Help | Scripting Tutorial).
Command Automation Overview
The following information relates to the vein-from-samples and surface-from-samples commands.
The Create Vein Surface task is a focussed tool for the calculation of hanging wall (HW) and/or footwall (FW) surfaces that represent vein or vein-like lodes. Similarly, the Create Contact Surface task is used to generate contact surfaces between groups of contiguous categorical values.
The vein-from-samples command features a COM interface that allows virtually all interactive options of vein modelling to be accessed via script.
As with many scriptable commands in Studio products, you can access vein-from-samples using the ParseCommand() method, followed by a series of parameters that control the output.
Scripted Command Initialization
As with the interactive usage of the
command, data must be loaded into memory before it can be accessed
by the vein-from-samples command. Once a DmApplication object has
been instantied (e.g. using "window.external;"), there are
multiple ways to load data, including the LoadFile()
and LoadFromProject() methods,
e.g.:
var objHoles = oDmApp.ActiveProject.Data.LoadFile("C:\\Database\\Drillholes.dm")
var objHoles = oDmApp.ActiveProject.Data.LoadFromProject("Drillholes")
The general syntax for this command is:
vein-from-samples [Drillhole Object] [Field Name] [Field Value] [Default Uncertainty (optional)] [Parameter string]
Where:
[Drillhole Object] is a mandatory parameter and is a fully-qualified object name as it appears in the Sheets control bar, e.g.:
"Drillholes=MyHoles (drillholes);"
[Field Name] is a mandatory parameter and is the name of the attribute containing the value to be modelled , e.g.:
"Fieldname=ROCK"
[Field Value] is a mandatory parameter and is the categorical value you wish to model, e.g.:
"Value=LODE"
[Default Uncertainty] is an optional parameter and is the default uncertainty value to be applied if a more specific (table-based) uncertainty value does not exist, or is not specified, e.g.:
"DefaultUncertainty=0.05;"
[Parameter String] is a semi-colon-separated string of parameters, all of which are optional, used to control how a surface or volume is generated. If no parameter value is listed, the default value will be used, e.g.:
"Continuity=14.5;BoundaryObject="MyString (strings)";PinchOut="yes";ClippingType="BoundaryString";Resolution="High";"
For more information on command parameters,
plus examples, see the following sections.
Command Parameters
The parameter string for vein-from-samples can contain any of the following items. All parameters must be separated by a semi-colon (;). No parameters are mandatory as default values will be used if any are absent.
Any data objects referenced within parameters must exist in memory before the command is called from script.
Parameter |
Description |
Default |
Example |
Data Context | |||
Drillholes (Mandatory) |
References the loaded drillholes object. |
null |
Drillholes=MyHoles (drillholes) |
FieldName (Mandatory) |
The attribute containing the value to be modelled |
null |
Fieldname=ROCK |
Value (Mandatory) |
The attribute value to be modelled |
null |
Value=LODE |
UseCurrentSection |
The plane to use when calculating surface normals with the Minimum Curvature method.
|
no |
UseCurrentSection=yes |
Edit Samples | |||
MergeGaps |
Control if/how sample gaps are treated:
|
0 |
MergeGaps=50 |
UseEndOfHolePoints |
Determines if the end-of-hole is used as a FW point if no other FW exists on the sample(s). Either yes or no. |
yes |
UseEndOfHolePoints=no |
Uncertainty | |||
DefaultUncertainty |
A numeric uncertainty value to be used if UncertaintyColumn is not specified, or it is specified and the value for a record is absent. Gaussian method surfacing only. |
0 |
DefaultUncertainty=0.05 |
UncertaintyColumn |
A numeric attribute in Drillholes containing per-record uncertainty values. Gaussian method surfacing only |
None - global or zero uncertainty will be used |
UncertaintyColumn=UNCERT |
UseUncertainty |
|
no |
UseUncertainty=yes |
Additional Points | |||
AdditionalPointsObject |
The full name of a loaded strings object. If not defined, no additional points will be used. |
null |
AdditionalPointsObject=Additional_Points_Drillholes (strings) |
AdditionalPointsUncertaintyColumn |
A numeric attribute of the AdditionalPointsObject (see above) describing per-point uncertainty values. If absent, DefaultUncertainty will be used. |
null |
AdditionalPointsUncertaintyColumn=UNCERCOL |
Boundary | |||
ClippingType |
Defines the type of boundary shaping to be applied. The following values are accepted:
|
|
ClippingType=AlphaShape;ClippingParameter=25;SegmentLength=90 ClippingType=AlignedSquare;ClippingParameter=50 ClippingType=Radius;ClippingParameter=10 ClippingType=RadialInterp;ClippingParameter=10 ClippingType=BoundaryString; BoundaryObject=MyBoundary (strings) |
BoundaryObject |
Mandatory if ClippingType=Custom. Denotes a loaded closed string to serve as a boundary limit. Warning: the boundary string must contain a field with an attribute name that matches FieldName. The values within this field will denote independent boundary strings. Even if your string object contains a single, closed string, this attribute must be present in order to apply a custom boundary via scripting. |
null |
ClippingType=BoundaryString; BoundaryObject=MyBoundary (strings) |
Faults | |||
FaultObject |
A loaded wireframe object containing fault data. Multiple fault wireframes within the file can be attributed by a unique FaultIDColumn value. |
null |
FaultObject=Fault_Sheet_Flattr/fault_sheet_flatpt (wireframe) |
FaultIDColumn |
Attribute that denotes independent fault sheets in the FaultObject. If not specified, the fault wireframe will be considered as a single fault sheet. |
null |
FaultIDColumn=SURF |
Controls | |||
Continuity |
A numeric value representing the continuity of sample values into inter-sample space. Gaussian method surfacing only |
Automatically calculated value based on sample spacing |
Continuity=14.5 |
UseAutoContinuity |
Choose if automatic continuity (per sample) settings are calculated and used. Either yes or no. Gaussian method surfacing only |
yes |
UseAutoContinuity=no |
MinimumThickness |
The value to be used to either remove data (below) or the depth to expand the output volume depending on whether RemoveBelow is "yes" or "no" (see below). |
0.05 |
MinimumThickness=0.25 |
MaximumThickness |
A value used to limit the maximum thickness of the output volume, regardless of other settings. |
0 (= not used) |
Maximum Thickness=3.4 |
RemoveBelow |
|
yes |
RemoveBelow=no |
Resolution |
Sets the density of the grid used to form the output volume, using one of these values:
|
Medium |
Resolution=Low" |
PinchOut |
Determines if HW and FW surfaces will be pinched out if they become inverted. Either yes or no. |
yes |
PinchOut=no |
TrendSmoothness |
A value from 0-100 that determines the waviness of the underlying trend surface. Should be a multiple of 5. |
20 |
TrendSmoothness=50 |
Output | |||
OutputVeinFile |
The name of the wireframe object to be created. |
"VeinSurf_[Attribute]_[Value]" |
OutputVeinFile=MyVein |
OutputMeanSurfaceFile |
If specified, a trend surface will be generated of the specified object name. |
"VeinTrend_[Attribute]_[Value]" |
OutputMeanSurfaceFile=MyMeanSurface |
SuppressOutput |
Define if summary information is exported to the Output window when vein-from-samples is executed. Permitted values are "yes" or "no" |
no |
SuppressOutput=yes |
SurfaceType |
Choose which data to be output from the command. Valid values are: 0: Hangingwall only 1: Footwall only 2: A volume representing both surfaces (default) |
2 |
SurfaceType=1 |
Command Automation Examples
Simple Lithological Modelling Example
In the following example, a file called "holes.dm" is loaded from the project directory and referenced as a loaded object. The value NLITH=3 is used to create a volume representing a non-pinched out surface. A Gaussian calculation will be performed to interpolate the HW and FW surfaces.
The surface is intersected with a fault surface ("Fault_Sheet_Flattr/fault_sheet_flatpt") splitting the output into independent two blocks, emulating a reverse fault.
The output volume (SurfaceType=2 is set as example, despite this being the default value) is clipped according to its alpha shape, and as the surface is suspected to be continuous but sparsely sampled, the output volume is expanded to a minimum of 0.1 meters throughout. The continuity and clipping parameter is automatically calculated.
The output volume will be used for downstream model sub-celling so is set to a high resolution.
Unless otherwise specified, default parameter values are used.
Finally, the output object is saved to disk as a wireframe pair file.
var oDmApp=window.external;
var objHoles=mApp.ActiveProject.Data.LoadFile("C:\\Database\\MyProjectFolder\\Holes.dm")
var vDrillholes = "Holes (drillholes);";
var vUseUncertainty = "yes;"
var vFaults = "Fault_Sheet_Flattr/fault_sheet_flatpt (wireframe);"
var vFaultIDCol = "COLOUR"
var vFieldName = "Fieldname=NLITH;";
var vValue = "Value=3;";
var vPinchOut = "no";
var vClipType = "AlphaShape";
var vClipRadius = 25;
var vThickness = 0.1;
var vOutput = "vein_from_samples_007";
var vSurfaceType = 2;
var Res = "High"
var vRemoveBelow = "no"; //Use Expand to option
var vCommand = "vein-from-samples " + vDrillholes + vFieldName + vValue + vUncertainty;
var vExtras = ";MinimumThickness="+ vThickness +
"; RemoveBelow="+vRemoveBelow +
"; UseUncertainty="+vUseUncertainty +
"; UseCurrentSection="+vUseCurrentSection +
"; OutputVeinFile="+ vOutput +
"; SurfaceType=" + vSurfaceType +
"; ClippingType=" + vClipType +
"; ClippingParameter=" + vClipRadius +
"; PinchOut=" + vPinchOut +
"; FaultObject=" + vFaults +
"; FaultIDColumn=" + vFaultIDCol +
"; PinchOut=" + vPinchOut +
"; Resolution=" + Res +
"; SuppressOutput=" + "yes" +
";"
oDmApp.ParseCommand(vCommand+vExtras);
var saveobj = oDmApp.ActiveProject.Data.IsLoaded(vOutput);
saveobj.SaveAsDatamineFile(vOutput, oDmApp.ActiveProject.ExtendedPrecision, true, ""); //save to physical file
Parameter Sensitivity Test Example
The next example tests the input samples' sensitivity to increasing continuity. The script outputs 10 volumes, with increasing continuity values. As a continuity test, UseUncertainty is set to "yes" to ensure a Gaussian calculation is performed (continuity is not relevant for Minimum Curvature calculations.
This script could easily be adapted to generate outputs for a range of parameter settings or, with nest for-next loops, a 2- or even 3-dimensional matrix of outputs (although be wary of the number of outputs you will be creating):
var oDmApp=window.external;
var objHoles=mApp.ActiveProject.Data.LoadFile("C:\\Database\\MyProjectFolder\\Holes.dm")
var vDrillholes = "Holes (drillholes);";
var vFieldName = "Fieldname=NLITH;";
var vValue = "Value=3;";
for (i = 20; i <= 30; i++) {
var vPinchOut = "no";
var vClipType = "AlphaShape";
var vUseUncertainty = "yes;"
var vContinuity = i;
var vClipRadius = 25;
var vThickness = 0.1;
var vOutput = "vein_from_samples_007";
var vSurfaceType = 2;
var Res = "High"
var vCommand = "vein-from-samples " + vDrillholes + vFieldName + vValue + vUncertainty;
var vExtras = "Continuity=" + vContinuity +
"; MinimumThickness="+ vThickness +
"; UseUncertainty="+vUseUncertainty +
"; OutputVeinFile="+ vOutput +
"; SurfaceType=" + vSurfaceType +
"; ClippingType=" + vClipType +
"; ClippingParameter=" + vClipRadius +
"; PinchOut=" + vPinchOut +
"; Resolution=" + Res +
";"
oDmApp.ParseCommand(vCommand+vExtras);
var saveobj = oDmApp.ActiveProject.Data.IsLoaded(vOutput + "_" + i);
saveobj.SaveAsDatamineFile(vOutput, oDmApp.ActiveProject.ExtendedPrecision, true, ""); //save to physical file
}
Related topics and activities