Donut Array with different Parameters
The macro generates an array of donuts. The inner diameter will grow in x-direction. With the y-direction the outer diameter will change.
Download: donutArray.layout
1 #!/usr/bin/layout
2 #name=donut array
3 #help=an array of donut with different parameter
4
5
6 int main(){
7 int nx=5;
8 int ny=5;
9 int sizeStart=200;
10 int sizeStep=100;
11 int stepX=4000;
12 int stepY=3900;
13 int radiusouter=1000;
14 int radiusinner=500;
15 int radiusStep=50;
16 int x,y;
17 for(x=0;x<nx;x++){
18 for(y=0;y<ny;y++){
19 layout->drawing->activeLayer=10;
20 // creating outer circle
21 layout->drawing->point(x*stepX,y*stepY);
22 layout->drawing->point(x*stepX,y*stepY+radiusouter+radiusStep*y);
23 layout->drawing->point(x*stepX,y*stepY+radiusouter+radiusStep*y);
24 layout->drawing->spiral();
25 layout->drawing->currentCell->firstElement->thisElement->selectAll();
26 //creating inner cirlce
27 layout->drawing->point(x*stepX,y*stepY);
28 layout->drawing->point(x*stepX,y*stepY+radiusinner+radiusStep*x);
29 layout->drawing->point(x*stepX,y*stepY+radiusinner+radiusStep*x);
30 layout->drawing->spiral();
31 layout->drawing->currentCell->firstElement->thisElement->selectAll();
32 //crating connection segment
33 layout->drawing->point(x*stepX,y*stepY+radiusinner+radiusStep*x);
34 layout->drawing->point(x*stepX,y*stepY+radiusouter+radiusStep*y);
35 layout->drawing->path();
36 layout->drawing->currentCell->firstElement->thisElement->selectAll();
37 // merge and convert path to a polygon
38 layout->drawing->mergeSelect();
39 layout->drawing->closeToPolygon();
40 layout->drawing->deselectAll();
41 }
42 }
43 layout->drawing->scaleFull();