Support Forum

Creating array with different layers

asi

Sunday 10th January 2021
Dear LayoutEditor Team, I wonder if there any option to automatically create an array of elements, where each element will be in a different layer ? Best Regards, Asi.
J├╝rgen
LayoutEditorFull
Sunday 10th January 2021
That is no problem. You will need a little script for it. The script below will do something like that. It will generate a two dimensional array of circles with changing the layer in one direction and changing the radius in the other direction. This macro is shipped with any LayoutEditor package in the sub-folder macros/examples and names *circle.layout*. To run it just open it with the integrated TextEditor and press the execute button. ```cpp #!/usr/bin/layout #name=circle array #help=an array of circles with different parameter int main(){ int nx=10; int ny=9; int sizeStart=1000; int sizeStep=50; int stepX=4000; int stepY=3900; int x,y; for(x=0;x<nx;x++){ for(y=0;y<ny;y++){ int radius=x*sizeStep+sizeStart; layout->drawing->activeLayer=y; layout->drawing->p(x*stepX,y*stepY); layout->drawing->p(x*stepX,y*stepY+radius); layout->drawing->circle(); } } layout->drawing->scaleFull(); } ```