grail.data.msr module

Version: 16.2

Table of Contents

Overview

Provides access to the MineSight® 3D MineSight® Resource (MSR) files. The goal here is to eventually provide an interface to all the MSR files.

Each MSR file will be represented by a Python Object that provides read/write methods to the internal data.

Difference with the grail.data.geometry module

The MineSight® Resource (MSR) objects in this module differ from the Geometry object in the grail.data.geometry module. The MSR objects within this module all read and write data in real time. In other words once you have opened a MSR object, all subsequent read/write operations are performed immediately. As a contrast Geometry object will read all the data into memory, allow you to perform set/get with data in memory, and then allow you to commit your changes to disk.

Functions

create_legend(path)

Deprecated alias as of v4.50: createlegend

Creates a new Legend object at the path's location. If a file already exists at the path's location, this function will generate a built-in IOError exception [1].

See also Legend below.

open_legend(path)

Deprecated alias as of v4.50: createlegend

Opens an existing Legend object indicated by the path. See also Legend below.

open_geomview(path)

Opens an existing geomview MSR at the given path. The object can only be accessed in read only mode. This will return a GeomView object (see GeomView) below.

MineSight® Resource (MSR) Object

The MSR Objects that provide access to the file contents are all accessiable via the Functions show below,

Legend

The Legend class provides read/write access to the contents of a MineSight® Resource (MSR) file.

Legend

Defines a file-like object that provides read/write access to a legend MSR file.

Each type (read/write type) of MSR indicates what data is relevant inside the MSR. For example, if the legend type is a legendTYPE_COMPANY, then the values stored under writecompanyimage() is important. However, if the legend type is legendDH_TYPE, then the writedhitem(), writedhdisplay() values become important. This means that even though you may have written values into one section of the Legend MSR, for instance the drillholes, these values will not be effective until you change the type for the Legend MSR.

Note

The Legend object has a handle to the underlying file during all read/write operations. Call close() to explicitly close the Legend object.

close()

Explicitly closes the operating system handle to the MSR file. If you do not call this method, the close() operation will occur when the Legend object is cleaned up by the Python garbage collector [2].
read_body_font()

Deprecated alias as of v4.50: readbodyfont.

Returns the type of body font used for this legend.

read_body_size()

Deprecated alias as of v4.50: readbodysize

Get the size of the legend body's font size.

read_company_image()

Deprecated alias as of v4.50: readcompanyimage

Returns the path to the company image for this legend.

read_company_isnoise()
Deprecated as of v5.50. This function will now always return False.
read_company_isreduce()
Deprecated as of v5.50. This function will now always return False.
read_create_time()

Deprecated alias as of v4.50: readcreatetime

Returns the time in seconds (since Epoch) that the file was created. To get the time in a usable format use Python's time module [3].

An example would be,

import time
from grail.data import msr

leg = msr.createlegend("mylegend.msr")
print time.ctime(leg.readcreatetime())
read_cutoff_display()

Deprecated alias as of v4.50: readcutoffdisplay

Returns the cutoff display type used for the legend.

read_cutoff_item()

Deprecated alias as of v4.50: readcutoffitem

Returns the cutoff item used for the legend.

read_cutoff_precision()

Deprecated alias as of v4.50: readcutoffprecision

Returns the cutoff precision used for the legend.

read_dhdisplay()

Deprecated alias as of v4.50: readdhdisplay

Returns the type of drillhole display used for the legend.

read_dhobject()

Deprecated alias as of v4.50: readdhobject

Returns the drillhole object used for the legend.

read_geomobject()

Deprecated alias as of v4.50: readgeomobject

Returns the type of geometry object used.

read_material()

Deprecated alias as of v4.50: readmaterial

Returns the material associated with the legend.

read_memo()

Deprecated alias as of v4.50: readmemo

Returns the contents of the memo field for this legend.

read_mvdisplay()

Deprecated alias as of v4.50: readmvdisplay

Returns the type of model view display used.

read_mvobject()

Deprecated alias as of v4.50: readmvobject

Return the name of the model view object used.

read_title_font()

Deprecated alias as of v4.50: readtitlefont

Returns the type of title font used for this legend.

read_title_line(lineno)

Deprecated alias as of v4.50: readtitleline

Returns the contents of a given title line.

read_title_size()

Deprecated alias as of v4.50: readtitlesize

Get the font size of the legend's title

read_type()

Deprecated alias as of v4.50: readtype

Read the type of legend.

read_unit()

Deprecated alias as of v4.50: readunit

Returns the type of units used for this legend.

write_body_font(font)

Deprecated alias as of v4.50: writebodyfont

Set the type of font to use for the legend.

write_body_size(size)

Deprecated alias as of v4.50: writebodysize

Set the size of the legend's body font. This is the size in either centimeters or inches.

write_company_image(path)
Deprecated alias as of v4.50: writecompanyimage

Set the path to the company image you wish to use for the legend. This is only active when the Legend type is set to legendTYPE_COMPANY.

