the fair gds editor LayoutEditorPython
Please Sign in

LayoutEditor for Python

LayoutEditor for Python is a stand alone python module with a fully featured graphical user interface of the LayoutEditor. It allows to embed the LayoutEditor into your own python application with a graphical user interface. The user interface of the LayoutEditor can be adjusted and new features can be added. The application programming interface (API) of LayoutEditor for python is similar to the native macros of the LayoutEditor. However to control data access and adjust the user interface additional features are available. Using these additional feature is essential to get a stable application. If you just need simple scripting with python, you should better use LayoutEditor macros or LayoutScript for Python. LayoutEditor for Python requires a full version license of the LayoutEditor. A free demo is not available.

Contents

  1. LayoutEditor for Python
    1. Getting Started
      1. Python Macros
    2. Additional Methods
      1. class backgroundModule
        1. void backgroundModule::initDock()
      2. class booleanHAndler
        1. booleanHandler::booleanHandler(drawingField *drawing)
      3. class drawingField
        1. bool drawingField::mutexAddGuiTryLock()
        2. void drawingField::mutexAddUnlock()
        3. bool drawingField::mutexReadTryLock()
        4. bool drawingField::mutexReadGuiTryLock()
        5. void drawingField::mutexReadLock()
        6. void drawingField::mutexReadUnlock()
        7. void drawingField::mutexChangeLock()
        8. bool drawingField::mutexChangeTryLock()
        9. bool drawingField::mutexChangeGuiTryLock()
        10. void drawingField::mutexChangeUnlock()
        11. bool drawingField::paint()
        12. bool drawingField::recountSelect()
        13. void drawingField::setAlignCenterMode()
        14. void drawingField::setAlignCenterXMode()
        15. void drawingField::setAlignCenterYMode()
        16. void drawingField::setAlignBottomMode()
        17. void drawingField::setAlignLeftMode()
        18. void drawingField::setAlignRightMode()
        19. void drawingField::setAlignTopMode()
        20. void drawingField::setAlignValueMode()
        21. void drawingField::setAngleMode()
        22. void drawingField::setArcMode()
        23. void drawingField::setBezier2Mode()
        24. void drawingField::setBezier3Mode()
        25. void drawingField::setBoxMode()
        26. void drawingField::setCdeselectMode()
        27. void drawingField::setCellOriginMode()
        28. void drawingField::setCellrefMode()
        29. void drawingField::setCellrefArrayMode()
        30. void drawingField::setCenterMode()
        31. void drawingField::setCenterXMode()
        32. void drawingField::setCenterYMode()
        33. void drawingField::setCircleMode()
        34. void drawingField::setCircleBoxMode()
        35. void drawingField::setCircleFitMode()
        36. void drawingField::setCommandMode()
        37. void drawingField::setCopyMode()
        38. void drawingField::setCrossMode()
        39. void drawingField::setCselectMode()
        40. void drawingField::setCutMode()
        41. void drawingField::setElementSizeMode()
        42. void drawingField::setFdeselectMode()
        43. void drawingField::setFselectMode()
        44. void drawingField::setInsertPointMode()
        45. void drawingField::setLengthMode()
        46. void drawingField::setLengthElementMode()
        47. void drawingField::setMirrorMode()
        48. void drawingField::setModifyAdded()
        49. void drawingField::setModifyChanged()
        50. void drawingField::setModifySaved()
        51. void drawingField::setMoveEdgeMode()
        52. void drawingField::setMoveMode()
        53. void drawingField::setMovePointMode()
        54. void drawingField::setMoveXMode()
        55. void drawingField::setMoveYMode()
        56. void drawingField::setNodeMode()
        57. void drawingField::setPathMode()
        58. void drawingField::setPdeselectMode()
        59. void drawingField::setPolygonMode()
        60. void drawingField::setPolygonArcMode()
        61. void drawingField::setPropertiesMode()
        62. void drawingField::setPselectMode()
        63. void drawingField::setRotateMode()
        64. void drawingField::setRulerMode()
        65. void drawingField::setSectorMode()
        66. void drawingField::setSelectCellMode()
        67. void drawingField::setSpiralMode()
        68. void drawingField::setTextMode()
        69. bool drawingField::setZoomMode()
        70. bool drawingField::showDevice(string device)
        71. bool drawingField::showDeviceNode(string device,int i)
        72. bool drawingField::showNode(int i)
      4. class drc
        1. void drc::initDock()
      5. class extracntionModule
        1. void extractionModule::initDock()
      6. class layout
        1. void layout::addCommandLineDock()
        2. void layout::addLayerDock()
        3. void layout::addMacros()
        4. void layout::addMouseHelp()
        5. void layout::add3dDock()
        6. QMenu * layout::getMenu(string name)
        7. void layout::guiSetupBasic()
        8. void layout::guiSetupFull()
        9. void layout::guiSetupReduced()
        10. void layout::guiSetupViewer()
        11. void layout::guiUpdate()
        12. void layout::menuAdd(string name,string entries )
        13. QToolBar * layout::toolBarLast()
      7. class netListModule
        1. void netListModule::initDock()
        2. bool netListModule::netMutexTryLock()
        3. void netListModule::netMutexLock()
        4. void netListModule::netMutexUnlock()
      8. class schematic
        1. void schematic::addComponentDock()
        2. void schematic::addMacros()
        3. void schematic::addMouseHelp()
        4. QMenu * schematic::getMenu(string name)
        5. void schematic::guiSetup()
        6. void schematic::guiUpdate()
        7. void schematic::menuAdd(string name,string entries )
        8. void schematic::open(string file)
        9. QToolBar * schematic::toolBarLast()
      9. class schematicDisplay
        1. QColor schematicDisplay::defaultColor
        2. bool schematicDisplay::mutexAddGuiTryLock()
        3. void schematicDisplay::mutexAddUnlock()
        4. bool schematicDisplay::mutexReadTryLock()
        5. bool schematicDisplay::mutexReadGuiTryLock()
        6. void schematicDisplay::mutexReadLock()
        7. void schematicDisplay::mutexReadUnlock()
        8. void schematicDisplay::mutexChangeLock()
        9. bool schematicDisplay::mutexChangeTryLock()
        10. bool schematicDisplay::mutexChangeGuiTryLock()
        11. void schematicDisplay::mutexChangeUnlock()
        12. void schematicDisplay::paint()
        13. bool schematicDisplay::setModifyAdded()
        14. void schematicDisplay::setArcMode()
        15. void schematicDisplay::setBusMode()
        16. void schematicDisplay::setCircleMode()
        17. void schematicDisplay::setEditMode()
        18. void schematicDisplay::setGroundMode()
        19. void schematicDisplay::setLabelNodeMode()
        20. void schematicDisplay::setLineMode()
        21. bool schematicDisplay::setModifyChanged()
        22. bool schematicDisplay::setModifySaved()
        23. void schematicDisplay::setPlaceComponentMode(component *c)
        24. void schematicDisplay::setPolygonMode()
        25. void schematicDisplay::setPortMode()
        26. void schematicDisplay::setRectMode()
        27. void schematicDisplay::setTextMode()
        28. void schematicDisplay::setSheet(const string &s)
        29. void schematicDisplay::setWireMode()
        30. void schematicDisplay::setZoomMode()
      10. class textEdit
        1. void textEdit::addMacros()
        2. QMenu *textEdit::getMenu(string name)
        3. QToolBar * textEdit::toolBarLast()
      11. Signals for class layout
        1. void layout::newCurrentCell(const string &s)
        2. void layout::closed()
        3. void layout::cellsChanged(stringList list,string currentCell )
      12. Signals for class schematic
        1. void schematic::sheetsChanged(stringList list,string currentCell )
        2. void schematic::closed()
      13. Signals for class textEdit
        1. void textEdit::closed()
    3. Additional Classes
      1. class oaInfo
      2. class splash

