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

SclGetParent

Overview

SclGetParent returns a handle to the parent of the specified object.

Synopsis

$ChildObjectHandle SclGetParent ParentObjectHandle

Description

The handle to the object that is the immediate parent to the object defined by the contents of the ChildObjectHandle variable is assigned to the ParentObjectHandle variable.

Arguments

  • ChildObjectHandle
  • The contents of this variable must refer to an object that exists in a set of similar objects AND it must have a parent object.

  • ParentObjectHandle
  • The handle to the object that is an immediate parent of ChildObjectHandle is assigned to this variable. The table below shows the different types of child objects that the SclGetParent command can be applied and the type of parent object that is assigned to the ParentObjectHandle variable.

Child object type Parent object type
Point Segment
Segment String
String Swa
Triangle Trisolation
Trisolation Triobject
Triobject Swa
Table Database
Column Table
Delete Table
Insert Table
InsertUpdate Table
Query Table
Row Query
Update Table

Examples

#
# This example selects a point and then climbs the heirarchy all the
# way to the SWA object level displaying details for each successive parent
#
# Execute this script after a string file has been loaded into a
# graphics layer
#
set status [SclSelectPoint PointHandle "Select a point" layer string_id segment_no point_no x y z desc ]
if {$status == $SCL_OK} {
  puts "Selected point handle = $PointHandle"
  $PointHandle SclGetParent SegmentHandle
  puts "Selected segment handle = $SegmentHandle, Segment number = [$SegmentHandle SclGetId]"
  $SegmentHandle SclGetParent StringHandle
  puts "Selected string handle = $StringHandle, String number = [$StringHandle SclGetId]"
  
  $StringHandle SclGetParent SwaHandle
  puts "Selected Swa handle = $SwaHandle, Swa name = [$SwaHandle SclGetId]"
} else {
  puts "Cancel was pressed"
}

 

#
# This example selects a triangle and then climbs the heirarchy all the
# way to the SWA object level displaying details for each successive parent
#
# Execute this script after a DTM file has been loaded into a
# graphics layer
#
set status [SclSelectTriangle TriangleHandle "Select a triangle" layer triobject_no trisolation_no triangle_no]
if {$status == $SCL_OK} {
  puts "Selected triangle handle = $TriangleHandle"
  $TriangleHandle SclGetParent TrisolationHandle
  puts "Selected trisolation handle = $TrisolationHandle, Trisolation number = [$TrisolationHandle SclGetId]"
  $TrisolationHandle SclGetParent TriobjectHandle
  puts "Selected triobject handle = $TriobjectHandle, Triobject number = [$TriobjectHandle SclGetId]"
  
  $TriobjectHandle SclGetParent SwaHandle
  puts "Selected Swa handle = $SwaHandle, Swa name = [$SwaHandle SclGetId]"
} else {
  puts "Cancel was pressed"
}