GXPROJ class

class GXPROJ(handle=0)[source]

GXPROJ class.

Project functions

__init__(handle=0)[source]

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

classmethod add_document(name, type, display)[source]

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 Geosurface Voxel VoxelInversion GMS3D GMS2D

classmethod add_document_without_opening(name, type)[source]

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 Geosurface Voxel VoxelInversion GMS3D GMS2D

classmethod add_grid_document(name, colors, method, display)[source]

Adds (and opens) a grid document file in the current project with a particular colour distribution and colour file.

Parameters
  • name (str) – Document name

  • colors (str) – Colour zone file to use

  • method (int) – Colour method to use - one of the ITR_ZONE_XXXX values

  • display (int) – PROJ_DISPLAY constants

Returns

0 - Ok 1 - Error

Return type

int

New in version 9.7.

License: Geosoft Open License

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

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

classmethod current_document(name, type)[source]

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

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

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_central_project_information(instance, project, crs, branch, rev_id, rev_date, rev_note, rev_stage, rev_author)[source]

Get Central project information.

Parameters
  • instance (str_ref) – Instance name

  • project (str_ref) – Project name

  • crs (str_ref) – Coordinate Reference System

  • branch (str_ref) – Branch name

  • rev_id (str_ref) – Revision Id

  • rev_date (str_ref) – Revision date

  • rev_note (str_ref) – Revision note

  • rev_stage (str_ref) – Revision stage

  • rev_author (str_ref) – Revision author

New in version 2021.2.

License: Geosoft Open License

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

Note: Get Central project information.

classmethod get_command_environment()[source]

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.

If new Command environment enum values are added, then update the iGetCommandEnvironment_PROJ() function in geogxguigxx_app.cpp and in the COMMAND_ENVIRONMENT enums in geoengine.coreincludeobjobjgp.h.

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

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.

classmethod get_server_and_project_guid(server_id, project_id)[source]

Return the unique identifier of the project and server.

Parameters
  • server_id (str_ref) – Server ID

  • project_id (str_ref) – Project ID

New in version 2021.2.

License: Geosoft Open License

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

Note: Return the unique identifier of the project and server.

is_null()[source]

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

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. Geosurface List Geosurfaces. 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)[source]

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. Geosurface List Geosurfaces. 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)[source]

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

A null (undefined) instance of GXPROJ

Returns

A null GXPROJ

Return type

GXPROJ

classmethod remove_document(name)[source]

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

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

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 Geosurface Voxel VoxelInversion GMS3D GMS2D All

classmethod set_central_project_information(server_guid, project_guid, branch_id, revision_id, cs_info)[source]

Set Central project information.

Parameters
  • server_guid (str) – server guid

  • project_guid (str) – project guid

  • branch_id (int) – branch ID

  • revision_id (int) – revision ID

  • cs_info (str) – Coordinate system information, either EPSG or WKT

New in version 2021.2.

License: Geosoft Open License

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

Note: Set Central project information.

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