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

SclGraphicsInsertPolygon

Overview

Insert a polygon into the currently open node of the graphics database.

Synopsis

SclGraphicsInsertPolygon $xlist $ylist $zlist

Description

This command inserts a polygon at the specified XYZ location. The polygon edge weight, edge pattern, face pattern and colour are determined by other SclGraphics commands.

A polygon is an infinitely thin geometric object defined by a series of points which need not be explicitly closed. An explicit closure is permitted but if omitted closure is assumed from the last point to the first point.

A polygon may have different colours for its face (the interior) and edges (the perimeter). Other attributes that may be set are edge weight (thickness), edge pattern and face pattern. A polygon may consist of any number of points and while non-coplanar polygons are permitted they may produce unexpected rendering results.

Arguments

  • x, y, z
  • Pass by value. The XYZ coordinates of the polygon. If these values place the polygon outside the screen extents the polygon will not be visible.

    The X, Y and Z values must be defined in a TCL list. All lists must be non-zero in length and they must have equal numbers of entries.

Returns

The key to the polygon so that it can be selectively deleted using SclGraphicsDeleteByKey.

Examples

#
# Create a node and insert a small polygon
#
SclGraphicsOpen mygraphicsnode
  # create the lists of coordinate values
  set xlist [list 2480 2481 2486 2490]
  set ylist [list 6750 6760 6750 6740]
  set zlist [list 150 140 150 160]
  # insert the polygon and remember its key
  set key [SclGraphicsInsertPolygon $xlist $ylist $zlist ]
  # set the rendering attributes
  SclGraphicsSetColour "faces=green, edges=pink"
  SclGraphicsSetVisibility "markers=on"
  SclGraphicsSetEdgeWeight 2
  SclGraphicsSetEdgePattern "-.-."
  SclGraphicsSetFacePattern "##"
SclGraphicsClose
# and now make sure we can see it
SclGraphicsUpdateDisplay

See Also

SclGraphicsSetEdgePattern
SclGraphicsSetEdgeWeight

SclGraphicsSetFacePattern

SclGraphicsSetColour