Class Reference layout

The main window of the layout design. More...

Member

void addFunctionKey(int key,int function)
void addMacroKey(int key,string macroFileName, string title, string iconFileName)
void addMacroMenuEntry(string macroName, stringList menu)
void addMacroToolButton(string macroName,string parameter,string iconfilename)
backgroundModule* backgroundTool
barcodeModule* barcodeTool
booleanHandler* booleanTool
void choose()
void chooseImport()
void closeDesign()
bool debug
drawingField* drawing
drc* drcTool
int executeMacro(string filename)
extractionModule* extractionTool
string filename
int getBool(string caption,string label)
string getDirectory(string path="")
double getDouble(string caption,string label,double value=0, int digits=1)
int getInteger(string caption,string label, int value=0)
string getItem(string caption,string label,stringList values)
int getLayer(string label, int value=0)
point getMousePoint()
string getOpenFilename(string filter="", string path="")
string getStatistic()
string getSaveFilename(string filter="")
int getSize(string caption,string label, int value=1)
string getText(string caption,string label,string value="")
string getToolbarState()
string getVersion()
void hideToolBar(string name)
void macroPause()
string macroToolbarName
netListModule* netlistTool
bool objectExists()
bool objectVisible()
void open(string fileName)
void print()
bool resetShortcut(int function)
void save()
void saveAs()
void screenshot()
void setCell()
void setCellname()
void setLayerSorting(int sort)
void setMenuEnabled(string name,bool b)
bool setShortcut(string function,string key)
bool setShortcut(int function,string key)
void setSnapToGrid(bool b)
void setSnapToPoint(bool b)
void setSnapToMiddle(bool b)
void setSnapToLine(bool b)
void setSnapToCenter(bool b)
void setSnapToIntersection(bool b)
void setToolbarEnabled(string name,bool b)
void setToolbarState(string)
void showMessage(string caption,string label)
void showStatus(string label,int time=2000)
textEdit* showTextEditor()
void showToolBar(string name)
void toolBarAdd(string name,string buttons)
void updateMacros()
view3dModule* view3dTool
void deleteActuellCell()
void group()
void newCell()
void saveScreenshot(string filename)
void trigger3dRenderAll()
void trigger3dRenderAuto()
void trigger3dRenderSelect()

Detailed Description

graph LR classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; la(layout)==drawing==>dr(drawingField) click dr "/layoutscript/api/drawingfield" click la "/layoutscript/api/layout" class dr clas class la thisClas la==backgroundTool==>ba(backgroundModule) click ba "/layoutscript/api/backgroundmodule" class ba clas la==barcodeTool==>br(barcodeModule) click br "/layoutscript/api/barcodemodule" class br clas la==booleanTool==>bo(booleanHandler) click bo "/layoutscript/api/booleanhandler" class bo clas la==drcTool==>drc(drc) click drc "/layoutscript/api/drc" class drc clas la==extractionTool==>ex(extractionModule) click ex "/layoutscript/api/extractionmodule" class ex clas la==netlistTool==>net(netListModule) click net "/layoutscript/api/netlistmodule" class net clas la==view3dTool==>vd(view3dModule) click vd "/layoutscript/api/view3dmodule" class vd clas

The layout object is the main window of the Layout Editor: the frame with menus, toolbars and the drawing. In a C++ macro that was started from that window you already have this object under the name layout; you do not create it yourself. Almost every layout script starts here and then walks into the design through layout->drawing, which is a drawingField. That drawing holds the cells and shapes. Specialized tools hang off the same window: booleanTool for Boolean operations, drcTool for the design-rule checker, netlistTool for netlists, barcodeTool, backgroundTool, extractionTool and view3dTool. File dialogs, messages and shortcuts also live on layout, so a typical macro mixes window commands with drawing commands. In in-process Python there is no global layout name; use project currentLayout() or newLayout() to get a window, then the same members as in C++.

Example:

layout->filename = "/tmp/sample.gds";
layout->drawing->activeLayer = 1;
layout->drawing->point(0, 0);
layout->drawing->point(1000, 800);
layout->drawing->box();

In Python:

l = project.currentLayout()
if l is None:
 l = project.newLayout()
l.drawing.activeLayer = 1
l.drawing.point(0, 0)
l.drawing.point(1000, 800)
l.drawing.box()

