maptek.vulcan_gui module

This module provides an interface to the Vulcan GUI functionality.

Functionality includes:
  • Panels

  • Gpan Panels

  • On screen data

  • Selections

  • Display

  • Macro functions

message(msg)

Displays a message box in Vulcan.

Parameters:

msg (str) –

error(msg)

Displays an error message in Vulcan.

Parameters:

msg (str) –

confirm(*args, **kwargs)

Popup confirmation prompt.

Parameters:
  • msg (str (default = 'Confirm')) – Message to display to the user.

  • ok (str (default = 'Ok')) – First choice option.

  • cancel (str (default = 'Cancel')) – Second choice option.

start_busy_message(msg, time=-1)

Starts a busy message (small non-interactive message).

Parameters:
  • msg (str) –

  • time (int) –

end_busy_message()

Ends any running busy message.

globals()

Returns a dictionary of current data (some loaded) in Vulcan.

Example

>>> from pprint import pprint
>>> pprint(vulcan_gui.gfx.globals())
{'block_model': '',
 'dgd': 'thordata.dgd.isis',
 'environment': 'STD',
 'layer_descriptions': {'TMP': 'Created layer'},
 'layers': ['TMP'],
 'loaded_layers': ['TMP'],
 'loaded_triangulations': ['topo.00t'],
 'project': 'THOR',
 'scd': 'THOR.SCD',
 'scd_location': '__cwd__',
 'unit': 'Metres',
 'unit_abbrev': 'm'}
save()

Issues a save command to Vulcan.

get_main_window_handle() unsigned int

Get the main window handle of the Workbench

get_current_dgd_attribute_templates() dict

Gets the attribute templates from the currently opened design database.

get_resource_attribute_templates() dict

Gets the attribute templates from the resource template file.

pick_triangulation(prompt) str

Picks a triangulation in Vulcan.

Parameters:

prompt (str) –

get_layer(layerName) layer

Loads a layer from Vulcan by name.

Parameters:

layerName (str) –

add_layer(lyr, loadMethod='LOAD_IF_EXISTS') bool

Adds a layer to Vulcan. Load options defined in gui_options.layer_load

Parameters:
  • lyr (layer const &) –

  • loadMethod (str) –

load_triangulation(file, interactive=False) bool

Load triangulation into Vulcan.

Parameters:
  • file (str) –

  • interactive (bool) –

reload_triangulation(file)

Reloads a triangulation in Vulcan.

Parameters:

file (str) –

load_triangulations(files) bool

Load a list of triangulations into Vulcan.

Parameters:

files (list[str]) –

remove_triangulations(files) bool
Parameters:

files (list[str]) –

remove_layers(layer_names) bool

Remove a list of layers from Vulcan.

Parameters:

layer_names (list[str]) –

Raises:

RuntimeError – If any layers fail (not loaded or had unsaved data), indicating which item(s) failed.

set_object_visibility(object, mode) bool

Sets the visibility of an object in Vulcan. Only supports objects from the GUI with the visibility modes of VISIBLE, SHADOW, and INVISIBLE

Parameters:
  • object (obj const &) –

  • mode (str) –

get_object_visibility(object) str

Gets the visibility of an object in Vulcan.

Parameters:

object (obj const &) –

class gui_options(*args, **kwargs)

Bases: object

Proxy of C++ gui_options class.

display = ('VISIBLE', 'INVISIBLE', 'SHADOW', 'HIGHLIGHT', 'VISIBLE_AND_POINTS', 'SHADOW_AND_POINTS', 'HIGHLIGHT_AND_POINTS', 'MARKERS', 'CONTRAST', 'CONTRAST_AND_POINTS', 'FREEZE')

List of the available GUI display options

