palaniappan-r's picture
Add html datasources
703f5e6 verified
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!-- Meta -->
<meta name="Description" content="KLayout layout viewer and editor project page" />
<meta name="Keywords" content="KLayout OASIS GDS2 viewer editor layout semiconductor mask chip design" />
<meta name="abstract" content="KLayout is a free layout viewer and editor for several formats commonly used in the semiconductor industry to transfer layout data" />
<meta name="URL" content="https://www.klayout.de/" />
<meta name="Author" content="Matthias Koefferlein" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>KLayout Layout Viewer And Editor</title>
<!-- General -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.klayout.de/news.xml"/>
<link rel="stylesheet" type="text/css" href="https://www.klayout.de/format.css?v2.0"/>
<link rel="shortcut icon" href="https://www.klayout.de/favicon.ico"/>
<!-- Fonts -->
<link rel="stylesheet" type="text/css" href="https://www.klayout.de/fonts.css"/>
<!-- jQuery -->
<script src="https://www.klayout.de/jquery-3.4.1.min.js"></script>
<!-- bootstrap -->
<link href="https://www.klayout.de/bootstrap-4.3.1-dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://www.klayout.de/bootstrap-4.3.1-dist/js/bootstrap.min.js"></script>
</head>
<body>
<div class="klayout-header">
<div class="container mb-5">
<nav class="navbar navbar-dark navbar-expand-lg">
<a class="navbar-brand" href="https://www.klayout.de"><img src="https://www.klayout.de/klayout.png" srcset="https://www.klayout.de/klayout-x2.png 2x" alt="KLayout"></a>
<div class="collapse navbar-collapse" id="navbarToggleExternalContent">
<ul class="navbar-nav ml-auto mr-auto">
<li class="nav-item dropdown active mr-4">
<a class="nav-link dropdown-toggle klayout-menu" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
About
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="https://www.klayout.de/intro.html">KLayout Project</a>
<a class="dropdown-item" href="https://www.klayout.de/doc.html">Documentation</a>
<a class="dropdown-item" href="https://www.klayout.de/galleries.html">Galleries</a>
<a class="dropdown-item" href="https://www.klayout.de/credits.html">Credits</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://www.klayout.de/contact.html">Contact</a>
<a class="dropdown-item" href="https://www.klayout.de/impressum.html">Impressum / Imprint</a>
<a class="dropdown-item" href="https://www.klayout.de/privacy_policy.html">Datenschutz / Privacy Policy</a>
</div>
</li>
<li class="nav-item active mr-4">
<a class="nav-link klayout-menu" href="https://www.klayout.de/build.html">Get KLayout</a>
</li>
<li class="nav-item active mr-4">
<a class="nav-link klayout-menu" href="https://sami.klayout.org">Package Index</a>
</li>
<li class="nav-item active mr-5">
<a class="nav-link klayout-menu" href="https://www.klayout.de/forum">Forum</a>
</li>
<li class="nav-item active">
<span class="nav-link klayout-menu">
<a href="https://f-si.org"><img src="https://www.klayout.de/f-si_logo_32h_w.png" border="0" title="Free Silicon Foundation" alt="F-Si"/></a>
<a class="ml-4" href="https://github.com/KLayout"><img src="https://www.klayout.de/GitHub-Mark-32px-white.png" border="0" title="KLayout on GitHub" alt="GitHub"/></a>
</span>
</li>
</ul>
</div>
<!-- collapse button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
</div>
</div>
<div class="container">
<h1>Useful Ruby Modules</h1>
<p>
This is a collection of useful ruby modules. These scripts may also serve as a starting point for custom developments.
<b>Please also check these resources:</b>
</p>
<ul>
<li>Additional packages for installation in KLayout's package manager (Tool/Package Manager)</li>
<li>My projects on GitHub: <a href="https://github.com/klayoutmatthias">https://github.com/klayoutmatthias</a>.</li>
</ul>
<p>
All .lym macros are installed by one of these ways:
</p>
<ul>
<li>By copying the files into the local macro installation folder. For the location of the folder open
the macro development environment (Tools/Macro Development) and point with the mouse over the "Local"
folder.<p/>
The "Import" function from the macro tree's context menu will do exactly that if you select the
"Local" branch and choose "Import" from the context menu (right mouse click).</p>
On Linux, the local
macro installation folder is "~/.klayout/macros", on Windows it often is "%HOME%\KLayout\macros".
This is the preferred way to install macros for the current user only.</li>
<li>Or: By copying the file to the "macros" folder in installation path of KLayout. If this folder does not exist yet, create it.
The installatio path is the folder where the klayout.exe or klayout binary is located.
This usually is "C:/Program Files/KLayout" on Windows or some path like "/usr/bin/klayout" on Linux.
This is the way to globally install a macro.</li>
<li>Or: by copying the file to an arbitrary folder and setting $KLAYOUT_PATH to this path.</li>
</ul>
<p>These scripts are made available here:</p>
<ul>
<li><a href="#scale_anisotropic.lym">Anisotropic scaling</a></li>
<li><a href="#array_of_labels.lym">Create arrays of labels</a></li>
<li><a href="#calc_area.lym">Compute the total area of all selected shapes</a></li>
<li><a href="#calc_area_hier.lym">Compute the total area of all selected layers (hierarchical)</a></li>
<li><a href="#search_odd_width_paths.lym">Search for odd-width paths</a></li>
<li><a href="#replace_cells.lym">Replace cells with others from another file</a></li>
<li><a href="#write_childcells.lym">Write all child cells of the current cell to new files</a></li>
<li><a href="#dump_flat_shapes.lym">Dump all shapes of the current cell recursively to a XML file</a></li>
<li><a href="#list_layers.lym">List all layers under a ruler</a></li>
<li><a href="#rename_cells.lym">Rename all cells</a></li>
<li><a href="#cell_bbox.lym">Compute the bounding box of a cell</a></li>
<li><a href="#screenshot.lym">Screenshot with options</a></li>
</ul>
<h2><a name="scale_anisotropic.lym"></a>Anisotropic scaling</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/scale_anisotropic.lym">scale_anisotropic.lym</a></p>
<p>
This script installs a new menu entry in the "Edit" menu in the "Selection" submenu called "Anisotropic Scaling" before the "Scale" entry.
It asks for two scaling factors for x and y (separated by comma) and applies a different scaling in both directions on the selected
shapes. This is a simple
implementation which does not check for rounding issues (gaps) and does not support scaling of instances. Paths are converted to polygons because
in the general case a constant width cannot be maintained.
</p>
<h2><a name="array_of_labels.lym"></a>Array of Labels</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/array_of_labels.lym">array_of_labels.lym</a></p>
<p>
This script will install a new entry in the "Macros" menu called "Create array of labels for manifold pins".
On running it, a dialog will be shown where you can enter the parameters of your label array.
Each label is given an individual number which can be embedded in the label string.
</p>
<p>
The parameters are:
</p>
<ul>
<li>start position: the point of the first label</li>
<li>distance vector: the distance (x,y) between the labels</li>
<li>start number: the number of the first label</li>
<li>end number: the number of the last label (start number can be larger than end number to get a reverse sequence)</li>
<li>format: the label text format (use sprintf notation to embed the number, e.g. "text&lt;%d&gt;")</li>
<li>size: the size of the label in µm units</li>
<li>orientation: check this box to get vertical labels</li>
<li>layer: the layer where to put the labels</li>
</ul>
<p>Upon "Ok", the label sequence will be generated. Undo/redo is available.</p>
<h2><a name="calc_area.lym"></a>Compute the total area of all selected shapes</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/calc_area.lym">calc_area.lym</a></p>
<p>
This script installs a new menu entry in the "Tools" menu called "Compute total area
of selected shapes". It sums up the area of all shapes selected. <b>Caution: this is a simple
sum of areas. Areas where the shapes overlap are counted twice.</b>
</p>
<h2><a name="calc_area_hier.lym"></a>Compute the total area of all selected layers (hierarchical)</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/calc_area_hier.lym">calc_area_hier.lym</a></p>
<p>
This script installs a new menu entry in the "Tools" menu called "Compute layer area".
It computes the total area of all layers selected. <b>Caution: this is a simple
sum of shape areas, weighted with the cell's instant counts. Areas where the shapes overlap are counted twice.</b>
</p>
<h2><a name="search_odd_width_paths.lym"></a>Search for odd-width paths</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/search_odd_width_paths.lym">search_odd_width_paths.lym</a></p>
<p>
This script installs a menu entry in the "Tools" menu called "Find Paths With Odd Width". It will find
all paths with an odd width in database units in the current layout and report them.
Such paths cannot be saved to OASIS, hence it's important to remove them before a layout
can be written to OASIS.
</p>
<h2><a name="replace_cells.lym"></a>Replace cells with others from another file</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/replace_cells.lym">replace_cells.lym</a></p>
<p>
The script installs a new menu entry at the end of the cell list context
menu: "Replace Cells With Others". This function asks for a file containing
a couple of other (top) cells, even with their own hierarchy. It will copy
these cells into the existing layout and replace the corresponding cells in
the current layout with the ones from the replacement library.
</p>
<p>
Hint: the script requires the database unit of the replacement and original
file to be identical.
</p>
<h2><a name="write_childcells.lym"></a>Write all child cells of the current cell to new files</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/write_childcells.lym">write_childcells.lym</a></p>
<p>
The script installs a new menu entry at the end of the cell list context
menu: "Write Child Cells". This function asks for the hierarchy level and
writes all cells at this level (below the current cell) to files called
"{cellname}.gds".
</p>
<h2><a name="dump_flat_shapes.lym"></a>Dump all shapes of the current cell recursively to a XML file</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/dump_flat_shapes.lym">dump_flat_shapes.lym</a></p>
<p>
This script installs a menu entry in the "Tools" menu called "Dump Flat Shapes". It asks for
a file name and writes a flat dump of the current cell to this file. This dump contains all
shapes of the cell and their chip cells projected into the top cell.
</p>
<p>
The format of the dump file is XML with that layout:
</p>
<pre>
&lt;shape_dump cell="{cell name}" dbu="{database unit}"&gt;
&lt;layer source="{layer}"&gt;
.. shapes on that layer using these XML elements: ..
&lt;box&gt;{box description}&lt;/box&gt;
&lt;path&gt;{path description}&lt;/path&gt;
&lt;polygon&gt;{polygon description}&lt;/polygon&gt;
&lt;text&gt;{text description}&lt;/text&gt;
.. more shapes ..
&lt;/layer&gt;
.. more layers ..
&lt;/shape_dump&gt;
</pre>
<h2><a name="list_layers.lym"></a>List all layers under a ruler</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/list_layers.lym">list_layers.lym</a></p>
<p>
This script will install a new entry in the "Tools" menu called "List Layers". Before this
function can be used, a single ruler must be drawn. The script looks for
shapes that are crossed by this ruler and reports the layers of those shapes. The script can operate
on multiple layouts as well.
</p>
<h2><a name="rename_cells.lym"></a>Rename all cells</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/rename_cells.lym">rename_cells.lym</a></p>
<p>
This script will install a new entry in the "Tools" menu called "Rename Cells".
It will ask for a rename expression and rename all cells of the current layout. In the expression, "*" is
a placeholder for the current cell name and "#" a placeholder for the cell index. Hence it is possible
for example to add an "A" prefix by using an expression of "A*". Also it's possible to remove all
traces of macro names by using "CELL#" as the expression.
</p>
<h2><a name="cell_bbox.lym"></a>Compute the bounding box of a cell</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/cell_bbox.lym">cell_bbox.lym</a></p>
<p>
This script will install a new entry in the "Tools" menu called "Cell Bounding Box".
It will compute and output the bounding box over all layers of the current cell (the one that is
shown in the layout view and which is in the active cell tree).
The ouput will include the corner coordinates as well as width and height.
</p>
<h2><a name="screenshot.lym"></a>Take a screenshot with options</h2>
<p>Download link: <a href="https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/screenshot.lym">screenshot.lym</a></p>
<p>
This macro will provide a screenshot function with a dialog to enter the pixel dimensions.
This script will install a new entry in the "File" menu called "Screenshot With Options".
</p>
</div>
</body>
</html>