Getting Started

The LayoutEditor Python module is named pylayout. Script using pylayout can be started from the integrated TextEditor with the execute button without any further setup. To use it a stand alone python script the environment variables PYTHONHOME, PYTHONPATH, PATH and LD_LIBRARY_PATH had to be set correctly. A LayoutEditor full version license key had to be registered inside the normal LayoutEditor before loading the module. The 'layout.py' (layout.pyw) script build a complete LayoutEditor application from python. Review this script is also a good start to learn LayoutEditor for python.

LayoutEditor for Python is shipped with the LayoutEditor in most packages. It is includes in any Linux and Mac package as well as the ZIP packages for Windows. The Windows-installer as well as the Windows XP packages do not include any scripting.

Python Macros

Python macros can be used in the same way as C/C++ macros. The application interface has the same structure. There are only a few python specific differences. One difference is, that python macros must contain the word 'python' in the first line to be recognize as a python macro. A simple python macro would look like this:

   1 #!use python
   2 #name=#1: Python Exsample 1
   3 #help=Helptext for Sample 1
   4 
   5 #adding a box
   6 layout.drawing.point(0,0)
   7 layout.drawing.point(4000,2000)
   8 layout.drawing.box()
   9 
  10 #adding a cell reference
  11 c=layout.drawing.findCell("myCell")
  12 p1=pylayout.point (0,0)
  13 if c!=None:
  14    layout.drawing.currentCell.addCellref(c,p1)
  15 
  16 # full scale of the view
  17 layout.drawing.scaleFull()

