Extract Multi Layer Macro
This macro will extract all layer listed in the macro from a design.
Download: extractMultiLayers.layout
1 #!/usr/bin/layout
2 #name=extract multi layers
3 #help=extract more than one layer from a design
4
5 int main() {
6 // get first cell
7 cellList *cells=layout->drawing->firstCell;
8
9 // loop over all cells
10 while (cells!=NULL){
11 if (cells->thisCell!=NULL){
12 // get first Element of this cell
13 elementList *l=cells->thisCell->firstElement;
14 cells->thisCell->selectAll();
15
16 // loop over all elements
17 while (l!=NULL) {
18 if (l->thisElement!=NULL) {
19 if (l->thisElement->isCellref()) l->thisElement->deselectAll();
20 else if (l->thisElement->isCellrefArray()) l->thisElement->deselectAll();
21 else {
22 int layer=l->thisElement->layerNum;
23 //list all layer here you want to keep
24 if (layer==1) l->thisElement->deselectAll();
25 if (layer==3) l->thisElement->deselectAll();
26 if (layer==5) l->thisElement->deselectAll();
27 if (layer==7) l->thisElement->deselectAll();
28 if (layer==9) l->thisElement->deselectAll();
29 if (layer==11) l->thisElement->deselectAll();
30 }
31 }
32 l=l->nextElement;
33 }
34
35 //round all selected elements
36 cells->thisCell->deleteSelect();
37 }
38 cells=cells->nextCell;
39 }
40 }