Tool POLYGON
From RealWorld Wiki
POLYGON is a drawing tool capable of drawing filled polygons. Polygons may have any number of vertices (at least 3).
[edit] Scripting parameters
POLYGON tool can be used from scripts. The command in script must have the following arguments:
- coords - pairs of floating point numbers representing vertex coordinates. There must be at least 6 numbers to define X and Y coordinates of three points.
[edit] Example
DrawTool.POLYGON(Document, 50, 10, 90, 90, 50, 70, 10, 90);
// draw a circle section (2/5 of full circle) (center is at [100, 100], radius is 50)
var coords = new Array();
for (i = 0; i <= 20; ++i)
{
coords[i+i] = 100+50*Math.cos(i*2*3.1415/50);
coords[i+i+1] = 100+50*Math.sin(i*2*3.1415/50);
}
DrawTool.POLYGON(Document, 100, 100, coords);