vpoly.sml

  Download

More scripts: Vector

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# vpoly.sml
clear();
vector V;
array numeric xPoints[10], yPoints[10], polyList[10];
numeric numPolys, polyNum, polyCount;
GetOutputVector(V, "VectorToolkit");
# draw some boxes  - this will create polygons
# all closed lines are converted to polygons
xPoints[1] = 0;
yPoints[1] = 0;
xPoints[2] = 100;
yPoints[2] = 0;
xPoints[3] = 100;
yPoints[3] = 100;
xPoints[4] = 0;
yPoints[4] = 100;
xPoints[5] = 0;
yPoints[5] = 0;
numeric i, j;
for i = 0 to 5 {
	VectorAddLine(V, 5, xPoints, yPoints);
	for j = 1 to 5 {
		xPoints[j] = xPoints[j] + 150;
		}
	} 
numPolys = NumVectorPolys(V);
print("number of polygons: ", numPolys);
# now delete one polygon
polyNum = 1;
VectorDeletePoly(V, polyNum);
numPolys = NumVectorPolys(V);
print("number of polygons: ", numPolys);
# now delete multiple polygons
polyList[1] = 1;
polyList[2] = 3;
polyCount = 2;
VectorDeletePolys(V, polyList, polyCount);
numPolys = NumVectorPolys(V);
print("number of polygons: ", numPolys);