Basics of Scripting

The build-in scripting interface of the LayoutEditor allows to access and modify the design as well as control and adjust the user interface. This scripting is made with simple text files in a C/C++ style and can be used in all areas with the design, user interface, callbacks and parametric cell creation from the schematic. C++ Scripts / Macros will always work with the current opened design. An identical Application Program Interface (API) for all scripting interfaces will make is easy to switch to Python, if required.

Macro Recording

The simplest way to use macros is macro recording. Like many office programs the LayoutEditor can record the operations you have done with the graphical user interface. The operation are stored in a C/C++ style and can be edited with any text editor. The recording can be started via Start Macro Recording and stopped via Stop Recorded Macro both located under Mainmenu/Utilities/Macros. After stopping the recording a TextEditor will be opened with the recorded macro and can be executed directly inside the TextEditor. Stored macros can be executed via the Execute Macro function or added as a new item to the menu or to a toolbar. Macro Recording will work for most features. Just features handling with more than one LayoutEditor windows like Separate layer are not recored.

Example of a recored Macro

#!/usr/bin/layout
#name=created 08.10.17
#help=This macro was recorded Sonntag, 8. Oktober 2017 22:40:34 CEST.

int main(){
layout->drawing->point(13000,-8000);
layout->drawing->point(42000,-29000);
layout->drawing->box();
layout->drawing->point(30000,-22000);
layout->drawing->point(53000,-36000);
layout->drawing->box();
layout->drawing->selectAll();
layout->drawing->mergeSelect();
layout->drawing->point(32000,-22000);
layout->drawing->rotate(40.000000);
}

Integrated TextEditor

To edit macros a TextEditor is integrated into the LayoutEditor. A manual for it should be obsolete. So just some catchwords for it:

  • integrated with the LayoutEditor and SchematicEditor,
  • macros and scipt code can be executed from its user interface by pressing the execute button
  • use --textedit command line option to start direct or choose edit macro from the menu to open it, encoding (like uni code, ASCII, etc.) is detected automaticly for common files, highlighting of syntax is also handled automaticly, more than 30 different highlighter are supported,
  • GDSII files are converted into readable text automaticly,
  • text editor can be access from any macro,
  • macros can be added into the TextEditor menu and toolbor, some macros (e.g. trigger a simulation or digital synthese) are shipped,

integrated TextEditor

Edit as GDSII as Text

The binary GDSII file is automatic converted to a text file and can be edited and stored. Edit GDSII as Text