Member Function Documentation


void layout::addFunctionKey(int key,int function)

Set the feature of an extra keyboard. key is the number of the key. It is numbered from 0 to the amount of keys the keyboard has. function is the feature code of the feature you want to add. As with tool buttons, modifications of the extra keyboard are not stored; set them from an autostart macro. (introduced with release 20210905)

Parameter:
key key index on the extra keyboard, starting at 0
function feature code to assign

void layout::addMacroKey(int key,string macroFileName, string title, string iconFileName)

Assigns one key of an external keyboard to a macro. key is the key number. macroFileName is the full path of the macro, title the caption, and iconFileName the full path of the icon file. (introduced with release 20210910)

Parameter:
key key index on the extra keyboard
macroFileName full path of the macro file
title caption shown for the key
iconFileName full path of the icon file

void layout::addMacroMenuEntry(string macroName, stringList menu)

Adds a macro named macroName to the LayoutEditor menu by copying it into the LayoutEditor folder in your home directory. The menu position is defined by the list menu. If that list has two entries Utilities and My_macros, the macro appears under Utilities/My_macros. Unlike addMacroToolButton, the entry survives a restart. To remove it, delete the copied macro in that folder. The method adds home/LayoutEditor/menu to setup::macroPath if needed. (introduced by version 20210612)

Parameter:
macroName name of the macro to install
menu path segments of the target menu

void layout::addMacroToolButton(string macroName,string parameter,string iconfilename)

Adds a button to the Macros toolbar (the toolbar is created if it is missing). macroName is the full path of the macro to run. iconfilename is the icon file; a missing file uses the default macro icon. parameter should be an empty string (reserved). Macro buttons are not stored at shutdown; restore them from an autostart macro.

Parameter:
macroName full path of the macro
parameter reserved; pass an empty string
iconfilename path to the button icon

backgroundModule* layout::backgroundTool

Background images are reached through this pointer to backgroundModule.


barcodeModule* layout::barcodeTool

Barcode generation is reached through this pointer to barcodeModule.


booleanHandler* layout::booleanTool

Boolean operations on shapes are reached through this pointer to booleanHandler.


void layout::choose()

A file dialog to select a filename is opened. The selected file will be loaded.


void layout::chooseImport()

A file dialog is shown. The selected file will be imported and added to the existing file.


void layout::closeDesign()

The current design will be removed and an empty design is shown like after the program start.


static bool layout::debug

If it is true, the debug mode is on. In the debug mode additional information is printed to the terminal where the LayoutEditor is started. If the LayoutEditor was not started from a terminal the output is not visible.


drawingField* layout::drawing

This pointer to drawingField is the design: cells, layers, load and save.


drc* layout::drcTool

The design-rule checker is reached through this pointer to drc.


int layout::executeMacro(string filename)

Another macro is executed. The execution of the calling macro stopped until the termination or completion of the started macro.

Parameter:
filename filename of the macro to be executed

Returns: the exit code of the called macro


extractionModule* layout::extractionTool

Electrical extraction is reached through this pointer to extractionModule.


string layout::filename

This string hold the filename of the current opened design. In case of an OpenAccess design it contains the library name with an extension '.oa'.


int layout::getBool(string caption,string label)

The user will be prompted to enter a boolean.

Parameter:
caption title of the window
label text in the dialog inside the window

Returns: 0 if yes/true is selected, otherwise '1' is returned.


string layout::getDirectory(string path="")

A user interface to select an exinsting folder is displayed (introduced with release 20201123).

Returns: the folder choosen by the use, an empty string is returned in case the operation was canceled.


double layout::getDouble(string caption,string label,double value=0, int digits=1)

The user will be prompted to enter a double.

Parameter:
caption the title of the window
label this string will be displayed inside the window
value default value
digits maximal number of digits

Returns: the double entered by the user


int layout::getInteger(string caption,string label, int value=0)

The user will be prompted to enter a integer.

Parameter:
caption the title of the window
label this string will be displayed inside the window
value default value

Returns: the integer entered by the user.


string layout::getItem(string caption,string label,stringList values)

The user will be prompted to choose a item from a list.

Parameter:
caption the title of the window
label this string will be displayed inside the window before the list
values a list with all items

Returns: the item text choosen by the user. An empty string is returned in the case the Cancel button was pressed.