write_company_isnoise(yesno)
Deprecated as of v5.50, this function will do nothing.
write_company_isreduce(yesno)
Deprecated as of v5.50, this function will do nothing.
write_cutoff_display(display)

Deprecated alias as of v4.50: writecutoffdisplay

Set the cutoff display type you wish to use. This is only active when the Legend type is set to legendTYPE_CUTOFF.

Valid display values are,
  • legendCUTOFF_DISPLAY_COLOR
  • legendCUTOFF_DISPLAY_PATTERN
write_cutoff_item(item)

Deprecated alias as of v4.50: writecutoffitem

Set the cutoff item you wish to use in the legend. This is only active when the Legend type is set to legendTYPE_CUTOFF.

write_cutoff_precision(precision)

Deprecated alias as of v4.50: writecutoffprecision.

Set the precision you should use for a cutoff value. Precision is indicated in the number of decimal points you wish to use. This is only active when the Legend type is set to legendTYPE_CUTOFF.

Argument:
precision : integer
The number of decimal places you wish to use for cutoff precision.
write_dhdisplay(display)

Deprecated alias as of v4.50: writedhdisplay.

Set the type of drillhole display you wish to use. This is only active when the Legend type is set to legendTYPE_DH.

Valid display values are,
  • legendDH_DISPLAY_2D
  • legendDH_DISPLAY_3D
write_dhobject(dhname)

Deprecated alias as of v4.50: writedhobject.

Set the drillhole object you wish to use for the legend. This is only active when the Legend type is set to legendTYPE_DH.

write_geomobject(geometry)

Deprecated alias as of v4.50: writegeomobject.

Set the geometry object you wish to display. This is only active when the Legend type is set to legendTYPE_GEOM.

write_memo(memo)

Deprecated alias as of v4.50: writememo.

Set the contents of the memo field for the Legend.

write_mvdisplay(type)

Deprecated alias as of v4.50: writemvdisplay.

Set the type of model view display you wish to use. This is only active when the Legend type is set to legendTYPE_MV.

Valid type values are,
  • legendMV_DISPLAY_2D
  • legendMV_DISPLAY_3D
write_mvobject(modelview)

Deprecated alias as of v4.50: writemvobject.

Set the modelview object you wish to display. This is only active when the Legend type is set to legendTYPE_MV.

write_title_font(font)

Deprecated alias as of v4.50: writetitlefont.

Set title font for a legend.

write_title_line(lineno, text)

Deprecated alias as of v4.50: writetitleline.

Set the text to use for the given title at a given line number.

write_title_size(size)

Deprecated alias as of v4.50: writetitlesize.

Set the font size for the legend's title. This is the the size in either centimeters or inches.

write_type(type)

Deprecated alias as of v4.50: writetype

Write the type of legend.

Valid type values are,
  • legendTYPE_COMPANY

  • legendTYPE_CUTOFF

  • legendTYPE_DH
    • A "DrillHole" type.
  • legendTYPE_GEOM
    • A geometry type.
  • legendTYPE_MV
    • A modelview type.

All other types values will be ignored.

write_unit(unit)

Deprecated alias as of v4.50: writeunit.

Set the type of units to use for the legend.

Valid units are,
  • legendUNIT_METRIC
  • legendUNIT_IMPERIAL

GeomView

GeomView

Provides read-only access to the geomview MinSight(r) Resource (MSR) file. You can open a new GeomView object via the open_geomview function. To close the file call close, otherwise the file will close when you your object is garbage collected.

read_connection_string()

This is the ODBC connection string used to connect to the AGDM for this GeomView object.

read_query_string()

This is the query that was used to generate the contents of the GeomView object.

Data

legendCUTOFF_DISPLAY_COLOR

legendCUTOFF_DISPLAY_PATTERN
Types of cutoffs that a Legend can have.

legendDH_DISPLAY_2D

legendDH_DISPLAY_3D
Types of drillhole displays that a Legend can have.

legendMV_DISPLAY_2D

legendMV_DISPLAY_3D
Types of modelview displays that a Legend can have.

legendTYPE_COMPANY

legendTYPE_CUTOFF

legendTYPE_DH

legendTYPE_GEOM

legendTYPE_MV
The different types that a Legend can assume. This defines how the legend will be interpreted by MineSight® 3D. For example, if the legend is a legendTYPE_COMPANY then the relevant information from the company image slots will be read.

legendUNIT_IMPERIAL

legendUNIT_METRIC
Defines the different types of units a Legend can be in.

[1]"Built-in Exceptions" Python Library Reference. 19 December 2001. 31 May 2004. <http://www.python.org/doc/2.2/lib/module-exceptions.html>
[2]"gc -- Garbage Collector interface" Python Library Reference. 21 December 2001. 31 May 2004. <http://www.python.org/doc/2.2/lib/module-gc.html>
[3]"time -- Time access and conversions" Python Library Reference. 21 December 2001. 31 May 2004. <http://www.python.org/doc/2.2/lib/module-time.html>