label = ('OFF', 'POINT_NAME', 'POINT_Z', 'POINT_W', 'POINT_LOCATION', 'POINT_SEQUENCE', 'POINT_SEQUENCE_FIRST_LAST', 'POINT_GRADIENT_ANGLE', 'POINT_GRADIENT_RATIO', 'POINT_GRADIENT_PERCENTAGE', 'OBJECT_VALUE', 'OBJECT_GROUP', 'OBJECT_CLASS', 'OBJECT_NAME_FIRST_CENTER_LAST', 'OBJECT_NAME_FIRST_CENTER', 'OBJECT_NAME_CENTER_LAST', 'OBJECT_NAME_CENTER', 'OBJECT_NAME_FIRST_LAST', 'OBJECT_NAME_FIRST', 'OBJECT_NAME_LAST', 'OBJECT_DYNAMIC', 'OBJECT_DESCRIPTION')

List of the available GUI label options

layer_load = ('LOAD_IF_EXISTS', 'CLEAR_IF_EXISTS', 'PROMPT_IF_EXISTS', 'PROMPT_IF_NOT_LOADED', 'ACTIVE_IF_EXISTS', 'ACTIVE_PROMPT_IF_NOT_SET', 'PROMPT_NEW_ACTIVE')

List of the available GUI load options

selection_type = ('NOTYPE', 'BYLAYER', 'BYOBJECT', 'BYNAME', 'BYGROUP', 'BYFEATURE', 'BYALL')

List of the available GUI type options

selection_criteria = ('ALL', 'LINE', 'POLYGON', 'TEXT', '3DTEXT', 'ARROW', 'DIMENSIONLINE', 'DIMENSIONRADIUS', 'DIMENSIONARC', 'DIMENSIONANGLE', 'IMPLIEDPOLYGON')

List of the available GUI criteria options

class panel(*args, **kwargs)

Bases: object

Interface for building basic Vulcan panels.

__init__(*args, **kwargs)

Interface for building basic Vulcan panels.

begin_block(self, border=False, title='')

Creates a new area on the panel with optional border and title.

Parameters:
  • border (bool) –

  • title (str) –

end_block(self)
pan_if(self)

Makes the next element conditional on the previous element.

pan_else(self)
pan_endif(self)
staticline(self)

Line drawn across panel.

begin_indent(self, indent=1)

Sets or increases indent used for fields.

Parameters:

indent (int) –

end_indent(self)
begin_same_line(self)
end_same_line(self)
skip_line(self)
statictext(self, prompt, bold=False)

Text placed on the panel.

Parameters:
editbox(self, tag, prompt, defaultVal=None, width=None)
Parameters:
  • tag (str) –

  • prompt (str) –

  • defaultVal (str *) –

  • width (int const *) –

numberbox(self, tag, prompt, defaultVal=None, width=None)
Parameters:
  • tag (str) –

  • prompt (str) –

  • defaultVal (double const *) –

  • width (int const *) –

integerbox(self, tag, prompt, defaultVal=None, width=None)
Parameters:
  • tag (str) –

  • prompt (str) –

  • defaultVal (int const *) –

  • width (int const *) –

fileselector(self, tag, prompt, filter, width=None)

Combobox with a built in file filter using wildcard matching.

Parameters:
  • tag (str) –

  • prompt (str) –

  • filter (str) –

  • width (int const *) –

Example

>>> # *.bmf would return any files ending in .bmf
>>> pan.fileselector('file', 'Select a block model', '*.bmf')
combobox(self, tag, prompt, options, width=None)
Parameters:
  • tag (str) –

  • prompt (str) –

  • options (list[str]) –

  • width (int const *) –

filterbox(self, tag, prompt, filter, width=None)

Combobox with a built in filter, using gpan filter strings.

Parameters:
  • tag (str) –

  • prompt (str) –

  • filter (str) –

  • width (int const *) –

checkbox(self, tag, prompt, checked=False)
Parameters:
  • tag (str) –

  • prompt (str) –

  • checked (bool) –

