poIModel GetSelectionSetHandle

Retrieves the handle for a particular selection set.

Syntax

model_handle GetSelectionSetHandlehandle locator

Application

HyperView Tcl Query

Description

This command retrieves the handle for a particular selection set defined by the argument locator. The selection set handle is used to perform modifications and/or query settings on the current selection set.

Inputs

handle
The handle that is returned if no error occurs.
locator
The locator string used to uniquely identify the selection set. This can be just the ID of the set or a combination of the pool name and the ID of the set.

Example

To create several selection sets on the current model and use GetSelectionSetHandle to obtain the selection set handle for the desired selection set:
hwi OpenStack
hwi GetSessionHandle session_handle
session_handle GetProjectHandle project_handle
project_handle GetPageHandle page_handle [project_handle GetActivePage]
page_handle GetWindowHandle window_handle [page_handle GetActiveWindow]
window_handle GetClientHandle client_handle
client_handle GetModelHandle model_handle [client_handle GetActiveModel]

set id [model_handle AddSelectionSet component]
model_handle GetSelectionSetHandle selection_set_handle $id

set errorMsg [ session_handle GetError]
if {$errorMsg == ""} {
    selection_set_handle SetLabel "OurSelectionSet1"
    selection_set_handle Add all
    puts "SelectionSet: [selection_set_handle GetLabel] "
    puts "    [selection_set_handle GetSize] [selection_set_handle GetType]s"
} {
    puts "$errorMsg"
}

selection_set_handle ReleaseHandle


set id2 [model_handle AddSelectionSet element]
model_handle GetSelectionSetHandle selection_set_handle $id2
selection_set_handle SetLabel "OurSelectionSet2"
selection_set_handle Add "id 1-100"
puts "SelectionSet: [selection_set_handle GetLabel] "
puts "    [selection_set_handle GetSize] [selection_set_handle GetType]s"
selection_set_handle ReleaseHandle

set id3 [model_handle AddSelectionSet element]
model_handle GetSelectionSetHandle selection_set_handle $id3
selection_set_handle SetLabel "OurSelectionSet3"
selection_set_handle Add "selectionset == $id2"
puts "SelectionSet: [selection_set_handle GetLabel] "
puts "    [selection_set_handle GetSize] [selection_set_handle GetType]s"
selection_set_handle ReleaseHandle

puts "Current Selection Sets: [model_handle GetSelectionSetList]"

model_handle RemoveSelectionSet $id
puts "Selection Set $id removed…"
puts "Current Selection Sets: [model_handle GetSelectionSetList]"

# How to get a selection set handle if you have duplicate set IDs
# Sometimes in a model you will have selection sets with same IDs, but the pools
# may be different. For example assume that we have 2 sets with the same ID “1”, but belonging to different pools (say “Set” and “User_Set”

# Get Handle to set ID 1 belonging to set pool with label “Set”
model_handle GetSelectionSetHandle set_h1 “Set 1” 

# Get Handle to set ID 1 belonging to set pool with label “User_Set”
model_handle GetSelectionSetHandle set_h2 “User_Set 1” 

hwi CloseStack

Error

This command returns HW_InvalidHandle if the model handle is invalid, PO_InvalidSetID if the selection set ID is incorrect, and HW_AllocFailed if the selection set handle could not be created.
Note: To obtain the error information, use GetError on the Session object as shown in the example.