geosoft.gxpy.project submodule

Geosoft desktop project interface, which provides access to an active and open Geosoft desktop project.

Classes:
Geosoft_project the geosoft project

Note

Test example: geosoft project tests

DOC_TYPE_3DV = '3DView'
DOC_TYPE_ALL = 'All'
DOC_TYPE_DATABASE = 'Database'
DOC_TYPE_GMS2D = 'GMS2D'
DOC_TYPE_GMS3D = 'GMS3D'
DOC_TYPE_GRID = 'Grid'
DOC_TYPE_MAP = 'Map'
DOC_TYPE_VOXEL = 'Voxel'
DOC_TYPE_VOXI = 'VoxelInversion'
class Geosoft_project

Bases: object

Use this class to interact with an open Geosoft project. This singleton class is available only from an extension running from an open Geosoft project.

current_3dv

the open geosoft_3dv that has current (or most recent) focus

current_database

the open database that has current (or most recent) focus

current_db_state()

Return the state of the current database.

Returns:dict of the current database state, {} if there is no current database.
‘disp_chan_list’ list of displayed channels
‘selection’ current selection as (line, channel, start_fid, end_fid)

New in version 9.2.

current_gmsys_2d

the open GM-SYS 2D model that has current (or most recent) focus

current_gmsys_3d

the open GM-SYS 3D model that has current (or most recent) focus

current_grid

the open grid that has current (or most recent) focus

current_map

the open map that has current (or most recent) focus

current_map_state()

Return the state of the current map.

Returns:dict of the current map state, {} if no current map.
‘current_view’ name of the current view
‘display_area’ (min_x, min_y, max_x, max_y) in units of the current view
‘3d_view_name’ if a 3D view, name of the view
‘point’ (x, y) of the current selection point
‘cursor’ (x, y) of the current cursor location

New in version 9.2.

current_voxel

the open voxel that has current (or most recent) focus

current_voxi

the open VOXI model that has current (or most recent) focus

gid

Geosoft ID of the user

menus

Oasis montaj menu information: (default_menus, loaded_menus, user_menus)

open_3dv

list of geosoft_3dv (3d views) open in a 3D viewer

open_databases

list of databases open as a database document

open_gmsys_2d

list of GM-SYS 2D models open as a document

open_gmsys_3d

list of GM-SYS 3D models open as a document

open_grids

list of grids open as a grid document

open_maps

list of maps open as a map document

open_voxels

list of voxels/voxets open as a document

open_voxi_models

list of VOXI models open as a document

project_3dv

list of geosoft_3dv (3D views) in the project

project_databases

list of databases in the project

project_gmsys_2d

list of GM-SYS 2D models in the project

project_gmsys_3d

list of GM-SYS 3D models in the project

project_grids

list of grids in the project

project_maps

list of maps in the project

project_voxels

list of voxels/voxettes in the project

project_voxi_models

list of VOXI models in the project

exception ProjectException

Bases: Exception

Exceptions from geosoft.gxpy.project.

New in version 9.1.

add_document(doc, type=None, display=True)

Add a document to the project. The document file can be any supported geosoft document type.

Parameters:
  • doc – file name for the document to open
  • type – one of DOC_TYPE, default will decode the type from the file extension
  • display – False to prevent opening of the document, though the document will be added as a document in the project explorer.

New in version 9.3.

get_user_input(title='Input required...', prompt='?', kind='string', default='', items='', filemask='')

Display a dialog prompt on the Geosoft Desktop and wait for user input. This method depends on user_input.gx and can only be used from an extension running inside a Geosoft Desktop application.

Parameters:
  • title – dialog box title. A description can be added as a second-line using a line-break. example: “Your title/nDescriptive help”
  • prompt – prompt string to present to the user.
  • kind – kind of response required: ‘string’, ‘int’, ‘float’, ‘file’, ‘colour’ or ‘list’
  • items – comma-separated string or list/tuple of items for kind=’list’
  • default – default value. For multifile can be a string (‘|’ delimiter) or list/tuple.
  • filemask – File type masks, Comma delimited, or a list/tuple. Examples: ‘.dat’, ‘*.dat,*.grd’, ‘**,*.grd’ for multiple files
Returns:

user response

Raise:

GXCancel if the user cancels the dialog

New in version 9.1.

pause(title='Pause...', cancel=False)

Display a pause dialog, wait for user to press continue or cancel

Parameters:
  • title – The pause dialog title, default is “Pause...”
  • cancel – If True, show a cancel button
Raises:

:py:ex:GXCancel if the user cancels the dialog

New in version 9.2.

remove_document(doc)

Remove a document from the project. The document is identified by the document name, which is either a complete file path name, with qualifiers, or the name of the document in the project storage.

Parameters:doc – document name (file and qualifiers if the document source is a file).

New in version 9.3.

running_script()
Returns:1 if running from a script, 0 if running interactively.

New in version 9.1.

user_message(title, message)

Display a message to the user

Parameters:
  • title – message box title
  • message – message

New in version 9.2.