You are here: Surpac Concepts > Macros > SCL > Object Manipulation > SclGetHandleNameList
GEOVIA Surpac

SclGetHandleNameList

Overview

Gets the name of each triobject in the SWA, and assigns the list of names to a variable. You can also use this command to get the name of each trisolation in each triobject in the SWA.

Synopsis

  • Triobjects - $TriobjectsHandle SclGetHandleNameList handleNameList
  • Trisolations - $TriobjectHandle SclGetHandleNameList handleNameList

Description

The value of handleNameList depends on whether you are running this Scl command for triobjects or for trisolations.

  • Triobjects - handleNameList stores a list object for each triobject in the SWA. Element 0 in the list is the handle to the triobject. Element 1 is the value of the "name" attribute of the triobject, if a value has been set, or "" if the value has not been set. Here is an example:
  • [ObjectHandle1,NameValue1], [ObjectHandle2,NameValue2], [ObjectHandle3,NameValue3], [ObjectHandle4,NameValue4] ...]

  • Trisolations - handleNameList stores a list for each trisolation within the triobject. Element 0 of this list is the trisolation handle, and element 1 is the "name" attribute of the trisolation, if a value has been set. Here is an example:
  • [ [TrisolationHandle1,NameValue1], [TrisolationHandle2,NameValue2], [TrisolationHandle3,NameValue3], [Trisolation4,NameValue4] ...]

Tip: The TCL lsort command is useful for sorting the list that is returned.

Arguments

Argument Description
$TriobjectsHandle Handle to the list of triobjects in a SWA. Passed by value.
$TriobjectHandle Handle to a triobject. Passed by value.
handleNameList Variable to hold the list of names. Passed by reference.

Returns

Returns SCL_True if there are triobjects (or trisolations in the triobject) in the SWA.

Returns SCL_False if there are no triobjects (or trisolations in the triobject) in the SWA.

Examples

Names of Triobjects

# Returns the names of the triobjects in the SWA
SclGetActiveViewport ViewportHandle
$ViewportHandle SclGetActiveLayer SwaHandle
$SwaHandle SclGetTriobjects TriobjectsHandle
$TriobjectsHandle SclIterateFirst TriobjectsIterator
while {[$TriobjectsIterator SclIterateNext TriobjectHandle] == $SCL_TRUE} {
  $TriobjectHandle SclGetHandleNameList HandleNameList
  lsort -dictionary -index 1 $HandleNameList
  foreach item $HandleNameList {
    set handle [lindex $item 0]
    set name [lindex $item 1]
    puts "Object: $handle, name=$name"
  }
}

Names of Trisolations

					
# Returns the names of the trisolations in the triobjects in the SWA
SclGetActiveViewport ViewportHandle
$ViewportHandle SclGetActiveLayer SwaHandle
$SwaHandle SclGetTriobjects TriobjectsHandle
$TriobjectsHandle SclGetHandleNameList HandleNameList
set sortedList [lsort -dictionary -index 1 $HandleNameList]
foreach item $sortedList {
  set handle [lindex $item 0]
  set name [lindex $item 1]
  puts "Object: $handle, name=$name"
}
See also