This simple example will add a box to the current cell on the active layer.

Notes:

Python macros executed by the LayoutEditor will be run with the exec(..) command from Python. That Python command has limitations in defining own functions or classes. To use own functions and classes in Python macros, the classes/functions had to be defined in a separate file and this file had to be imported in your python application.

Additional Methods

To control data access and adjust the user interface additional features are available. Most important features are the mutex methods. You should always lock a mutex before access any data. Without a concurrent write access can cause unpredictable behaviour or even an segmentation fault of complete application. In details these are the additional methods:

class backgroundModule

void backgroundModule::initDock()

adds the background dock to the available dock, but keep it hidden.

class booleanHAndler

booleanHandler::booleanHandler(drawingField *drawing)

Create a boolean class to perform boolean operations

This feature is only part of the LayoutEditor Python Module.

class drawingField

bool drawingField::mutexAddGuiTryLock()

Simultan access to the design data may be fatal. Some simultan access makes no probelm. To organisize the access a mutex system is used. Each program had to say the mutex before the access to the data in which kind it will used the data. Three type are sepatated. Read, Add and Change. The mutex will answer if this access is ok or not. You also can decide to wait until the dataacces is avaiable. After the use of the data the mutex had to be freed.

if drawing.mutexReadTryLock():
  # your code to read the data
  drawing.mutexReadUnlock()

The methods with 'Gui' will do the same as without it, but show a message the the data is not avaiable.

void drawingField::mutexAddUnlock()

see above

bool drawingField::mutexReadTryLock()

see above

bool drawingField::mutexReadGuiTryLock()

see above

void drawingField::mutexReadLock()

see above

void drawingField::mutexReadUnlock()

see above

void drawingField::mutexChangeLock()

see above

bool drawingField::mutexChangeTryLock()

see above

bool drawingField::mutexChangeGuiTryLock()

see above

void drawingField::mutexChangeUnlock()

see above

bool drawingField::paint()

triggers a repaint of the design

bool drawingField::recountSelect()

triggers a recount of selected elements

void drawingField::setAlignCenterMode()

Activates the align center mode.

void drawingField::setAlignCenterXMode()

Activates the align center x mode.

void drawingField::setAlignCenterYMode()

Activates the align center y mode.

void drawingField::setAlignBottomMode()

Activates the align bottom mode.

void drawingField::setAlignLeftMode()

Activates the align left mode.

void drawingField::setAlignRightMode()

Activates the align right mode.

void drawingField::setAlignTopMode()

Activates the align top mode.

void drawingField::setAlignValueMode()

Activates the align value mode.

void drawingField::setAngleMode()

Activates the angle mode.

void drawingField::setArcMode()

Activates the arc mode.

void drawingField::setBezier2Mode()

Activates the bezier2 mode.

void drawingField::setBezier3Mode()

Activates the bezier3 mode.

void drawingField::setBoxMode()

Activates the box mode.

void drawingField::setCdeselectMode()

Activates the cdeselect mode.

void drawingField::setCellOriginMode()

Activates the cell origin mode.

void drawingField::setCellrefMode()

Activates the cellref mode.

void drawingField::setCellrefArrayMode()

Activates the cellref array mode.

void drawingField::setCenterMode()

Activates the center mode.

void drawingField::setCenterXMode()

Activates the center x mode.

void drawingField::setCenterYMode()

Activates the center y mode.

void drawingField::setCircleMode()

Activates the circle mode.

void drawingField::setCircleBoxMode()

Activates the circle box mode.

void drawingField::setCircleFitMode()

Activates the circle fit mode.

void drawingField::setCommandMode()

Activates the command mode.

void drawingField::setCopyMode()

Activates the copy mode.

void drawingField::setCrossMode()

Activates the CrossSectionMode.

void drawingField::setCselectMode()

Activates the cselect mode.

void drawingField::setCutMode()

Activates the cut mode.

