You are on page 1of 10

MineSight® and Python®

MineSight® and Python®


Mintec, Inc. continues to integrate Python® with MineSight® 3-D (MS3D) and the MineSight®
Compass™ (MSCompass) programs. The changes in the last year include a new series of sample scripts,
new documentation, new MineSight® Interactive Planner (MSIP) reserve scripts, MineSight® Grail
(MSGrail) functionality and new multipurpose scripts.
The MineSight® Update CD has options to install the required files either to a local computer or to a
network drive. The differences between these installation options is the location of the Python® files. The
default installation is local, which places the files on the local hard disk. Python® 2.2.3 is installed along
with the Numeric, Win32all, and Pmw site-packages. Some MineSight® Operations sites also install the
PIL and reportlab site-packages. The interface between Python® and MineSight® is the MSGrail library.
MSGrail provides the links to the MineSight® drillhole and model files.
The Python® scripts used with MineSight® are of three types:
1- General scripts that can be run from the command line or from within MSCompass,
2 - Embedded scripts that must be run from within MineSight®, and
3 - Scripts that must be run within an MSIP Object (IPO).
Generally, scripts that must be run within MineSight® have a prefix of em-, while scripts that must run
within an IPO have the prefix of ip-. To run a script within MineSight®, follow the path File | Scripts |
Run Script and select the script. MineSight® will remember which scripts have been run. To run an IP
script, add the script to the list of scripts in the Script tab of the IPO. To run the general scripts from
outside of MineSight®, you can create a shortcut on the desktop or from the Start menu specify the script
and the directory where it should be run.
General Python® Information
New this year is the MineSight®-info script, which reports information from the computer which may
be helpful in viewing the system configuration. This script can be run from the command line or from
MineSight®. This script has multiple tabs with information drawn from MineSight®, Python®, MSGrail,
and the registry.

Global
Mining
Software
Solutions
Since
1970

Page 1
MineSight® and Python®

New Documentation for Scripts


The MineSight® Scripts help link is found on the Welcome to MineSight® page of the MineSight® Help
file. This document is a compiled HTML help (.chm) format file named scripts.chm located in the
c:\winexe\helpdoc folder.

Clicking on the MineSight® Scripts link opens this file:

Global
Mining
Software
Solutions
Since
1970

Page 2
MineSight® and Python®

The General script area has the listing of supplied general scripts located in the c:\winexe\
scripts folder. This is the first place to find what scripts are available. Each script is hyperlinked
to the specific documentation for that script. The ones that have the em- prefix must be run from
within MineSight®. Attroascii, contoursFromDir, createPartials, poly2Rpt, and
shellRpt may be run from inside or from outside MineSight®.

The Reserves (MSIP) list shows six new scripts that have the prefix batch-ip-. These scripts replicate
the ip- reserves scripts, but do not require you to be in an IPO. The beauty of these scripts is that there
is no interaction required by the user, and no possibility of introducing an error into the database.
These scripts have two parameters: mydsn and myplan. Myplan is the Open Database Communication
(ODBC) Data Source Name (DSN) of the Attributed Geometry Data Model (AGDM) database along
with the password. Myplan is the plan name (ipset) to be reported. The parameters can be passed to the
scripts as arguments or edited in the script.
For example, if running batch-ip-period.py as part of the end-of-month (EOM) multirun,
the procedure RUNCMD.DAT would be used and the command batch-ip-period.py ms_
attributed may08 would be entered. This would run the batch-ip-period report on the ODBC
name ms_attributed and report the period may08. A shortcut could be placed on the mine
managers desktop that could run batch-ip-period.pyc or batch-ip-summary.pyc to
summarize the mining progress for the month.

Global
Mining
Software
Solutions
Since
1970

Page 3
MineSight® and Python®

New MSGrail Documentation


The updated MSGrail documentation link is found on the Welcome to MineSight® page of the
MineSight® Help as a compiled HTML help (.chm) format file named graildoc.chm located
in c:\winexe\helpdoc. Of particular interest for those just starting to use Python®, will be the
Getting Started and Frequently Asked Questions links. For those that are writing scripts, the Library
Reference link is invaluable. The Library Reference page is shown below.

New MSCompass Procedure – ModelCalcEngine.pyc


