Creates a polygon from a list of vertices.

syntaxSyntax:
FWizAssembly.DrawPolygon(vertices)

Parameters

Parameter Description
vertices An array of DlxPoint objects with the coordinates used to create the polygon vertices.

Return Value

If an error occurs it returns false otherwise it returns true.

Example

  Copy codeCopy code
function OnBuildAssembly()
{
  var ctx = FWiz.GetAssemblyCtx();
  var pen = FWiz.GetPenStyle(0);
  pen.SetStyle("Marker pen blue");
  ctx.SetPenStyle(pen);
  var brush = FWiz.GetBrushStyle(0);
  brush.SetStyle("Yellow");
  ctx.SetBrushStyle(brush);  
  var size = 10;
  var sides = 6;
  var index = 0;
  var step = Math.PI * 2 / sides;
  var center = new DlxPoint(0, 0);
  var vertices = new Array();
  for (var angle = 0; angle < Math.PI*2; angle += step)
  {
    vertices[index++] = center.Offset(new DlxPoint(size * Math.cos(angle), size * Math.sin(angle)));
  }
  vertices[index++] = vertices[0];
  ctx.DrawPolygon(vertices);
}

See also