the fair gds editor LayoutScript
Please Sign in

LayoutScript

LayoutScript in an alternative scripting interface to the build-in C++ Macros having the same Application Programming Interface (API). LayoutScript is available for Python and Ruby. It is a pure scripting interface without any graphical output and runs independent to the LayoutEditor application. It is build as an easy to use scripting feature for all kind of designs and can be use with all other extension modules the supported scripting languages offers. You can try and run LayoutScript without a license key for small designs. For designs with unlimited size a full version of the LayoutEditor is required.

If you need scripting to adjust the user interface with new menu entry, create parametric cells from the schematic or callback macros after changing device parameter, please use LayoutEditor C++ Macros. LayoutScript was introduced with version 20170328.

LayoutScript for Python

Getting Started

Using LayoutScript is very simple. You can start a python script from the integrated TextEditor by pressing the execute button. No setup required. In the script the line "import LayoutScript" will load the module and the line "from LayoutScript import *" will enable to use any LayoutScript command without a prefix. The Application Programming Interface (API) is identical to the LayoutEditor. The LayoutScript module is independent of any open layout window. So please don't forget to save the result in the script. Afterwards the created file can be load in the LayoutEditor.

execute python script

Example

   1 # load the LayoutScript module
   2 import LayoutScript
   3 # use LayoutScript without prefix
   4 from LayoutScript import *
   5 
   6 #create a new layout object
   7 l=project.newLayout();
   8 
   9 #rename a layer
  10 layers.num(6).name="new text"
  11 
  12 c=l.drawing.currentCell
  13 c.cellName="test-cell-python"
  14 
  15 c.addBox(0,0,5000,7000,5)
  16 c.addRoundedBox(10000,0,5000,7000,500,5)
  17 c.addChamferedBox(20000,0,5000,7000,500,5)
  18 c.addCircleBox(point(0,10000),point(5000,17000),5)
  19 c.addEllipse(5,point(12500,15000),2500,3500)
  20 c.addPolygonArc(point(22500,15000),2500,3500,0,340,5)
  21 e=c.addText(5,point(25,25000),layers.num(6).name)
  22 e.setWidth(1000)
  23 l.drawing.saveFile("/home/username/testout.gds")
  24 
  25 print("Python script completed")

Further examples are shipped in the LayoutEditor package. You will find it in the folder macros/examples.

OpenAccess Script

OpenAccess Script is a direct scripting interface to the OpenAccess library. (license key required, only available for Linux and 64bit Windows) It can be use identical to LayoutScript: just press the execute button to start it. For more details on OpenAccess Script please see http://oascript.org.

   1 import oa;
   2 from oa import *;
   3 
   4 p=oaPointArray()
   5 
   6 p.append([45,67]);
   7 p.append([85,34]);
   8 p.append([35,55]);
   9 print( p.getArea());

Platform Notes

LayoutScript for Python is available for Windows, Linux and Mac. It is include in the Windows packages, in all Linux packages and in the package for the newest Mac OS systems. LayoutScript is not included in the Windows XP package and the package for older Mac Systems. On Linux it is recommended to use the package for your distribution. The general Linux package also includes it, but it may interfere with the installed python version. To use LayoutScript from outside the LayoutEditor set the enviourment variables PATH, LD_LIBRARY_PATH, PYTHONHOME and PYTHONPATH to the correct values before starting python. OpenAccess Script cannot be started from outside the LayoutEditor.

LayoutScript for Ruby

Getting Started

Using LayoutScript for Ruby is very simple. You can start a ruby script from the integrated TextEditor by pressing the execute button. No setup required. In the script the line "require 'LayoutScript'" will load the module and the line "include LayoutScript" will enable to use any LayoutScript command without a prefix. The Application Programming Interface (API) is identical to the LayoutEditor. All names are adjusted to the ruby naming convention. The means that all class names start with a capital letter and all methods are named with a separating "_" instead of the use of CamelCase.The LayoutScript module is independent of any open layout window. So please don't forget to save the result in the script. Afterwards the created file can be loaded in the LayoutEditor.

execute python script

Example

   1 # load the module
   2 require 'LayoutScript'
   3 # remove the need of the prefix
   4 include LayoutScript
   5 
   6 #create a new layout object
   7 l=Project.new_layout()
   8 
   9 Layers.num(6).name="new text"
  10 
  11 c=l.drawing.currentCell
  12 c.cellName="test-cell-ruby"
  13 
  14 c.add_box(0,0,5000,7000,5)
  15 c.add_rounded_box(10000,0,5000,7000,500,5)
  16 c.add_chamfered_box(20000,0,5000,7000,500,5)
  17 c.add_circle_box(Point.new(0,10000),Point.new(5000,17000),5)
  18 c.add_ellipse(5,Point.new(12500,15000),2500,3500)
  19 c.add_polygon_arc(Point.new(22500,15000),2500,3500,0,340,5)
  20 e=c.add_text(5,Point.new(25,25000),Layers.num(6).name)
  21 e.set_width(1000)
  22 l.drawing.save_file("/home/user/testout.gds")
  23 
  24 puts("Ruby script completed")

Further examples are shipped in the LayoutEditor package.

OpenAccess Script

OpenAccess Script is a direct scripting interface to the OpenAccess library. (license key required, only available for Linux and 64bit Wondows) It can be use identical to LayoutScript: just press the execute button to start it. For more details on OpenAccess Script please see http://oascript.org.

   1 require "oa"
   2 include Oa
   3 
   4 p=OaPointArray.new
   5 
   6 p.append([45,67])
   7 p.append([85,34])
   8 p.append([35,55])
   9 
  10 puts p.getArea

Further OpenAccess Script examples are included in the LayoutEditor package. You will find it in the folder macros/examples.

Platform Notes

LayoutScript for Ruby is available for Windows, Linux and Mac. It is included in the Windows packages, in all Linux packages and in the package for the newest Mac OS systems. LayoutScript is not included in the Windows XP package and the package for older Mac Systems. On Linux it is recommended to use the package for your distribution. The general Linux package also includes it, but it may interfere with the installed ruby version. To use LayoutScript from outside the LayoutEditor set the environment variables PATH, LD_LIBRARY_PATH, RUBYLIB, RUBYOPT to the correct values before starting ruby. OpenAccess Script cannot be started from outside the LayoutEditor.


LayoutScript (last edited 2017-05-07 10:09:53 by JurgenThies)