maptek.vulcan_gui.selection

Class for creating object selections inside of Vulcan.

To download all the example scripts, click here.


Note

To use any of the method calls from this class, be sure to import the library at the top of your Python script, like this:

from maptek import vulcan_gui
maptek.vulcan_gui.selection(prompt: std::string const &)

Class for creating selection objects inside of Vulcan.

# Filename: selection.py
# Purpose: Class for creating object selections inside of Vulcan.
# Returns: Void.

from maptek import vulcan_gui

sel = vulcan_gui.selection('Select object')
set_criteria(self, types)

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

Parameters

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

Note:  When passing arguments to this function they must be passed as a list.

# Filename: selection_set_criteria.py
# Purpose: Returns the list of allowed selection types.
# Returns: Void.

from maptek import vulcan_gui

sel = vulcan_gui.selection('Select object')
sel.set_criteria(['LINE', 'POLYGON']) # set the selection criteria type
selection_types = sel.get_criteria() # get selection criteria type to verify

# do something with result...
print(selection_types)
get_criteria(self)→ str_list

Returns the list of allowed selection types.

# Filename: selection_get_criteria.py
# Purpose: Returns the list of allowed selection types.
# Returns: Tuple.

from maptek import vulcan_gui

sel = vulcan_gui.selection('Select object')
selection_types = sel.get_criteria() # get the selection type

# do something with result...
print(selection_types)
set_single_object(self, singleObj=True)

Sets the selection to single object mode.

Parameters

  • singleObj (bool)

# Filename: selection_set_single_object.py
# Purpose: Set property to select only a single object.
# Returns: Bool.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")
sel.criteria = ["LINE", "POLYGON"]
sel.set_single_object(False)

# do something after selection...
for obj in sel:
    layer_name = obj.layer
    print(layer_name)
get_single_object(self)→ bool

Returns the single object mode setting.

# Filename: selection_get_single_object.py
# Purpose: Set property to select only a single object.
# Returns: Bool.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")
sel.criteria = ["LINE", "POLYGON"]
sel.set_single_object(True)
selection_state = sel.get_single_object()
print(selection_state)

# do something after selection...
for obj in sel:
    layer_name = obj.layer

set_selection_type(self, type)

Sets the selection type.

Parameters

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

# Filename: selection_set_selection_type.py
# Purpose: Set property for selection type.
# Returns: Void.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")
sel.set_selection_type('BYOBJECT')

# do something after selection...
for obj in sel:
    layer_name = obj.layer
get_selection_type(self)→ std::string

Gets the selection type (Default=ALL).

# Filename: selection_get_selection_type.py
# Purpose: Get property for selection type.
# Returns: String.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")
sel.set_selection_type('BYOBJECT')

selection_state = sel.get_selection_type()
print(selection_state)

# do something after selection...
for obj in sel:
    layer_name = obj.layer
set_display_mode(self, type)

Sets the display mode of selected data.

Parameters

Type = ('VISIBLE', 'SHADOW', 'INVISIBLE')

# Filename: selection_set_display_mode.py
# Purpose: Set property for display mode.
# Returns: Void.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")
sel.set_display_mode('SHADOW')

# do something after selection...
for obj in sel:
    layer_name = obj.layer
get_display_mode(self)→ std::string

Gets the display mode of selected data.

# Filename: selection_get_display_mode.py
# Purpose: Get property for display mode.
# Returns: String.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")
sel.set_display_mode('SHADOW')
selection_state = sel.get_display_mode()
print(selection_state)

# do something after selection...
for obj in sel:
    layer_name = obj.layer
set_ignore_preselected(self, ignore=True)

Sets the flag to ignore preselected data.

Parameters

  • ignore (bool)

# Filename: selection_get_selection_type.py
# Purpose: Get property for selection type.
# Returns: String.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")
sel.set_selection_type('BYOBJECT')

selection_state = sel.get_selection_type()
print(selection_state)

# do something after selection...
for obj in sel:
    layer_name = obj.layer
get_ignore_preselected(self)→ bool

Returns the option for allowing preselected data.

