the fair gds editor MacroExample4

Macro Example 4

The basic handling of cell is shown in this example.

Download: Sample4.layout

This examples as well as a LayoutScript version of it is also included in any LayoutEditor package in the folder macros/examples.

next example

   1 #!/usr/bin/layout
   2 #name=#4: Cells
   3 #help=duplicate current cell
   4 
   5 int  main() {
   6 
   7   // get current Cellname and add "_copy"
   8   string cellname=layout->drawing->currentCell->cellName+"_copy";
   9 
  10   // get pointer to current cell
  11   cell *cellToCopy=layout->drawing->currentCell;
  12 
  13   // add new empty cell
  14   cellList *cl=layout->drawing->addCell();
  15 
  16   // set new cellname
  17   cl->thisCell->cellName = cellname;
  18 
  19   // set new cell to current cell
  20   layout->drawing->setCell(cellname);
  21 
  22   // add cellref to orginal cell
  23   point p;
  24   p.setX(0);
  25   p.setY(0);
  26   element *e=cl->thisCell->addCellref(cellToCopy,p);
  27 
  28   // flat celref
  29   cl->thisCell->selectAll();
  30   cl->thisCell->flatSelect();
  31 
  32   // adjust scalling
  33   layout->drawing->scaleFull();
  34 
  35 }

See also


CategoryMacro


MacroExample4 (last edited 2017-05-07 08:27:37 by JurgenThies)