radiobutton(self, tag, prompt, initial=False, bank=0)

Radiobutton to pick one of several options. Only one tag per bank will return ‘1’.

Parameters:
  • tag (str) –

  • prompt (str) –

  • initial (bool) –

  • bank (int const) –

colour(self, tag, prompt, defaultVal=None)

Selector for colour using Vulcan colour palette.

Parameters:
  • tag (str) –

  • prompt (str) –

  • defaultVal (int *) –

linestyle(self, tag, prompt, style=None, thickness=None)

Selector for linestyle using Vulcan linestyles.

Returns:

[line style, line thickness]

Return type:

list

Parameters:
  • tag (str) –

  • prompt (str) –

  • style (int *) –

  • thickness (int *) –

pattern(self, tag, prompt, defaultVal=None)

Selector for pattern using Vulcan patterns.

Parameters:
  • tag (str) –

  • prompt (str) –

  • defaultVal (int *) –

display(self, values=None) bool

Displays the panel. Stores to optional input dictionary.

Parameters:

values (dict) –

get_values(self) dict

Gets the values from the panel (after it has run).

set_values(self, values)

Preloads panel key values with input dictionary values.

Parameters:

values (dict) –

load_spec(self, specName)

Loads a specification file into the panel.

Parameters:

specName (str) –

save_spec(self, specName)

Saves the panel data to a specification file.

Parameters:

specName (str) –

property values

Get/Set for panel values (dict)

class gpan(*args)

Bases: object

Display Vulcan gpan panels

__init__(self) gpan
__init__(self, specFile) gpan

Display Vulcan gpan panels

Parameters:

specFile (str) –

display(self, cgpFile, panelName, values=None, on_change=None, user_button=None) str

Displays the specified panel file/name. Stores to optional input dictionary. Callbacks should be a function name to call, taking a dictionary as input and returning a dictionary to the panel.

Parameters:
  • cgpFile (str) –

  • panelName (str) –

  • values (dict) –

  • on_change (swig_callback *) –

  • user_button (swig_callback *) –

get_values(self) dict

Gets the values from the panel (after it has run).

set_values(self, values)

Preloads panel key values with input dictionary values.

Parameters:

values (dict) –

load_spec(self, specName)

Loads a specification file into the panel.

Parameters:

specName (str) –

save_spec(self, specName)

Saves the panel data to a specification file.

Parameters:

specName (str) –

property values

Get/Set for panel values (dict)

class temp_object(object)

Bases: object

Class for displaying temporary objects in the GUI.

__init__(object)

Class for displaying temporary objects in the GUI.

set_display_mode(self, mode)

Sets the display mode for the temporary object (visible, shadow, etc).

Options listed in gui_options.display

Parameters:

mode (str) –

set_label_mode(self, mode)

Sets the label mode for the temporary object.

Options listed in gui_options.label

Parameters:

mode (str) –

remove(self)

Removes the temporary object from screen.

class pick_point

Bases: object

Pick points inside of Vulcan.

__init__()

Pick points inside of Vulcan.

pick(self, firstPrompt, secondPrompt='') point_list
Parameters:
  • firstPrompt (str) –

  • secondPrompt (str) –

property rubberband

Get/Set for rubberband.

property single_point

Get/Set for single_point.

class selection(prompt)

Bases: object

Class for creating object selections inside of Vulcan.

__init__(prompt)

Class for creating object selections inside of Vulcan.

set_criteria(self, types)

Sets the allowed types to be picked from a list of options gui_options.selection_criteria.

Parameters:

types (list[str]) –

get_criteria(self) str_list

Returns the list of allowed selection types.

set_single_object(self, singleObj=True)

Sets the selection to single object mode.

Parameters:

singleObj (bool) –

get_single_object(self) bool

Returns the single object mode setting.

set_selection_type(self, type)

Sets the selection type (BYLAYER, BYGROUP, etc). Options: gui_options.selection_type

