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

SclCreateTribobject

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.

The SclCreateTriobject command creates a new Triobject (a solid model) with a specified object number in a SWA and returns a handle to that triobject for future operations to that triobject. If a triobject of that number already exists then the handle to that triobject is returned and the triobject is not modified in any way.

Synopsis

$SwaHandle SclCreateTribobject TriobjectHandle $TriobjectNumber

Description

Create a triobject of the specified number in the specified SWA and return the handle to that triobject for later use by other Scl commands. If the triobject already exists then just return the handle to the triobject without modifying it in any way.

Initially the triobject is empty, that is it has no trisolations and no triangles and will not be saved to a DTM file until at least 1 trisolation with at least one triangle is created in it.

Arguments

  • SwaHandle
  • This is the handle to the SWA in which the triobject is to be created. The SWA handle must have previously been obtained by using SclCreateSwa or SclIterateNext to obtain the handle to an existing SWA or Graphics layer.

  • TriobjectHandle
  • Passed by reference. This is the variable to which the triobject handle is assigned. This triobject handle must be used in later references to the triobject for adding, deleting or modifying trisolations in the triobject.

  • TriobjectNumber
  • Passed by value. This is the triobject number that is to be created, or for which the handle is required if the triobject number in question already exists in the SWA. Note the triobject number is in fact an identifier for the triobject and may only by a positive integer, greater than 0 that is.

Examples

#
# create a swa with a string containing 1 segment with three points
# and then create a triobject with a single triangle
# save the string and DTM data to a string and DTM file 
# and finally destroy the swa
#
SclCreateSwa SwaHandle "temporary swa"
$SwaHandle SclCreateString StringHandle 1
$StringHandle SclCreateSegment SegmentHandle 0
$SegmentHandle SclCreatePoint PointHandle1 0
$PointHandle1 SclSetValueByName x 0.0
$PointHandle1 SclSetValueByName y 0.0
$PointHandle1 SclSetValueByName z 0.0
$SegmentHandle SclCreatePoint PointHandle2 1
$PointHandle2 SclSetValueByName x 0.0
$PointHandle2 SclSetValueByName y 2.0
$PointHandle2 SclSetValueByName z 0.0
$SegmentHandle SclCreatePoint PointHandle3 2
$PointHandle3 SclSetValueByName x 2.0
$PointHandle3 SclSetValueByName y 0.0
$PointHandle3 SclSetValueByName z 0.0
$SwaHandle SclCreateTriobject TriobjectHandle 1
$TriobjectHandle SclCreateTrisolation TrisolationHandle 1
$TrisolationHandle SclCreateTriangle TriangleHandle 1
$TriangleHandle SclSetValueByName v0 $PointHandle1
$TriangleHandle SclSetValueByName v1 $PointHandle2
$TriangleHandle SclSetValueByName v2 $PointHandle3
$SwaHandle SclSwaSaveDtmFile test1.str
SclDestroy SwaHandle
puts "Object 1 trisolation 1 created with 1 triangle and saved to test1.str & test1.dtm"

See Also

SclSwaExists
SclCreateString

SclCreateSegment

SclCreatePoint

SclCreateTrisolation

SclDestroy

SclSwaSaveDtmFile

SclSwaSaveStringFile

SclSwaOpenFile

sclSwas