void drawingField::setElementSizeMode()

Activates the element size mode.

void drawingField::setFdeselectMode()

Activates the fdeselect mode.

void drawingField::setFselectMode()

Activates the fselect mode.

void drawingField::setInsertPointMode()

Activates the insert point mode.

void drawingField::setLengthMode()

Activates the length mode.

void drawingField::setLengthElementMode()

Activates the length element mode.

void drawingField::setMirrorMode()

Activates the mirror mode.

void drawingField::setModifyAdded()

marks the design shapes to be added

void drawingField::setModifyChanged()

marks the design to be modified

void drawingField::setModifySaved()

marks the design not to be modified

void drawingField::setMoveEdgeMode()

Activate the move edge mod2

void drawingField::setMoveMode()

Activates the move mode.

void drawingField::setMovePointMode()

Activates the move point mode.

void drawingField::setMoveXMode()

Activates the move x mode.

void drawingField::setMoveYMode()

Activates the move y mode.

void drawingField::setNodeMode()

Activates the node mode.

void drawingField::setPathMode()

Activates the path mode.

void drawingField::setPdeselectMode()

Activates the pdeselect mode.

void drawingField::setPolygonMode()

Activates the polygon mode.

void drawingField::setPolygonArcMode()

Activates the polygon arc mode.

void drawingField::setPropertiesMode()

Activates the properties mode.

void drawingField::setPselectMode()

Activates the pselect mode.

void drawingField::setRotateMode()

Activates the rotate mode.

void drawingField::setRulerMode()

Activates the ruler mode.

void drawingField::setSectorMode()

Activates the sector mode.

void drawingField::setSelectCellMode()

Activates the selct cell mode.

void drawingField::setSpiralMode()

Activates the spiral mode.

void drawingField::setTextMode()

Activates the text mode.

bool drawingField::setZoomMode()

Activates the zoom mode.

bool drawingField::showDevice(string device)

Shows the device device

bool drawingField::showDeviceNode(string device,int i)

Shows the node i on the device device

bool drawingField::showNode(int i)

shows the node i

class drc

void drc::initDock()

adds the drc dock to the available dock, but keep it hidden.

class extracntionModule

void extractionModule::initDock()

adds the extraction dock to the available dock, but keep it hidden.

class layout

void layout::addCommandLineDock()

Add a c/cpp commandline macro dock and make it invisible.

void layout::addLayerDock()

Add a layer dock to the window and adds it to the left dock. Add a layer menu to the main menu.

void layout::addMacros()

Macro in the macro folder will be added to the menu.

void layout::addMouseHelp()

Add a mouse help dock to the window and adds it to the left dock.

void layout::add3dDock()

A 3d view windows is added.

QMenu * layout::getMenu(string name)

Returns a point to the menu with the name. If the menu does not exist it will be created. To get submenus use 'mainentry/submenu' as name.

void layout::guiSetupBasic()

Will perform a basic menu and tool bar setup of the layout window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.

void layout::guiSetupFull()

Will perform a full menu and tool bar setup of the layout window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.

void layout::guiSetupReduced()

Will perform a reduced menu and tool bar setup of the layout window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.

void layout::guiSetupViewer()

Will perform a viewer menu and tool bar setup of the layout window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.

void layout::guiUpdate()

The user interface is updated. It updates the setup of the layerbuttons, the list of existing cell ,.. Call this function after you have changed the design in a script. The c/c++ macro interface call the function automatic after the execution of a macro.

void layout::menuAdd(string name,string entries )

Add a new entry to the main menu. The first parameter is the name of the menu. The second parameter contains last entries of the new menu seperated with a semicolon.

QToolBar * layout::toolBarLast()

Returns: a pointer to the last created toolBar

class netListModule

void netListModule::initDock()

adds the netlist dock to the available dock, but keep it hidden.

bool netListModule::netMutexTryLock()

a mutex used for the access to the netlist. Return true if it can be locked.

void netListModule::netMutexLock()

The mutex used for the access to the netlist will be unlocked.

void netListModule::netMutexUnlock()

The mutex used for the access to the netlist will be unlocked.

class schematic

void schematic::addComponentDock()

A dock for choosing and editing components is added

void schematic::addMacros()

Macro in the macro folder will be added to the menu.

void schematic::addMouseHelp()

Add a mouse help dock to the window and adds it to the left dock.

QMenu * schematic::getMenu(string name)

Returns a pointer to the menu with the name. If the menu does not exist it will be created. To get submenus use 'mainentry/submenu' as name.