# Filename: selection_get_ignore_preselected.py
# Purpose: Gets the flag state for ignoring preselected data.
# Returns: Bool.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")
sel.set_ignore_preselected(True)

selection_state = sel.get_ignore_preselected()
print(selection_state)

# do something after selection...
for obj in sel:
    layer_name = obj.layer
pick(self, layername=None, group=None, feature=None)

Non-interactive selection an object in Vulcan.

Parameters

  • layername (std::string const *)

  • group (std::string const *)

  • feature (std::string const *)

# Filename: selection_pick.py
# Purpose: Non-interactive selection an object in Vulcan.
# Returns: Object.

from maptek import vulcan_gui

# select layer non-interactively
sel = vulcan_gui.selection('Select Object')
sel.pick('BOUNDARY', group=None, feature=None)

# do something after selection...
for obj in sel:
    print(obj.colour)
get_object(self, index)→ VulcanObj

Gets an object from the selection by index.

Parameters

  • index (int)

# Filename: selection_get_object.py
# Purpose: Gets an object from the selection by index.
# Returns: Object.

from maptek import vulcan_gui

# select layer non-interactively
sel = vulcan_gui.selection('Select Object')
obj = sel.get_object(0) # pass index of layer object

# do something after selection...
print(obj)
num_obj(self)→ int

Returns the number of objects in the selection.

# Filename: selection_num_obj.py
# Purpose: Returns the number of objects in the selection.
# Returns: Integer.

from maptek import vulcan_gui

# select layer non-interactively
sel = vulcan_gui.selection('Select Object')
num = sel.num_obj()

# do something after selection...
print(num)
replace(self, object)→ bool

Replaces an object (If it originated from Vulcan) and update on the screen after changes have been made.

Note:  This will not save the changes by itself, but the name of the layer will turn red in the Vulcan Explorer, indicating that a change has been made and the layer needs to be saved to preserve changes.

Parameters

  • object (obj &)

# Filename: selection_replace.py
# Purpose: Replaces an object (If it originated from Vulcan).
# Returns: Bool.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection('Select Object')
sel.pick('BOUNDARY', group=None, feature=None)

# do something after selection...
for obj in sel:
    obj.colour = 2 # make a colour change
    sel.replace(obj) # update the object on the screen
property criteria: str_list

Get/Set for selection criteria.

# Filename: selection_property_criteria.py
# Purpose: Get/Set for selection criteria.

from maptek import vulcan_gui

sel = vulcan_gui.selection('Select Object')

# set selection criteria
sel.criteria = ['POLYGON']

# get selection criteria
state = sel.criteria

print(state)

property single_object: bool

Get/Set for single object mode.

# Filename: selection_property_single_object.py
# Purpose: Get/Set for single object mode.

from maptek import vulcan_gui

sel = vulcan_gui.selection('Select Object')

# set single object mode
sel.single_object = True

# get single object mode
state = sel.single_object

print(state)
property selection_type: string

Get/Set for selection type.

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

# Filename: selection_property_selection_type.py
# Purpose: Get/Set for selection type.

from maptek import vulcan_gui

sel = vulcan_gui.selection('Select Object')

# set single selection type
sel.selection_type = 'BYOBJECT'

# get single selection type
state = sel.selection_type

print(state)
property display_mode: string

Get/Set for selection display mode.

Type = ('VISIBLE', 'SHADOW', 'INVISIBLE')

# Filename: selection_property_display_mode.py
# Purpose: Get/Set for display mode.

from maptek import vulcan_gui

sel = vulcan_gui.selection('Select Object')

# set display mode
sel.display_mode = 'SHADOW'

# get display mode
state = sel.display_mode

print(state)
property ignore_preselected: bool

Get/Set for ignore preselected mode.

# Filename: selection_property_ignore_preselected.py
# Purpose: Get/Set for ignore preselected mode.

from maptek import vulcan_gui

sel = vulcan_gui.selection('Select Object')

# set ignore preselected mode
sel.ignore_preselected = True

# get ignore preselected mode
state = sel.ignore_preselected

print(state)