Python module for creating GDSII stream files, usually CAD layouts.
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
Gdspy is a Python module for creation and manipulation of GDSII stream files. Key features for the creation of complex CAD layouts are included:
Gdspy also includes a simple layout viewer.
Typical applications of Gdspy are in the fields of electronic chip design, planar lightwave circuit design, and mechanical engineering.
In trying to improve the performance of Gdspy for large layouts, we ended up concluding that the best way to reach our goal was to rewrite the critical parts of the library as a C extension. It turns out that beside obvious functions, method calling has a big impact in performance due to the overhead it introduces. The best solution was to re-design the whole project as a C++ library with a thin Python wrapper: thus was born Gdstk, the GDSII Tool Kit.
Therefore, version 1.6 will be the last major release of Gdspy, with development focused only on bug fixes. Users are encouraged to move from Gdspy to Gdstk: although their API is not 100% compatible, the new module should be familiar enough to allow a quick transition.
Option 1: using pip:
pip install gdspy
Option 2: download the source from github and build/install with:
python setup.py install
The preferred option is to install pre-compiled binaries from here.
pipand building from source as above are also possible, but an appropriate build environment is required for compilation of the C extension modules.
The complete documentation is available here.
The source files can be found in the
Help support Gdspy development by donating via PayPal
_bounding_boxes. Only cells cache their bounding boxes.
Cell.copywhere the whole dependency tree would be copied on a deep copy creation.
GdsLibrary.extract(thanks collineps for finding the problem).
Cell.write_svgfunction to export an SVG image of the cell.
GdsLibrary.new_cellfunction to quickly create and add cells to a library.
GdsLibrary.addcan update references when a cell is overwritten.
GdsLibrary.removeto allow cells to be properly removed from libraries.
GdsLibrary.rename_cellto rename cells in libraries.
GdsLibrary.replace_referencesto easily replace referenced cells in libraries.
GdsLibrary.addcan add dependencies recursively.
GdsLibraryobjects yields all its cells.
Cellobjects yield all its polygons, paths, labels and references.
*.to_gdsfunctions in order to improve write efficiency (this should not be a problem for most users, since
Cell.write_gdsremain the same).
RobustPathclasses: more efficient path generation when using the original GDSII path specification.
Curveclass: SVG-like polygon creation.
PolygonSet.mirror(thanks to Daan Waardenburg for the contribution).
Path.bezierto create paths based on Bézier curves.
Path.smoothto create paths based on smooth interpolating curves.
get_gds_unitsto get units used in a GDSII file without loading.
get_binary_cellsto load only the binary GDSII representation of cell from a file.
Path.parametricto automatically control the number of points in the final polygons.
binary_cellsto GDSII writing functions to support
GdsLibrary.read_gdsfor flexible cell renaming (thanks to @yoshi74ls181 for the contribution).
sliceto avoid creating empty
timestampto GDSII writing functions.
Roundto support creating ellipses.
Labelnow raises an error, instead of emitting a warning.
PolygonSet.filleton a per-vertex basis.
PolygonSetbecomes the base class for all polygons, in particular
Cell.remove_labelsfunctions to allow filtering a cell contents based, for example, on each element's layer.
GdsLibraryinitialization and removed from its
sliceto avoid errors when slicing in multiple positions at once.
PolygonSet.fractureto reduce number of function calls.
GdsLibrarycan be created directly from a GDSII file
GdsLibraryto allow user to work with multiple library simultaneously.
GdsImportin favor of
insidefunction sometimes reversing the order of the output.
deep_copybeing inverted in
Polygon.fillet(thanks to Adam McCaughan for the contribution).
insidefucntion to perform point-in-polygon tests (thanks to @okianus for the contribution).
translatemethod to geometric entities (thanks John Bell for the commit).
fast_booleanfunction based on the Clipper library with much better performance than the old
offsetsignature to also use the Clipper library (this change breaks compatibility with previous versions).
GdsPrintclass for incremental GDSII creation (thanks to Jack Sankey for the contribution).
Path.turnchanged to resolution of 0.01 drawing units.
final_widthfor non-linear tapering.
Pathcurve has width larger than twice its radius (self-intersecting polygon).
LayoutViewershows cell labels for referenced cells.
get_polygonsreturns (referenced) cell name if
depth< 1 and
get_bounding_boxwhen empty cells are referenced.
GdsImportand many speed improvements in bounding box calculations (thanks to Gene Hilton for the patch).
LayoutViewerimprovements (not backwards compatible).
by_spec(not backwards compatible).
gds_imageand dropped the optional PIL dependency.
Path.segmentallowing creation of asymmetric tapers.
CellArray.get_bounding_box(thanks to George McLean for the fix)
Nonefor empty cells.
booleanfunction via caching.
LayoutViewernow reflect the colors of the outlines and canvas backgroung.
LayoutVieweris now respected in the GUI.
boolean. It is fixed at 1e-13 for merging close points, otherwise machine precision is used.
gds_imagenow accepts cell names as input.
hidden_layersand behavior changed accordingly.
LayoutVIewerhides/unhides all other layers.
gds_printalso accepts file name as input.
Cell.cell_listis now a dictionary indexed by name, instead of a list.
CellArrayaccept name of cells as input.
boolean, which affected the way polygons with more vertices then the maximum were fractured.
gds_imageaccepts an extra color argument for the image background.
LayoutViewerhave the same background color as the viewer.
slicenow also accept
PolygonSetto automatically slice polygons into parts with a predefined maximal number of vertices.
PolygonSetto round corners of polygons.
ValueErroris raised if cell names are duplicated.
gds_imageaccepts cells, instead of lists.
LayoutViewerstores bounding box information for all visited layers to save rendering time.
gds_viewfunction, superseded by the LayoutViewer, along with all dependencies to matplotlib.
booleanwhich affected polygons with series of collinear vertices.
slicepolygons along straight lines parallel to an axis.
PolygonSetis the new base class for
Round, which might bring some incompatibility issues with older scripts.
parametricsections are now automatically fractured into pieces defined by a maximal number of points.
max_pointsin boolean changed to 199.
parametricpaths to change their distance to each other.
PolyPathclass to easily create paths with sharp corners.
Noneas item in the colors parameter of
LayoutViewerto make layers invisible.
LayoutViewer(change outline color with the shift key pressed)
LayoutViewerto standard arrow.
LayoutViewer(mouse wheel and ruler tool).
gds_imagedisplays an error message instead of crashing when
PILis not found.
LayoutViewer, which uses Tkinter (included in all Python distributions) to display the GDSII layout with better controls then the
gds_viewfunction. This eliminates the
matplotlibrequirement for the viewer functionality.
booleanfunction that would give an error when not using
PolygonSetas input objects.
Cellto remove references (or array references) to other cells.
booleanoutput polygons based on the number of vertices to respect the 199 GDSII limit.
L1Pathclass for Manhattan geometry (L1 norm) paths.
gds_viewand added a more flexible one:
booleanoperator affecting polygons with holes.
PolygonSethas more than 199 points
Path, which is easier to use than
Pathto keep the information used by the
Textdoes not have a default value any longer.
formatin the function
gds_viewwas changed to
fill(to avoid confusion with the built-in function
gds_viewto avoid the automatic call to
gds_view, if a layer number is greater than the number of formats defined, the formats are cycled.
Textre-written with a different font with no overlaps and correct size.
gds_viewfunction to display the GDSII structure using the matplotlib module.
cell_listto class Cell to hold a list of all Cell created.
cells=Cell.cell_listin the function