ModelCalcEngine is a Python® procedure that uses MSGrail and standalone engines to provide
enhanced 3DBM calculations. ModelCalcEngine.pyc has incredible flexibility in selecting blocks
and defining the calculation applied to the blocks. This procedure can be run from MSCompass or from
the command line. If running from the command line, a project control file must be selected.
The procedure follows the Python® procedure convention using the path File | Options | Help, a
folder tree showing the organization of the procedure and panels for user interaction. The File choice lets
you run the procedure and manage the variables. The Manage Variables of Python® procedures is the
equivalent of the Save Response/Load Response of non-Python® procedures. The Option choice lets
you expand all the folders. The Help choice brings up the script help file.
Global
The main script widow will have different panels on the right side, depending on which folder is Mining
selected on the left side of the window. In general, the flow of the data is top down. The objects used to
Software
Limit By or Limit To must already exist.
Solutions
Selection Folder
Since
The Model Selection and Limits panel lets you select the particular 3DBM file of interest using a 1970
drop down list of available files. Like standard MineSight® procedures, you can limit the calculation by
use of a boundary polygon, coordinate limits, or range/omits on items in the 3DBM. Additionally, you
can limit the calculations to within polygons on levels, between surfaces, or within solids. Depending on
your selections in the panel, different folders in the Limit By and Limit To tree will become active.

Page 4
MineSight® and Python®

Limit By Folder
The Limit By Boundary panel allows you to select a geometry object in your MineSight® project.

The Limit by Coordinates panel brings up a panel with slider bars allowing you to select the minimum
and maximum level, row, or column. The display shows both the coordinates and the index values.

Global
Mining
Software
Solutions
Since
1970

Page 5
MineSight® and Python®

The Limit by Conditions panel lets you select one or more items and test them against a value. The
testing options are equality, less than, less than or equal to, greater than, greater than or equal to, not
equal to, is defined, and is not defined. Unlike standard MSCompass procedures, multiple conditions can
be either Boolean AND or OR. Note that if a condition entered is outside of the defined range of the item,
the line turns pink until the value is within the range. If you encounter a pink line, adjust your value to
be within the defined ranges.

Limit To Folder
The Use Level Polygons panel allows multiple boundary polygons to be used to limit the
calculations. These polygons can be on the Toe, Mid-Bench, or Crest elevations of the levels. Note that
the order of the objects doesn’t affect the results, but will affect the Audit trail report.

Global
Mining
Software
Solutions
Since
1970

The Control by Surfaces panel allows the selection of multiple geometry objects that have a single
surface to be used to control the area of calculations. These surfaces could be the original topographical
surface and the ultimate pit surface or different pit phases. Because the limiting surfaces are applied
sequentially, the order is important, so there are the standard ordering arrows in the panel.

Page 6
MineSight® and Python®

The Control by Solids panel allows multiple solids to be selected to limit the calculations. Note that
the order of the objects doesn’t affect the results, but will affect the Audit trail report.

Calculations Folder
The Calculation Items panel is where you select which items in the 3DBM will be used in the
calculations and set their undefined values.

Global
Mining
Software
Solutions
Since
1970

Page 7
MineSight® and Python®

The Calculation Coding panel is where you enter in the calculations to be performed. The
calculations are done using Python®, which means that you have total control over the level of complexity
of the calculation. Some common expressions are provided as an aid in typing the calculations. The
calculations can be exported to a file for importing later. A single block can be tested with the code. The
single block to test is defined in the Summary folder Test One Block panel.

The Options panel is similar to the Coding panels in the MineSight® DH View and Model View
objects. Since partial blocks may be selected, you need to specify a minimum percentage that a block
must have to be coded.
The resolution of the blocks used in the calculation of the block partial percents, e.g., number of sub-
blocks, can be changed from the default that is read in from the MineSight® project.
An Audit report on the calculations can be created. No Audit report will be created if the detail level is
set to none. The location of the Audit report and the option to open the report can be set.
Validation of the objects used by the Limit By and Limit To folders can be done prior to the
calculation. Since the purpose of a multirun is to run without user intervention, validation should be
done prior to using the procedure in a multirun.

Global
Mining
Software
Solutions
Since
1970

Page 8
MineSight® and Python®

Summary Folder
The Responses panel shows the settings as defined by the previous panels. This is useful in checking
the entries in the previous panels.

The Test One Block panel lets you select which block to test in the Calculation Coding panel.

Global
Mining
Software
Solutions
Since
1970
Menubar Options
Run Procedure will run the script.
Manage Variables.

Page 9
MineSight® and Python®

This is equivalent to the Save Reponses/Load Responses of standard MSCompass procedures.


Help brings up the hypertext help file. Detailed information on each panel is available.

Global
Mining
Software
Solutions
Since
1970

Page 10

You might also like