Select Paths with a given width
The macro will ask you to enter a width. All pathes in the design having this width will be selected.
Download: selectPathWidth.layout
1 #!/usr/bin/layout
2 #name=select path width
3 #help=select all pathes with a entered width
4
5 int main() {
6 // get required width
7 double d=layout->getDouble("select width","enter width:",0, 3);
8 // width in user units
9 int w=d/layout->drawing->userunits;
10
11 // get first cell
12 cellList *cells=layout->drawing->firstCell;
13
14 // loop over all cells
15 while (cells!=NULL){
16 if (cells->thisCell!=NULL){
17 cells->thisCell->deselectAll();
18 // get first Element of this cell
19 elementList *l=cells->thisCell->firstElement;
20 cells->thisCell->deselectAll();
21
22 // loop over all elements
23 while (l!=NULL) {
24 if (l->thisElement!=NULL) {
25 // if element is a path and have width of w
26 if ((l->thisElement->getWidth()== w) &&
27 l->thisElement->isPath() ){
28
29 //l->thisElement->setWidth(1000); // new width in database units
30
31 // select this element
32 l->thisElement->selectAll();
33 }
34 }
35 l=l->nextElement;
36 }
37
38
39 }
40 cells=cells->nextCell;
41 }
42 }