grail.ms3d.mssys Module

Version: 16.2

Table of Contents

Overview

Provides system level access to the MineSight®-3D application.

Of particular interest is the use of the stdout objects provided in this module that allow you to write data to the message window.

Using Python's print in Embedded Grail

Python's print keyword provides a convenient method for outputting strings of text to the user. With MineSight® Grail Embedded you will be able output strings of text via the message window from within a Python script.

Starting with MineSight® Grail v3.60-02, all python print statements will be automatically redirected to the MineSight® 3-D Message window when MineSight® Grail is executed in an Embedded context.

You can re-instate the sys.stdout object to its original value at any time with the following line,

sys.stdout = sys.__stdout__

Functions

get_window_handle()
Experimental. This returns the Microsoft Windows Handle (HWND) for the MineSight®-3D desktop window.
redirect_error_to_message_win()
If you want to redirect error messages to the message window, call this function and all future calls to sys.stderr will appear as an error within the message window.
clear_message_win()
Will clear the contents of the message window.

Data

stdout

A file-like object that provides write() to perform standard output writes. For example the following line will print a string out to the message window,

mssys.stdout.write("Hello World!")

A string will be written out to the message window whenever each time this call is made.

Changes made to this object include,

  • Starting with MineSight® Grail v3.60-03 this will be equivalent to sys.stdout, and the python print statement. So the following statements are equivalent within an Embedded Script,

    print "Hello World!"
    sys.stdout.write("Hello World!")
    mssys.stdout.write("Hello World!")
  • Starting with MineSight® Grail v4.50-00 the flush function will no longer have any effect.

stderr

A file-like object that provides write and flush to perform standard error output writes. For example the following line will print an error messages out to the message window,

mssys.stderr.write("This is an error message!")

Changes made to this object include,

  • Starting with MineSight® Grail v3.60-03 this will be equivalent to sys.stderr object. So the following statements are equivalent within an Embedded Script,

    sys.stderr.write("This is an error message!")
    mssys.stderr.write("This is an error message!")
  • Starting with MineSight® Grail v4.50-00 the flush function will no longer have any effect.

stdwarn

A file-like object that provides a write function to perform standard warning output writes. For example the following line will print a warning message to the message window,

mssys.stdwarn.write("This is a warning message\n")
IS_DEBUG
Is True if the MineSight® Grail Embedded extensions were compiled in debug mode. For internal usage only.
VERSION_INFO
A 4 integer long tuple containing the full version number of MS3D.
VERSION
A version string for MS3D.