Sets the brush style for the assembly layer.

syntaxSyntax:
FWiz2DImage.SetBrushStyle(brushStyle = null)
FWiz2DImage.SetBrushStyle(styleIndex = -1)

Parameters

Parameter Description
brushStyle A DlxBrushStyle object with the style of the brush.
styleIndex Index of the style. There are 10 styles available with indexes from 0 to 9. Specifying -1 sets the default style for the assembly layer.

Return Value

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

Example

  Copy codeCopy code
function OnBuild2DImage()
{
  var ctx = FWiz.Get2DImageCtx();
  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