You are here: Surpac Concepts > Macros > SCL > SWA Commands > SclSwas
GEOVIA Surpac

SclSwas

Overview

You can use sclSwas with other SCL commands such as SclCountItems to determine the number of SWAs or SclIterateNext to advance through a set of SWAs.

The SWA (Surpac Work Area) is where all String and DTM data processed by Surpac applications is stored. A complete description of the SWA can be found here.

Synopsis

sclSwas <suitable command><command arguments>

Description

sclSwas is a command that represents the set of all SWAs that exist at any point in time. Because of this the sclSwas command by itself serves little purpose. Used with other commands that operate upon it though it is very useful.

Arguments

  • <suitable command>
  • May be one of a number of commands that operates on the sclSwas set. Commands that may be used are:

    • SclCountItems
    • To obtain a count of the number of Swas in the set of Swas.

    • SclGetItem
    • To get an item from the set of Swas at a specified position.

    • SclIterateFirst
    • To create a new Scl iterator and make it ready for forward iteration through the set of Swas.

    • SclIterateLast
    • To create a new Scl iterator and make it ready for reverse iteration through the set of Swas.

    • SclIterateNext
    • To advance the iterator to the next Swa in the set of Swas and return the handle to the next Swa.

    • SclIteratePrev
    • To advance the iterator to the previous Swa in the set of Swas and return the handle to the previous Swa.

  • <command arguments>
  • Depending on the command that is applied to the SclSwas command, other arguments will be required. For details of each of these refer to the documentation on each of the commands above.

Examples

#
# This example iterates over all SWAs that exist and displays their
# names and handles in the message window. If you execute this script after
# a number of graphics layers have been created by recalling some
# DTM files you will see that there are some SWAs that have a name
# with a ".boundary" suffix. These SWAs are not graphics layers but
# they exist. This shows how the set of SWAs is not the same as the
# set of graphics layers.
#
puts "List of all SWAs that exist"
sclSwas SclIterateFirst Iterator
while {[$Iterator SclIterateNext SwaHandle] == $SCL_TRUE} {
  puts "Swa handle = $SwaHandle, swa name = [$SwaHandle SclGetId]"
}

 

#
# This example shows how a count of the number of SWAs in the set of SWAs 
# can be obtained and also how a SWA at a specified position in the set of 
# SWAs can be obtained and assigned to a variable
set count [sclSwas SclCountItems]
puts "There are $count Swas in the set of SWAs"
for {set i 0} {$i < $count} {incr i} {
  set status [sclSwas SclGetItem SwaHandle $i]
  puts "status=$status"
  puts "The Swa at position $i is [$SwaHandle SclGetId]"
}