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

Constants
DOC_TYPE_DATABASE

DOC_TYPE_GRID

DOC_TYPE_MAP

DOC_TYPE_3DV

DOC_TYPE_VOXEL

DOC_TYPE_VOXI

DOC_TYPE_GMS3D

DOC_TYPE_GMS2D

DOC_TYPE_ALL

Note

Test example: geosoft project tests

class Geosoft_project[source]

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.

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

property current_3dv

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

property current_database

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

current_db_state()[source]

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.

property current_gmsys_2d

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

property current_gmsys_3d

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

property current_grid

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

property current_map

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

current_map_state()[source]

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.

property current_voxel

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

property current_voxi

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

property gid

Geosoft ID of the user

property menus

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

property open_3dv

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

property open_databases

list of databases open as a database document

property open_gmsys_2d

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

property open_gmsys_3d

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

property open_grids

list of grids open as a grid document

property open_maps

list of maps open as a map document

property open_voxels

list of voxels/voxets open as a document

property open_voxi_models

list of VOXI models open as a document

property project_3dv

list of geosoft_3dv (3D views) in the project

property project_databases

list of databases in the project

property project_gmsys_2d

list of GM-SYS 2D models in the project

property project_gmsys_3d

list of GM-SYS 3D models in the project

property project_grids

list of grids in the project

property project_maps

list of maps in the project

property project_voxels

list of voxels/voxettes in the project

property project_voxi_models

list of VOXI models in the project

exception ProjectException(message)[source]

Bases: geosoft.GXRuntimeError

Exceptions from geosoft.gxpy.project.

New in version 9.1.

add_document(doc, type=None, display=True)[source]

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:

    DOC_TYPE_DATABASE DOC_TYPE_GRID DOC_TYPE_MAP DOC_TYPE_3DV DOC_TYPE_VOXEL DOC_TYPE_VOXI DOC_TYPE_GMS3D DOC_TYPE_GMS2D DOC_TYPE_ALL =================

  • 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='')[source]

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’. For multiple files if a specific type ‘**,*.grd’

Returns

user response string, or a list of files if multi-file requested

Raise

GXCancel if the user cancels the dialog

New in version 9.1.

pause(title='Pause...', cancel=False)[source]

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)[source]

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()[source]
Returns

1 if running from a script, 0 if running interactively.

New in version 9.1.

user_message(title, message)[source]

Display a message to the user

Parameters
  • title – message box title

  • message – message

New in version 9.2.