You are here: Surpac Concepts > Macros > SCL > SCL Graphics Drawing > SclGraphicsTranslateObject
GEOVIA Surpac

SclGraphicsTranslateObject

Overview

Translate all geometry in the currently open node of the graphics database by a defined amount in the X, Y and Z directions. Successive translations are cumulative so if you need to ensure that the translations you are setting on some geometry are not affected by prior translations use SclGraphicsUnSetModellingMatrix to forget any existing rotation, scaling and translation settings.

SclGraphicsTranslateObject is generally most useful when the data is centred on X=0, Y=0, Z=0 as the results are easier to predict.

Synopsis

SclGraphicsTranslateObject $xtran $ytran $ztran

Description

This command translates all geometry in the currently open node of the graphics database by the specified amounts in the X, Y and Z directions.

Translations are cumulative and are inherited down the hierarchy of nodes in the graphics database.

Arguments

  • xstran, ytran, ztran
  • Pass by value. The amount of translation in the X, Y and Z directions respectively.

Returns

Nothing.

Examples

#
# Create a node and insert a small polyline then translate, rotate and scale 
# it in an animation loop
#
SclGraphicsOpen mygraphicsnode
  # create the lists of coordinate values
  set xlist [list -.5 .5 -.5 .5 -.5]
  set ylist [list -1 1 1 -1 -1]
  set zlist [list 0 0 0 0 0]
  # insert the polyline and remember its key
  set key [SclGraphicsInsertPolyline $xlist $ylist $zlist ]
  # set the rendering attributes
  SclGraphicsSetColour "lines=pink"
  SclGraphicsSetVisibility "markers=off"
  SclGraphicsSetLineWeight 2
  SclGraphicsSetLinePattern "---"
  SclGraphicsSetHeuristics "quick moves=on"
  for {set i 0} {$i < 180} {incr i} {
    SclGraphicsRotateObject 0.0 0.0 2.0
    SclGraphicsScaleObject 0.95 0.95 0.0
    SclGraphicsTranslateObject 0.05 0.01 0.0
    SclGraphicsUpdateDisplay
  }
SclGraphicsClose

See Also

SclGraphicsScaleObject
SclGraphicsTranslateObject

SclGraphicsUnSetModellingMatrix