int layout::getLayer(string label, int value=0)

The user will be prompted to choose a layer from a list of all existing layers.

Parameter:
label propt text of the dialog
value default value

Returns: the layer number entered by the user. -1 is returned in the case the Cancel button was pressed.


point layout::getMousePoint()

The execution of the macro is stoped until the user entered a mouse inside the drawing by mouse. The entered mouse position is returned. The user has full control of the displayed design like changuing the displayed cell or zoom in and out. This feature is only available in C++ scripts.

Returns: a value of type point layout.


string layout::getOpenFilename(string filter="", string path="")

A file open dialog is shown. The optinal parameter filter set the default filter use in the dialog. The filter format is "filtername (*.ex1 *.ex2)". With path the folder the dialog starts with is set.

Returns: a string with the filename or a empty string if the Cancel button was pressed.

Parameter:
filter filter
path path

string layout::getStatistic()

Returns: a string with some statistic information on the design.


string layout::getSaveFilename(string filter="")

A file save dialog is shown. The optional parameter filter set the default filter use in the dialog. The filter format is "filtername (*.ex1 *.ex2)".

Returns: a string with the filename or a empty string if the Cancel button was pressed.


int layout::getSize(string caption,string label, int value=1)

The user will be prompted to enter a value in userunits.

Parameter:
caption the title of the window
label this string will be displayed inside the window
value default value in database units

Returns: value entered by the user in database units


string layout::getText(string caption,string label,string value="")

The user will be prompted to enter a text.

Parameter:
caption the title of the window
label this string will be displayed inside the window
value default value

Returns: the text entered by the user. An empty string is returned in the case the Cancel button was pressed.


string layout::getToolbarState()

Returns: an encoded string containing all required information to restore the current toolbar and dock window setup. With setToolbarState the current setup can be restored


string layout::getVersion()

Returns: a string with the current version number of the LayoutEditor. (introduced with release 20201223)


void layout::hideToolBar(string name)

Hides the toolbar with the name.


void layout::macroPause()

paused the macro and enables user interaction to the design. The macro is continued with a right mouse click in most modes. This feature is only available in C++ scripts.


string layout::macroToolbarName

Holds the name of the toolbar containing custom macros. The name must be set before the first macro is added to the toolbar. (introduced with release 20211216)


netListModule* layout::netlistTool

Netlist utilities are reached through this pointer to netListModule.


bool layout::objectExists()

Returns: true if an layout window was already created during the start of the software. By using autoLayerMacro.layout macro it can happened that the macro is executed before a layout object is available and its methods can be used. With this method this can be checked without causing an an error rising up. This method is only available in C++ macros. (introdiuced with release 20201201)


bool layout::objectVisible()

Returns: true if a layout window is currently visible on the screen. This function is indended to avoid any output on a non-visible window like a layout->showStatus("text");. (introduced with release 20201230)


void layout::open(string fileName)

The design with the name fileName is opened. If the current design was changed, you will be asked to save it before.


void layout::print()

A printer dialog will be opened.


bool layout::resetShortcut(int function)

Resets the shortcut with the given feature code to its default. (introduced with release 20231115)

Returns: true if the shortcut was reset, otherwise false.


void layout::save()

The current opened design will be saved to disc. If the meber variable filename is empty, you will be prompted to enter a filename.


void layout::saveAs()

You will be prompted to enter a filename. The current design will be saved.


void layout::screenshot()

The screen view will be saved. You will be prompted to enter a filename. The screen resolution is used for the pixel gaphic.


void layout::setCell()

You will be prompted to select a cell. The cell will be displayed.


void layout::setCellname()

You will be prompted to enter a name for the current displayed cell.


void layout::setLayerSorting(int sort)

Sets the display of the layer window inside the layout window.

sort value sorting
1 layer as list
2 layer as block
3 sort by name
4 sort by number
5 sort by 3d lavel

void layout::setMenuEnabled(string name,bool b)

disabled or enabled a single menu entry or a hole menu.

 layout->setMenuEnabled("Draw/Merge",false); // the merge item in the draw menu will be disabled
 layout->setMenuEnabled("Draw/Merge",true); // enabled again

 layout->setMenuEnabled("File",false); // the file menu will be disabled

 layout->setMenuEnabled("Utilities/Misc",false); // the Misc menu within the Utilities will be disabled
