Remove Negative Spacing Macro
This macro removes arrays with negative spaceing. Such a spacing cannot be store in some file formats.
Download: r_negativspace.layout
1 #!/usr/bin/layout
2 #name=remove neg. spaced arrays
3 #help=removes cellref arrays with negative spacing
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->deselectAll();
15
16 // loop over all elements
17 while (l!=NULL) {
18 if (l->thisElement!=NULL) {
19
20
21 if (l->thisElement->isCellrefArray() ){
22
23
24 pointArray pa= l->thisElement->getPoints();
25 if (pa.point(1).x()<0) l->thisElement->selectAll();
26 if (pa.point(1).y()<0) l->thisElement->selectAll();
27 if (pa.point(2).x()<0) l->thisElement->selectAll();
28 if (pa.point(2).y()<0) l->thisElement->selectAll();
29 }
30 }
31 l=l->nextElement;
32 }
33
34
35 cells->thisCell->flatSelect();
36 cells->thisCell->deselectAll();
37 }
38 cells=cells->nextCell;
39 }
40 }