GXPROJ class

class GXPROJ(handle=0)

GXPROJ class.

Project functions

classmethod add_document(name, type, display)

Adds (and opens) a document file in the current project.

Parameters:
  • name (str) – Document name
  • type (str) – Type of document to add
  • display (int) – PROJ_DISPLAY constants
Returns:

0 - Ok 1 - Error

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The passed file name must be a valid file name complete with an extension and qualifiers (if applicable).

The type string can be one of the following:

Database Grid Map 3DView Voxel VoxelInversion GMS3D GMS2D
classmethod add_document_without_opening(name, type)

Adds (and opens) a document file in the current project.

Parameters:
  • name (str) – Document name
  • type (str) – Type of document to add
Returns:

0 - Ok 1 - Error

Return type:

int

New in version 8.5.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The passed file name must be a valid file name complete with an extension and qualifiers (if applicable).

The type string can be one of the following:

Database Grid Map 3DView Voxel VoxelInversion GMS3D GMS2D
classmethod current_document(name, type)

Get the name and type of the loaded document with focus.

Parameters:
  • name (str_ref) – Name (empty if none currently loaded)
  • type (str_ref) – Type

New in version 9.2.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod current_document_of_type(name, type)

Get the name of a loaded document of a specific type.

Parameters:
  • name (str_ref) – Name (empty if none currently loaded)
  • type (str) – Type

New in version 9.2.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod drop_map_clip_data(hglobal)

Drop Map clipboard data in the current project (workspace background)

Parameters:hglobal (int) – Handle to Global Clipboard data

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod get_command_environment()

The current command environment

Returns:COMMAND_ENV constants

Notes We are moving towards embedded tools and menus and this setting can be queried from the project to determine how specific commands should react. Only 3D viewer is currently making use of this.

Return type:int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod get_name(name)

Return the name of the project file.

Parameters:name (str_ref) – name

New in version 8.4.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: Return the name of the project file.

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
classmethod list_documents(gvv, type)

Fills a GXVV with documents of a certain type.

Parameters:
  • gvv (GXVV) – GXVV of type -STR_FILE
  • type (str) – Type of document to obtain
Returns:

The number of documents listed in the GXVV.

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The type string can be one of the following: Database List Databases. Grid List Grids. Map List Maps. 3DView List 3D Views. Voxel List Voxels. VoxelInversion List VOXI Documents. GXMXD List ArcGIS MXDs. GMS3D List GM-SYS 3D Models. GMS2D List GM-SYS 2D Models. All Lists all files.

classmethod list_loaded_documents(gvv, type)

Fills a GXVV with loaded documents of a certain type.

Parameters:
  • gvv (GXVV) – GXVV of type -STR_FILE>
  • type (str) – Type of document to obtain
Returns:

The number of loaded documents listed in the GXVV.

Return type:

int

New in version 9.2.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The type string can be one of the following: Database List Databases. Grid List Grids. Map List Maps. 3DView List 3D Views. Voxel List Voxels. VoxelInversion List VOXI Documents. GXMXD List ArcGIS MXDs. GMS3D List GM-SYS 3D Models. GMS2D List GM-SYS 2D Models. All Lists all files.

classmethod list_tools(lst, type)

Fills an GXLST object with tools of a certain type and notes the current visibility setting.

Parameters:
Returns:

The number of tools found.

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: GX will terminate if there is an error.

GXLST object will hold the tool name in the name column and include whether the tool is currently visible in the value column (1=visible, 0-hidden).

classmethod null()

A null (undefined) instance of GXPROJ

Returns:A null GXPROJ
Return type:GXPROJ
classmethod remove_document(name)

Removes (and closes if visible) a document from the current project.

Parameters:name (str) – Document name
Returns:0 - Ok 1 - Document not found in project
Return type:int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The passed file name must be a valid file name complete with an extension and qualifiers (if applicable).

classmethod remove_tool(name)

Removes (and closes if visible) a auxiliary tool from the current project.

Parameters:name (str) – Tool name
Returns:0 - Ok 1 - Tool not found in project
Return type:int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: Nothing

classmethod save_close_documents(type)

Saves and closes (if visible) documents contained in the current project.

Parameters:type (str) – Type of document to save / close
Returns:0 - Ok -1 - User hit cancel in save dialog 1 - Error
Return type:int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: This wrapper brings up the save dialog tool to allow the user to save the modified documents for this project. Only documents that have actually changed will be listed.

The type string can be one of the following:

Database Grid Map 3DView Voxel VoxelInversion GMS3D GMS2D All

COMMAND_ENV constants

Command environments

COMMAND_ENV_NORMAL

Normal

gxapi.COMMAND_ENV_NORMAL = 0
COMMAND_ENV_IN3DVIEWER

Executing from inside 3D Viewer

gxapi.COMMAND_ENV_IN3DVIEWER = 1

TOOL_TYPE constants

Tool type defines

TOOL_TYPE_DEFAULT

Geosoft created default tools

gxapi.TOOL_TYPE_DEFAULT = 0
TOOL_TYPE_AUXILIARY

Auxiliary tools (including custom XTools)

gxapi.TOOL_TYPE_AUXILIARY = 1
TOOL_TYPE_ALL

All tools

gxapi.TOOL_TYPE_ALL = 2

PROJ_DISPLAY constants

How to display an object

PROJ_DISPLAY_NO

Do not display the object

gxapi.PROJ_DISPLAY_NO = 0
PROJ_DISPLAY_YES

Display the object unless user set option not to

gxapi.PROJ_DISPLAY_YES = 1
PROJ_DISPLAY_ALWAYS

Always display the object

gxapi.PROJ_DISPLAY_ALWAYS = 2