void schematic::guiSetup()

Will perform a std. menu and tool bar setup of the schematic window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.

void schematic::guiUpdate()

The user interface is updated. It updates the setup of the layerbuttons, the list of existing cell ,.. Call this function after you have changed the design in a script. The c/c++ macro interface call the function automatic after the execution of a macro.

void schematic::menuAdd(string name,string entries )

Add a new entry to the main menu. The first parameter is the name of the menu. The second parameter contains last entries of the new menu seperated with a semicolon.

void schematic::open(string file)

opens the named file and adds its contents to the existing sheet collection.

QToolBar * schematic::toolBarLast()

Returns: a pointer to the last created toolBar

class schematicDisplay

QColor schematicDisplay::defaultColor

color used for any new graphical element.

bool schematicDisplay::mutexAddGuiTryLock()

Simultan access to the design data may be fatal. Some simultan access makes no probelm. To organisize the access a mutex system is used. Each program had to say the mutex before the access to the data in which kind it will used the data. Three type are sepatated. Read, Add and Change. The mutex will answer if this access is ok or not. You also can decide to wait until the dataacces is avaiable. After the use of the data the mutex had to be freed.

if drawing.mutexReadTryLock():
  # your code to read the data
  drawing.mutexReadUnlock()

The methods with 'Gui' will do the same as without it, but show a message the the data is not aviaable.

void schematicDisplay::mutexAddUnlock()

see above

bool schematicDisplay::mutexReadTryLock()

see above

bool schematicDisplay::mutexReadGuiTryLock()

see above

void schematicDisplay::mutexReadLock()

see above

void schematicDisplay::mutexReadUnlock()

see above

void schematicDisplay::mutexChangeLock()

see above

bool schematicDisplay::mutexChangeTryLock()

see above

bool schematicDisplay::mutexChangeGuiTryLock()

see above

void schematicDisplay::mutexChangeUnlock()

see above

void schematicDisplay::paint()

triggers a repaint of the design

bool schematicDisplay::setModifyAdded()

marks the design shapes to be added

void schematicDisplay::setArcMode()

Activates the arc mode.

void schematicDisplay::setBusMode()

Activates the bus mode.

void schematicDisplay::setCircleMode()

Activates the circle mode.

void schematicDisplay::setEditMode()

Activates the edit mode.

void schematicDisplay::setGroundMode()

Activates the ground mode.

void schematicDisplay::setLabelNodeMode()

Activates the label node mode.

void schematicDisplay::setLineMode()

Activates the line mode.

bool schematicDisplay::setModifyChanged()

marks the design to be modified

bool schematicDisplay::setModifySaved()

marks the design not to be modified

void schematicDisplay::setPlaceComponentMode(component *c)

Activates the edit mode.

void schematicDisplay::setPolygonMode()

Activates the polygon mode.

void schematicDisplay::setPortMode()

Activates the port mode.

void schematicDisplay::setRectMode()

Activates the rect mode.

void schematicDisplay::setTextMode()

Activates the text mode.

void schematicDisplay::setSheet(const string &s)

sets s as the current displayed sheet

void schematicDisplay::setWireMode()

Activates the wire mode.

void schematicDisplay::setZoomMode()

Activates the zoom mode.

class textEdit

void textEdit::addMacros()

Macros in the macro folder will be added to the menu.

QMenu *textEdit::getMenu(string name)

Returns a point to the menu with the name. If the menu does not exist it will be created. To get submenus use 'mainentry/submenu' as name.

QToolBar * textEdit::toolBarLast()

Returns: a pointer to the last created toolBar

Signals for class layout

void layout::newCurrentCell(const string &s)

This signal is emitted when the current displayed cell has changed.

void layout::closed()

This signal is emitted when the window is closed and destroyed

void layout::cellsChanged(stringList list,string currentCell )

This signal is emitted when cells has been added or deleted.

Signals for class schematic

void schematic::sheetsChanged(stringList list,string currentCell )

This signal is emitted when sheetss has been added or deleted.

void schematic::closed()

This signal is emitted when the window is closed and destroyed

Signals for class textEdit

void textEdit::closed()

This signal is emitted when the window is closed and destroyed

Additional Classes

class oaInfo

The oaInfo class with information on OpenAccess libraies.

class splash

The splash class supplier a splash window of LayoutEditor based applications.


LayoutEditorPython (last edited 2017-04-01 14:34:39 by JurgenThies)