logo

Macro Programming Example 5

logo

Introduction
Screenshots
License/Download
Installation
Userinterface
Function Index
Macro Programming
Links
Community

mouse left
no help

#!/usr/bin/layout
#name=#5: Elements
#help=eleminate negative (absolute) width

int  main() {
// get first cell
  cellList *cells=layout->drawing->firstCell;

// loop over all cells
  while (cells!=NULL){
    if (cells->thisCell!=NULL){
// get first Element of this cell
       elementList *l=cells->thisCell->firstElement;
cells->thisCell->deselectAll();

// loop over all elements
       while (l!=NULL) {
           if (l->thisElement!=NULL) {

// if element is a path with a width less than 0
               if ((l->thisElement->getWidth()< 0) &&
                    l->thisElement->isPath() ){

// setWidth to zero
                   l->thisElement->setWidth(0);


/* to set to userunits use:
l->thisElement->setWidth(60/layout->drawing->userunits);
*/

                   // select this element
l->thisElement->selectAll();
               }
if ((l->thisElement->getWidth()< 0) &&
                    l->thisElement->isText() ){
l->thisElement->setWidth(-10);
}
           }
           l=l->nextElement;
       }

//round all selected elements
cells->thisCell->roundSelect(10);
cells->thisCell->deselectAll();
    }
    cells=cells->nextCell;
  }
}

SourceForge.net LogoThis page may be outdated. Visit the new LayoutEditor homepage for the newest infomations!