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

SclViewport getCameraPosition

Overview

You use this command to find the x, y, and z coordinates of the camera for the viewport.

Synopsis

SclViewport getCameraPosition <$viewportHandle> <x> <y> <z>

Description

Get the position of the camera for the viewport referred to by the handle. The camera values in each direction are returned into the named Tcl variables x, y, and z.

Arguments

  • getCameraPosition
  • A literal string to identify the function.

  • <$viewportHandle>
  • The reference handle to the viewport you want to get the camera position of.

  • <x>
  • Returns the x position of the camera.

  • <y>
  • Returns the y position of the camera.

  • <z>
  • Returns the x position of the camera.

Returns

If successful, this command returns $SCL_OK. If the viewport handle is not valid,an error message is returned.

Examples

# Get and set the camera position for a viewport
set vp [SclViewport getActive]
SclViewport getCameraPosition $vp xPos yPos zPos
puts "Camera target is at X=$xPos ; Y=$yPos ; Z=$zPos"
# Move the camera 100 metres right
SclViewport setCameraPosition $vp [expr $xPos + 100] $yPos $zPos
SclViewport getCameraPosition $vp xPos yPos zPos
puts "Camera position is now X=$xPos ; Y=$yPos ; Z=$zPos"