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

SclErase

Overview

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.

String and triangle data may be drawn from any SWA that has been added to the set of graphics layers to permit drawing into a 3D graphics viewport. After string or triangle data has been drawn it may be necessary to erase it. The SclErase command can be used to perform this task

The SclErase command can be applied to the Scl object handles that represent:

  • SWAs
  • Segments
  • Strings
  • Set of strings in a SWA
  • Trisolations
  • Triobjects
  • Set of triobjects in a SWA

At its simplest the SclErase command erases all child objects of the parent object to which the SclErase command is applied. For example, to erase all strings in a SWA, obtain the handle to the set of strings in the SWA using the SclGetStrings command and then apply the SclErase command.

Alternatively a range of child objects that are to be drawn can be specified, with the exception of SWAs. A SWA consists of only two objects, a string table and a triobject table. Therefore applying a range specification to a SWA object will have no effect.

Synopsis

$ParentObjectHandle SclErase <optional child range>

Description

Erase child objects from the specified Scl set of objects from the viewports that the SWA containing the ParentObjectHandle has been added.

Arguments

  • ParentObjectHandle
  • This variable must contain the Scl object handle to either a segment, string, set of strings, trisolation, triobject or set of triobjects.

  • <optional child range>
  • The range of child objects that are to be erased by the SclErase command. The range is a normal Surpac range specification. The table below shows the various parent object types to which the SclErase command can be applied and how the optional range is interpreted.

    Parent objectChild objectsDescription
    SWANot applicableThe range specification has no effect. All strings and all triobjects in the Swa are erased.
    SegmentPointsThe optional range is ignored when SclErase is applied to a segment. This is because all points in a segment are always erased. If you want finer control over drawing and erasing of individual points then they must exist in different segments.
    StringSegmentsThe optional range defines the segments that are to be erased with segment 0 being the first segment in the string. If the range is undefined then all segments of the string are erased.
    Set of stringsStringsThe optional range defines the strings that are to be erased with the range defining the string numbers, positive integer values that is. If the range is undefined then all strings are erased.
    TrisolationTrianglesThe optional range is ignored when SclErase is applied to a trisolation. This is because all triangles in a trisolation are always erased. If you want finer control over drawing and erasing of individual triangles then they must exist in different trisolations.
    TriobjectTrisolationsThe optional range defines the trisolations that are to be erased with trisolation 1 being the first trisolation in the triobject. If the range is undefined then all trisolations of the triobject are erased.
    Set of triobjectstriobjectsThe optional range defines the triobjects that are to be erased with the range defining the triobject numbers, positive integer values that is. If the range is undefined then all triobjects are erased.

Examples

#
# This example erases the first segment of the first string in the active 
# layer from the active viewport
# 
SclGetActiveViewport ViewportHandle
$ViewportHandle SclGetActiveLayer SwaHandle
# get the strings handle and the handle of the first string
$SwaHandle SclGetStrings StringsHandle
$StringsHandle SclGetItem StringHandle 0
# Tell the user what we are erasing
puts "Erasing the first segment of String [$StringHandle SclGetId]"
$StringHandle SclErase 0

 

# 
# This example permits a segment to be erased by selection
# 
set status [SclSelectPoint PointHandle "Select a segment to erase" layer string_id segment_no \
point_no x y z desc ]
while {$status == $SCL_OK} {
  $PointHandle SclGetParent SegmentHandle
  $SegmentHandle SclErase
set status [SclSelectPoint PointHandle "Select a segment to erase" layer string_id segment_no \
point_no x y z desc ]
}

 

# 
# This example permits a trisolation to be erased by selection
# 
set status [SclSelectTriangle TriangleHandle "Select a trisolation to erase" layer \
triobject_no trisolation_no triangle_no]
while {$status == $SCL_OK} {
  $TriangleHandle SclGetParent TrisolationHandle
  $TrisolationHandle SclErase
set status [SclSelectTriangle TriangleHandle "Select a trisolation to erase" layer \
triobject_no trisolation_no triangle_no]
}

 

# 
# This example erases all string and triangle data from the active layer
# 
SclGetActiveViewport ViewportHandle
$ViewportHandle SclGetActiveLayer SwaHandle
$SwaHandle SclGetStrings StringsHandle
$SwaHandle SclGetTriobjects TriobjectsHandle
$StringsHandle SclErase
$TriobjectsHandle SclErase

 

# 
# This example erases all strings 1 to 5 inclusive from the active layer
# 
SclGetActiveViewport ViewportHandle
$ViewportHandle SclGetActiveLayer SwaHandle
$SwaHandle SclGetStrings StringsHandle
$StringsHandle SclErase 1,5