Parameter:
name name
b b

bool layout::setShortcut(string function,string key)

Changes an existing shortcut. & marks the underlined letter in the menu name; put & in front when the first character is the accelerator.

layout->setShortcut("&Zoom Fit All","F"); // set 'F' to zoom fit
layout->setShortcut("&Zoom Fit Selection","Shift+F"); // set 'Shift F' to zoom fit selection

Shortcuts are not stored at shutdown and do not apply to windows opened later. Put this in an autostart macro so every window gets the same keys.

Parameter:
function menu caption of the feature, with & for the accelerator
key new key sequence, for example F or Shift+F

Returns: true if the shortcut was changed, otherwise false.


bool layout::setShortcut(int function,string key)

Same as the overload that takes a caption, but function is a feature code.

Parameter:
function feature code
key new key sequence

Returns: true if the shortcut was changed, otherwise false.


void layout::setSnapToGrid(bool b)

Snapping to grid is activated or deactivated depending on the given bool value.


void layout::setSnapToPoint(bool b)

Snapping to point is activated or deactivated depending on the given bool value.


void layout::setSnapToMiddle(bool b)

Snapping to middle of a line is activated or deactivated depending on the given bool value.


void layout::setSnapToLine(bool b)

Snapping to line is activated or deactivated depending on the given bool value.


void layout::setSnapToCenter(bool b)

Snapping to shape center is activated or deactivated depending on the given bool value.


void layout::setSnapToIntersection(bool b)

Snapping to intersections is activated or deactivated depending on the given bool value.


void layout::setToolbarEnabled(string name,bool b)

disabled or enabled a toolbar.

 layout->setToolbarEnabled("Edit",false);
Parameter:
name name
b b

void layout::setToolbarState(string)

Sets the toolbar and dock window configuration. The string parameter needs to be created with the getToolbarState.


void layout::showMessage(string caption,string label)

A message will be displayed.

Parameter:
caption the title of the window
label this string will be displayed inside the window

void layout::showStatus(string label,int time=2000)

A message will be displayed in the statusbar for 2 seconds. The macro will continue to run. If the further status message is posted before the 2 seconds are over, the existing message is exchanged. The time the message is shown can be adjusted with the option parameter time. This optinal parameter is in milli seconds and was introduced with release 20250116.

Parameter:
label text displayed in the status bar

textEdit* layout::showTextEditor()

Creates a new text-editor window in a thread-safe way.

Returns: a pointer to the new textEdit window.


void layout::showToolBar(string name)

Shows the name toolbar.


void layout::toolBarAdd(string name,string buttons)

Add a new tool bar, separate multipli buttons with a ';'. Next to the feature name the feature code can be use to spezify the feature.

layout->toolBarAdd("my toolbar","New Layout;Zoom Mouse;Code 39;Quit");
Parameter:
name name
buttons buttons

void layout::updateMacros()

Updates the macros in the menu. This method needs to be called after the macro path is changed or new files had been added to the file tree. (introduced 20260205)


view3dModule* layout::view3dTool

The 3d view from the 2d layout is reached through this pointer to view3dModule.

Obsolete Members


void layout::deleteActuellCell()

After a confirmation the current display cell will be deleted. If there are no more cell in the drawing, a new empty cell will be created.

OBSOLETE: Please use drawing->deleteCurrentCell() instead.


void layout::group()

All selected elements are moved to a new cell. A correlating cellref will be added.

OBSOLETE: Please use drawing->group() instead.


void layout::newCell()

A new empty cell will be added, named with an unused cell name and it is set as current cell.

OBSOLETE: Please use drawing->newCell() instead.


void layout::saveScreenshot(string filename)

The screen will be saved in the file with the name filename. The type is selected by the extension.

OBSOLETE: Please use drawing->saveScreenshot(string filename) instead.


void layout::trigger3dRenderAll()

renderAll will be called after the macro terminates.

OBSOLETE: Please use view3dTool->trigger3dRenderAll() instead.


void layout::trigger3dRenderAuto()

renderAuto will be called after the macro terminates.

OBSOLETE: Please use view3dTool->trigger3dRenderAuto() instead.


void layout::trigger3dRenderSelect()

renderSeclect will be called after the macro terminates.

OBSOLETE: Please use view3dTool->trigger3dRenderSelect() instead.