GXPROJ class¶
- class GXPROJ(handle=0)[source]¶
GXPROJ class.
Project functions
- 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_include_meta(name, type, meta, display)[source]¶
Adds (and opens) a document file in the current project.
- Parameters:
name (str) – Document name
type (str) – Type of document to add
meta (str) – Meta file to load
display (int) – PROJ_DISPLAY constants
- Returns:
0 - Ok 1 - Error
- Return type:
int
New in version 2022.1.
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 add_grid_documents(names, colors, method, display)[source]¶
Adds (and opens) multiple grid document files of the same type in the current project with a shared (same) colour distribution and colour file.
- Parameters:
names (GXVV) – String VV with document names
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 2024.1.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: The passed file names must be valid Grid documents with an extension and qualifiers (if applicable). ALL grids must have the same extension and qualifier.
- classmethod current_document(name, type)[source]¶
Get the name and type of the loaded document with focus.
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, rev_server_url, rev_proj_url)[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
rev_server_url (str_ref) – Revision server url
rev_proj_url (str_ref) – Revision project url
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:
-
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_default_project_path(folder)[source]¶
Get default project folder.
- Parameters:
folder (str_ref) – Returned default path
New in version 2022.1.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: Get default project folder.
- 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_num_registered_background_scripts()[source]¶
Register a OMS script launched from the project
- Returns:
The number of registered background scripts: in progress, finished, failed, deleted etc.
- Return type:
int
New in version 2022.2.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: Allows the project to track the progress/failure/success of scripts launched in the background
- classmethod get_registered_background_script(index, date_time, name, name2, script, log, output_files, process_id)[source]¶
Retrieve info on a registered OMS script launched from the project
- Parameters:
index (int) – Index for the process (input) 0 to N-1
date_time (str_ref) – Date/Time string in format DD/MM/YYYY hh:mm:ss
name (str_ref) – Name for the process (output)
name2 (str_ref) – Secondary name for the process (output)
script (str_ref) – file name of the script (output)
log (str_ref) – file name of the output log (returned, can be empty).
output_files (GXVV) – List of output documents created by the script. of size -
STR_FILE
process_id (str_ref) – Process ID (returned)
New in version 2022.2.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: reference by index
- classmethod get_registered_background_script_ex(index, date_time, name, name2, script, log, output_file, error_file, output_files, output_file_types, process_id)[source]¶
Retrieve info on a registered OMS script launched from the project
- Parameters:
index (int) – Index for the process (input) 0 to N-1
date_time (str_ref) – Date/Time string in format DD/MM/YYYY hh:mm:ss
name (str_ref) – Name for the process (output)
name2 (str_ref) – Secondary name for the process (output)
script (str_ref) – file name of the script (output)
log (str_ref) – file name of the output log (returned, can be empty).
output_file (str_ref) – file name of the progress output log (returned, can be empty).
error_file (str_ref) – file name of the error_file log (returned, can be empty).
output_files (GXLST) – List of output key & documents pairs.
output_file_types (GXLST) – List of output documents and document type pairs.
process_id (str_ref) – Process ID (returned)
New in version 2024.1.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: reference by index
- classmethod get_server_and_project_guid(server_id, project_id)[source]¶
Return the unique identifier of the project and server.
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.
- classmethod has_pending_central_publish_event()[source]¶
Checks if there is a pending publish event.
- Return type:
bool
New in version 2022.1.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: Checks if there is a pending publish event.
- 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:
- 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:
- 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:
type (int) – TOOL_TYPE constants
- 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 register_background_script(name, name2, script, log, save_log, output_files, file_to_delete, process_id)[source]¶
Register an OMS script launched from the project
- Parameters:
name (str) – Name for the process
name2 (str) – Secondary name for the process
script (str) – file name of the script. Script should self-delete to indicate process has completed
log (str) – file name of the output log (optional). Will contain info about this script run
save_log (int) – 1 - log file is temporary and deleted on OM close. 0 - do not delete on OM close
output_files (GXVV) – List of output documents created by the script.
file_to_delete (str) – File to delete (optional). Will also delete files with same name and .tmp and .xml extensions
process_id (str) – Process ID - used to check status or kill the process
New in version 2022.2.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: Allows the project to track the progress/failure/success of scripts launched in the background
- classmethod register_background_script_ex(name, tooltip, script, log, output_log, error_log, save_log, output_files, output_file_types, file_to_delete, process_id)[source]¶
Register an OMS script launched from the project
- Parameters:
name (str) – Name of the job
tooltip (str) – Tooltip text
script (str) – file name of the script. Script should self-delete to indicate process has completed
log (str) – file name of the output log (optional). Will contain info about this script run
output_log (str) – file name of the output progress log (optional). Will contain progress information
error_log (str) – file name of the error log (optional). Will contain info about errors from the run
save_log (int) – 1 - log file is temporary and deleted on OM close. 0 - do not delete on OM close
output_files (GXVV) – List of output documents created by the script.
output_file_types (GXLST) – List of output documents and document type pairs.
file_to_delete (str) – File to delete (optional). Will also delete files with same name and .tmp and .xml extensions
process_id (str) – Process ID - used to check status or kill the process
New in version 2024.1.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: Allows the project to track the progress/failure/success of scripts launched in the background
- 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 save_document_view(name, meta_file)[source]¶
Save document view to a file.
- Parameters:
name (str) – Document name
meta_file (str) – save meta to file
New in version 2022.1.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: Save document view to a file.
- 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.
- classmethod set_default_project_path(folder)[source]¶
Set default project folder.
- Parameters:
folder (str) – Default path
New in version 2022.1.
License: Geosoft Open License
Limitations: May not be available while executing a command line program.
Note: Set default project folder.
COMMAND_ENV constants¶
Command environments
TOOL_TYPE constants¶
Tool type defines
PROJ_DISPLAY constants¶
How to display an object
PROJ_OMS constants¶
Script registration