========================= ``grail.data.msr`` module ========================= .. include:: ../../version.h .. include:: ref.h .. contents:: Table of Contents :backlinks: top -------- 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 :c:`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 :c:`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 --------- :df:`create_legend(path)` Deprecated alias as of v4.50: :df:`createlegend` Creates a new :c:`Legend` object at the path's location. If a file already exists at the path's location, this function will generate a built-in :e:`IOError` exception [#python-lib-builtin-exceptions]_. See also `Legend` below. :df:`open_legend(path)` Deprecated alias as of v4.50: :df:`createlegend` Opens an existing :c:`Legend` object indicated by the path. See also `Legend` below. :df:`open_geomview(path)` Opens an existing geomview MSR at the given :a:`path`. The object can only be accessed in read only mode. This will return a :c:`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`_ * :f:`create_legend` * :f:`open_legend` * `GeomView`_ * :f:`open_geomview` Legend ------ The :c:`Legend` class provides read/write access to the contents of a MineSightŪ Resource (MSR) file. :dc:`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 :d:`legendTYPE_COMPANY`, then the values stored under :f:`writecompanyimage()` is important. However, if the legend type is :d:`legendDH_TYPE`, then the :f:`writedhitem()`, :f:`writedhdisplay()` values become important. This means that even though you may have written values into one section of the :c:`Legend` MSR, for instance the drillholes, these values will not be effective until you change the type for the :c:`Legend` MSR. .. Note:: The :c:`Legend` object has a handle to the underlying file during all read/write operations. Call :f:`close()` to explicitly close the :c:`Legend` object. :df:`close()` Explicitly closes the operating system handle to the MSR file. If you do not call this method, the :df:`close()` operation will occur when the :c:`Legend` object is cleaned up by the Python garbage collector [#python-lib-gc]_. :df:`read_body_font()` Deprecated alias as of v4.50: :df:`readbodyfont`. Returns the type of body font used for this legend. :df:`read_body_size()` Deprecated alias as of v4.50: :df:`readbodysize` Get the size of the legend body's font size. :df:`read_company_image()` Deprecated alias as of v4.50: :df:`readcompanyimage` Returns the path to the company image for this legend. :df:`read_company_isnoise()` Deprecated as of v5.50. This function will now always return False. :df:`read_company_isreduce()` Deprecated as of v5.50. This function will now always return False. :df:`read_create_time()` Deprecated alias as of v4.50: :df:`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 [#python-lib-time]_. An example would be, .. Python:: import time from grail.data import msr leg = msr.createlegend("mylegend.msr") print time.ctime(leg.readcreatetime()) :df:`read_cutoff_display()` Deprecated alias as of v4.50: :df:`readcutoffdisplay` Returns the cutoff display type used for the legend. :df:`read_cutoff_item()` Deprecated alias as of v4.50: :df:`readcutoffitem` Returns the cutoff item used for the legend. :df:`read_cutoff_precision()` Deprecated alias as of v4.50: :df:`readcutoffprecision` Returns the cutoff precision used for the legend. :df:`read_dhdisplay()` Deprecated alias as of v4.50: :df:`readdhdisplay` Returns the type of drillhole display used for the legend. :df:`read_dhobject()` Deprecated alias as of v4.50: :df:`readdhobject` Returns the drillhole object used for the legend. :df:`read_geomobject()` Deprecated alias as of v4.50: :df:`readgeomobject` Returns the type of geometry object used. :df:`read_material()` Deprecated alias as of v4.50: :df:`readmaterial` Returns the material associated with the legend. :df:`read_memo()` Deprecated alias as of v4.50: :df:`readmemo` Returns the contents of the memo field for this legend. :df:`read_mvdisplay()` Deprecated alias as of v4.50: :df:`readmvdisplay` Returns the type of model view display used. :df:`read_mvobject()` Deprecated alias as of v4.50: :df:`readmvobject` Return the name of the model view object used. :df:`read_title_font()` Deprecated alias as of v4.50: :df:`readtitlefont` Returns the type of title font used for this legend. :df:`read_title_line(lineno)` Deprecated alias as of v4.50: :df:`readtitleline` Returns the contents of a given title line. :df:`read_title_size()` Deprecated alias as of v4.50: :df:`readtitlesize` Get the font size of the legend's title :df:`read_type()` Deprecated alias as of v4.50: :df:`readtype` Read the type of legend. :df:`read_unit()` Deprecated alias as of v4.50: :df:`readunit` Returns the type of units used for this legend. :df:`write_body_font(font)` Deprecated alias as of v4.50: :df:`writebodyfont` Set the type of font to use for the legend. :df:`write_body_size(size)` Deprecated alias as of v4.50: :df:`writebodysize` Set the size of the legend's body font. This is the size in either centimeters or inches. :df:`write_company_image(path)` Deprecated alias as of v4.50: :df:`writecompanyimage` Set the path to the company image you wish to use for the legend. This is only active when the :c:`Legend` type is set to :d:`legendTYPE_COMPANY`. :df:`write_company_isnoise(yesno)` Deprecated as of v5.50, this function will do nothing. :df:`write_company_isreduce(yesno)` Deprecated as of v5.50, this function will do nothing. :df:`write_cutoff_display(display)` Deprecated alias as of v4.50: :df:`writecutoffdisplay` Set the cutoff display type you wish to use. This is only active when the :c:`Legend` type is set to :d:`legendTYPE_CUTOFF`. Valid :a:`display` values are, * :d:`legendCUTOFF_DISPLAY_COLOR` * :d:`legendCUTOFF_DISPLAY_PATTERN` :df:`write_cutoff_item(item)` Deprecated alias as of v4.50: :df:`writecutoffitem` Set the cutoff item you wish to use in the legend. This is only active when the :c:`Legend` type is set to :d:`legendTYPE_CUTOFF`. :df:`write_cutoff_precision(precision)` Deprecated alias as of v4.50: :df:`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 :c:`Legend` type is set to :d:`legendTYPE_CUTOFF`. Argument: :a:`precision` : integer The number of decimal places you wish to use for cutoff precision. :df:`write_dhdisplay(display)` Deprecated alias as of v4.50: :df:`writedhdisplay`. Set the type of drillhole display you wish to use. This is only active when the :c:`Legend` type is set to :d:`legendTYPE_DH`. Valid :a:`display` values are, * :d:`legendDH_DISPLAY_2D` * :d:`legendDH_DISPLAY_3D` :df:`write_dhobject(dhname)` Deprecated alias as of v4.50: :df:`writedhobject`. Set the drillhole object you wish to use for the legend. This is only active when the :c:`Legend` type is set to :d:`legendTYPE_DH`. :df:`write_geomobject(geometry)` Deprecated alias as of v4.50: :df:`writegeomobject`. Set the geometry object you wish to display. This is only active when the :c:`Legend` type is set to :d:`legendTYPE_GEOM`. :df:`write_memo(memo)` Deprecated alias as of v4.50: :df:`writememo`. Set the contents of the memo field for the Legend. :df:`write_mvdisplay(type)` Deprecated alias as of v4.50: :df:`writemvdisplay`. Set the type of model view display you wish to use. This is only active when the :c:`Legend` type is set to :d:`legendTYPE_MV`. Valid :a:`type` values are, * :d:`legendMV_DISPLAY_2D` * :d:`legendMV_DISPLAY_3D` :df:`write_mvobject(modelview)` Deprecated alias as of v4.50: :df:`writemvobject`. Set the modelview object you wish to display. This is only active when the :c:`Legend` type is set to :d:`legendTYPE_MV`. :df:`write_title_font(font)` Deprecated alias as of v4.50: :df:`writetitlefont`. Set title font for a legend. :df:`write_title_line(lineno, text)` Deprecated alias as of v4.50: :df:`writetitleline`. Set the text to use for the given title at a given line number. :df:`write_title_size(size)` Deprecated alias as of v4.50: :df:`writetitlesize`. Set the font size for the legend's title. This is the the size in either centimeters or inches. :df:`write_type(type)` Deprecated alias as of v4.50: :df:`writetype` Write the type of legend. Valid :a:`type` values are, * :d:`legendTYPE_COMPANY` * :d:`legendTYPE_CUTOFF` * :d:`legendTYPE_DH` * A "DrillHole" type. * :d:`legendTYPE_GEOM` * A geometry type. * :d:`legendTYPE_MV` * A modelview type. All other types values will be ignored. :df:`write_unit(unit)` Deprecated alias as of v4.50: :df:`writeunit`. Set the type of units to use for the legend. Valid :a:`units` are, * :d:`legendUNIT_METRIC` * :d:`legendUNIT_IMPERIAL` GeomView -------- :dc:`GeomView` Provides read-only access to the geomview MinSight(r) Resource (MSR) file. You can open a new :c:`GeomView` object via the :f:`open_geomview` function. To close the file call :f:`close`, otherwise the file will close when you your object is garbage collected. :df:`read_connection_string()` This is the ODBC connection string used to connect to the AGDM for this :c:`GeomView` object. :df:`read_query_string()` This is the query that was used to generate the contents of the :c:`GeomView` object. ---- Data ---- :dd:`legendCUTOFF_DISPLAY_COLOR` :dd:`legendCUTOFF_DISPLAY_PATTERN` Types of cutoffs that a :c:`Legend` can have. :dd:`legendDH_DISPLAY_2D` :dd:`legendDH_DISPLAY_3D` Types of drillhole displays that a :c:`Legend` can have. :dd:`legendMV_DISPLAY_2D` :dd:`legendMV_DISPLAY_3D` Types of modelview displays that a :c:`Legend` can have. :dd:`legendTYPE_COMPANY` :dd:`legendTYPE_CUTOFF` :dd:`legendTYPE_DH` :dd:`legendTYPE_GEOM` :dd:`legendTYPE_MV` The different types that a :c:`Legend` can assume. This defines how the legend will be interpreted by MineSightŪ 3D. For example, if the legend is a :d:`legendTYPE_COMPANY` then the relevant information from the company image slots will be read. :dd:`legendUNIT_IMPERIAL` :dd:`legendUNIT_METRIC` Defines the different types of units a :c:`Legend` can be in. ---- .. [#python-lib-builtin-exceptions] "Built-in Exceptions" *Python Library Reference*. 19 December 2001. 31 May 2004. .. [#python-lib-gc] "gc -- Garbage Collector interface" *Python Library Reference*. 21 December 2001. 31 May 2004. .. [#python-lib-time] "time -- Time access and conversions" *Python Library Reference*. 21 December 2001. 31 May 2004.