Parameters:

type (str) –

get_selection_type(self) str

Gets the selection type (Default=ALL).

set_display_mode(self, type)

Sets the display mode of selected data. Options in: gui_options.display

Parameters:

type (str) –

get_display_mode(self) str

Gets the display mode of selected data.

set_ignore_preselected(self, ignore=True)

Sets the flag to ignore preselected data.

Parameters:

ignore (bool) –

get_ignore_preselected(self) bool

Returns the option for allowing preselected data.

pick(self, layername=None, group=None, feature=None)

Runs a non-interactive selection filtering by the input parameters.

Parameters:
  • layername (str *) –

  • group (str *) –

  • feature (str *) –

get_object(self, index) VulcanObj

Gets an object from the selection by index.

Parameters:

index (int) –

num_obj(self) int

Returns the number of objects in the selection.

replace(self, object) bool

Replaces an object (If it originated from Vulcan).

Parameters:

object (obj &) –

delete_object(object, refreshDisplay=True)

Deletes an object from a selection (If it originated from Vulcan).

Parameters:
  • object ((obj&)) – Object to be deleted from Vulcan

  • refreshDisplay ((bool, default True)) – Flag to refresh the display in Vulcan after deleting the object.

next()
property objects
type_options = ('NOTYPE', 'BYLAYER', 'BYOBJECT', 'BYNAME', 'BYGROUP', 'BYFEATURE', 'BYALL')
criteria_options = ('ALL', 'LINE', 'POLYGON', 'TEXT', '3DTEXT', 'ARROW', 'DIMENSIONLINE', 'DIMENSIONRADIUS', 'DIMENSIONARC', 'DIMENSIONANGLE', 'IMPLIEDPOLYGON')
property criteria

Get/Set for selection criteria

property single_object

Get/Set for single object mode

property selection_type

Get/Set for selection type

property display_mode

Get/Set for selection display mode

property ignore_preselected

Get/Set for ignore preselected

class run_menu(menu_tag, mode, err=None)

Bases: object

get_report_window() str_list

Gets any messages from the report window that were saved during a macro run.

set_view(title, data) bool
Parameters:
set_window(title) bool
Parameters:

title (str) –

workbench_macro(macro_content) bool
Parameters:

macro_content (str) –

class macro

Bases: object

Macro class for interacting with Vulcan.

These are generated in Vulcan via menu option, and can be modified as needed to automate a Vulcan menu option.

Warning

Macro command requirements can change between Vulcan versions.

__init__()

Macro class for interacting with Vulcan.

These are generated in Vulcan via menu option, and can be modified as needed to automate a Vulcan menu option.

Warning

Macro command requirements can change between Vulcan versions.

command(self, cmd)
Parameters:

cmd (str) –

set_view(self, title, data)
Parameters:
set_window(self, title)
Parameters:

title (str) –

panel_results(self, title, pan_data)
Parameters:
  • title (str) –

  • pan_data (dict) –

select_by_attr(self, layer='*', object='*', group='*', feature='*')
Parameters:
  • layer (str) –

  • object (str) –

  • group (str) –

  • feature (str) –

select_interactive(self, prompt='', do_layer=0, do_name=0, do_group=0, do_feature=0)
Parameters:
  • prompt (str) –

  • do_layer (int) –

  • do_name (int) –

  • do_group (int) –

  • do_feature (int) –

triangulation(self, name)
Parameters:

name (str) –

point_absolute(self, x, y, z)
Parameters:
  • x (double) –

  • y (double) –

  • z (double) –

point_relative(self, x, y, z)
Parameters:
  • x (double) –

  • y (double) –

  • z (double) –

workbench_macro(self, macro_content)
Parameters:

macro_content (str) –

begin_menu_command(self, menuTag, mismatch)
Parameters:
  • menuTag (str) –

  • mismatch (str) –

end_menu_command(self)
run(self) bool