You are here: Surpac Concepts > Macros > SCL > Viewport and Layers > SclGetActiveViewport
GEOVIA Surpac

SclGetActiveViewport

Overview

The 3D Graphics environment that Scl integrates with has viewports that string and triangle data are drawn in. There is always at least one viewport but there may be more than one viewport, depending on the users actions.

There is always one viewport that is known as the active viewport. This viewport is indicated by the title bar of the viewport being highlighted in a different colour to other viewports.

The SclGetActiveViewport command returns a handle to the active viewport for use with other Scl commands. A common use for the active viewport is to include a SWA into the set of graphics layers using the sclAdd command and to ensure data is drawn into the active viewport.

The active viewport is changed by user actions. Using the mouse to click in a viewport makes that viewport the active viewport.

Synopsis

SclGetActiveViewport ViewportHandle

Description

Return the handle of the active viewport into the ViewportHandle variable.

Arguments

  • ViewportHandle
  • Passed by reference. The handle to the active viewport is assigned to this variable.

Examples

#
# This example shows how a the active viewport handle is obtained and
# then used to determine the viewport into which a SWA is included and drawn
#
# To use this example either create a file called pit1.str or change
# the name of the file to match a file that exists in the current directory
#
SclGetActiveViewport ViewportHandle
# create the swa and add it to the set of Graphics layers
SclCreateSwa SwaHandle "scl graphics layer"
sclGraphicsLayers SclAdd $SwaHandle sclViewports
# load the file and draw it
if {[catch {$SwaHandle SclSwaOpenFile "pit1.str"}] != 0} {
  puts "Error loading file"
} else {
  SclFunction "ZOOM ALL" {}
  $SwaHandle SclGetStrings StringsHandle
  $StringsHandle SclDraw
}