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

SclGraphicsScaleObject

Overview

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

SclGraphicsScaleObject is generally most useful when the data is centred on X=0, Y=0, Z=0 as the results are easier to predict. SclGraphicsTranslateObject can be used to translate rotated or scaled geometry to a location that is near other geometry of interest.

Synopsis

SclGraphicsScaleObject $xrot $yrot $zrot

Description

This command scales all geometry in the currently open node of the graphics database by the specified amounts in the X, Y and Z directions. Note that the coordinates are multiplied by the scale factors so the further away from the origin the greater the relative amount of movement.

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

Arguments

  • xscale, yscale, zscale
  • Pass by value. The amount of scaling in the X, Y and Z directions respectively. A value of 1.0 causes no scaling. A value of zero causes the dimension to shrink to zero. If all scales are zero the geometry will shrink to a dot. A scale of 0.5 causes a halving size while a factor of 2.0 causes a doubling in size.

Returns

Nothing.

Examples

#
# Create a node and insert a small polyline then scale it
# in an animation loop
#
SclGraphicsOpen mygraphicsnode
  # create the lists of coordinate values
  set xlist [list -0.5 0.5 -0.5  0.5 -0.5]
  set ylist [list -1.0 1.0  1.0 -1.0 -1.0]
  set zlist [list  0.0 0.0  0.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 1} {$i < 3} {incr i} {
    SclGraphicsScaleObject $i $i 1
    SclGraphicsUpdateDisplay
    SclPause 1
  }
SclGraphicsClose

See Also

SclGraphicsScaleObject
SclGraphicsTranslateObject

SclGraphicsUnSetModellingMatrix