Macro
This macro detects all shapes touching or overlapping shapes on a specified layer and sets its datatype. For example this macro can be used to detect vias not connecting the conducting layer below, but a intermediate capacitor layer. Such vias need to have a different datatype for a correct extraction of the connectivity.
Download: setdatatypemacro.layout
1 #!/usr/bin/layout
2 #name=set datatype
3 #help=set datatype to one for all shape touching a special layer
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 if( cells->thisCell->cellName.left(3)=="cmm") {
13 cells->thisCell->deselectAll();
14 // get first Element of this cell
15 elementList *el=cells->thisCell->firstElement;
16 // loop over all element
17 while (el!=NULL) {
18 if (el->thisElement!=NULL){
19 if (el->thisElement->layerNum==91) {
20 el->thisElement->selectAll();
21 cells->thisCell->selectTouchingOrOverlapping(el->thisElement);
22 }
23 }
24 el=el->nextElement;
25 }
26 // loop over all element
27 el=cells->thisCell->firstElement;
28 while (el!=NULL) {
29 if (el->thisElement!=NULL){
30 if ((el->thisElement->layerNum==30)&&(el->thisElement->select)) {
31 el->thisElement->setDatatype(1);
32 }
33 }
34 el=el->nextElement;
35 }
36 cells->thisCell->deselectAll();
37 }
38 }
39 cells=cells->nextCell;
40 }
41 }
42