gdspy is a Python module that allows the creation of GDSII stream files.
Many features of the GDSII format are implemented, such as cell references and arrays, but the support for fonts is quite limited. Text is only available through polygonal objects.
If the Python Imaging Library is installed, it can be used to output the geometry created to an image file.
Collection of elements, both geometric objects and references to other cells.
Parameters
Add a new element or list of elements to this cell.
Parameters
Returns
Calculate the total area of the elements on this cell, including cell references and arrays.
Parameters
Returns
Dictionary containing all cells created, indexed by name. This dictionary is updated automatically whenever a new Cell object is created without the exclude_from_global flag.
Creates a copy of this cell.
Parameters
Returns
Flatten all CellReference and CellArray elements in this cell into real polygons, instead of references.
Parameters
Returns
Returns the bounding box for this cell.
Returns
Returns a list of the cells included in this cell as references.
Returns
Returns a list of layers in this cell.
Returns
Returns a list of polygons in this cell.
Parameters
Returns
Convert this cell to a GDSII structure.
Parameters
Returns
Simple reference to an existing cell.
Parameters
Calculate the total area of the referenced cell with the magnification factor included.
Parameters
Returns
Returns a list of polygons created by this reference.
Parameters
Returns
Convert this object to a GDSII element.
Parameters
Returns
Multiple references to an existing cell in an array format.
Parameters
Calculate the total area of the cell array with the magnification factor included.
Parameters
Returns
Returns a list of polygons created by this reference.
Parameters
Returns
Convert this object to a GDSII element.
Parameters
Returns
Polygonal geometric object.
Parameters
Notes
The last point should not be equal to the first (polygons are automatically closed).
The GDSII specification supports only a maximum of 199 vertices per polygon.
Examples
>>> triangle_pts = [(0, 40), (15, 40), (10, 50)]
>>> triangle = gdspy.Polygon(1, triangle_pts)
>>> myCell.add(triangle)
Calculate the total area of this object.
Parameters
Returns
Round the corners of this polygon and fractures it into polygons with less vertices if necessary.
Parameters
Returns
Slice this polygon in the horizontal and vertical directions so that each resulting piece has at most max_points.
Parameters
Returns
Rotate this object.
Parameters
Returns
Convert this object to a GDSII element.
Parameters
Returns
Bases: gdspy.Polygon
Rectangular geometric object.
Parameters
Examples
>>> rectangle = gdspy.Rectangle(1, (0, 0), (10, 20))
>>> myCell.add(rectangle)
Calculate the total area of this object.
Parameters
Returns
Round the corners of this polygon and fractures it into polygons with less vertices if necessary.
Parameters
Returns
Slice this polygon in the horizontal and vertical directions so that each resulting piece has at most max_points.
Parameters
Returns
Rotate this object.
Parameters
Returns
Convert this object to a GDSII element.
Parameters
Returns
Bases: gdspy.PolygonSet
Circular geometric object. Represent a circle, a circular section, a ring or a ring section.
Parameters
Notes
The GDSII specification supports only a maximum of 199 vertices per polygon.
Examples
>>> circle = gdspy.Round(2, (30, 5), 8)
>>> ring = gdspy.Round(2, (50, 5), 8, inner_radius=5)
>>> pie_slice = gdspy.Round(2, (30, 25), 8, initial_angle=0,
... final_angle=-5.0*numpy.pi/6.0)
>>> arc = gdspy.Round(2, (50, 25), 8, inner_radius=5,
... initial_angle=-5.0*numpy.pi/6.0,
... final_angle=0)
Calculate the total area of the path(s).
Parameters
Returns
Round the corners of these polygons and fractures them into polygons with less vertices if necessary.
Parameters
Returns
Slice these polygons in the horizontal and vertical directions so that each resulting piece has at most max_points. This opertaion occur in place.
Parameters
Returns
Rotate this object.
Parameters
Returns
Convert this object to a series of GDSII elements.
Parameters
Returns
Set of polygonal objects.
Parameters
Notes
The last point should not be equal to the first (polygons are automatically closed).
The GDSII specification supports only a maximum of 199 vertices per polygon.
Calculate the total area of the path(s).
Parameters
Returns
Round the corners of these polygons and fractures them into polygons with less vertices if necessary.
Parameters
Returns
Slice these polygons in the horizontal and vertical directions so that each resulting piece has at most max_points. This opertaion occur in place.
Parameters
Returns
Rotate this object.
Parameters
Returns
Convert this object to a series of GDSII elements.
Parameters
Returns
Bases: gdspy.PolygonSet
Series of geometric objects that form a path or a collection of parallel paths.
Parameters
Attributes
Add a curved section to the path.
Parameters
Returns
Notes
The GDSII specification supports only a maximum of 199 vertices per polygon.
Calculate the total area of the path(s).
Parameters
Returns
Round the corners of these polygons and fractures them into polygons with less vertices if necessary.
Parameters
Returns
Slice these polygons in the horizontal and vertical directions so that each resulting piece has at most max_points. This opertaion occur in place.
Parameters
Returns
Add a parametric curve to the path.
Parameters
Returns
Notes
The norm of the vector returned by curve_derivative is not important. Only the direction is used.
The GDSII specification supports only a maximum of 199 vertices per polygon.
Examples
>>> def my_parametric_curve(t):
... return (2**t, t**2)
>>> def my_parametric_curve_derivative(t):
... return (0.69315 * 2**t, 2 * t)
>>> my_path.parametric(1, my_parametric_curve,
... my_parametric_curve_derivative)
Rotate this object.
Parameters
Returns
Add a straight section to the path.
Parameters
Returns
Convert this object to a series of GDSII elements.
Parameters
Returns
Add a curved section to the path.
Parameters
Returns
Notes
The GDSII specification supports only a maximum of 199 vertices per polygon.
Bases: gdspy.PolygonSet
Series of geometric objects that form a polygonal path or a collection of parallel polygonal paths.
Parameters
Returns
Notes
The bevel joint will give strange results if the number of paths is greater than 1.
Calculate the total area of the path(s).
Parameters
Returns
Round the corners of these polygons and fractures them into polygons with less vertices if necessary.
Parameters
Returns
Slice these polygons in the horizontal and vertical directions so that each resulting piece has at most max_points. This opertaion occur in place.
Parameters
Returns
Rotate this object.
Parameters
Returns
Convert this object to a series of GDSII elements.
Parameters
Returns
Bases: gdspy.PolygonSet
Series of geometric objects that form a path or a collection of parallel paths with Manhattan geometry.
Parameters
Returns
Attributes
Examples
>>> length = [10, 30, 15, 15, 15, 15, 10]
>>> turn = [1, -1, -1, 3, -1, 1]
>>> l1path = gdspy.L1Path(5, (0, 0), '+x', 2, length, turn)
>>> myCell.add(l1path)
Calculate the total area of the path(s).
Parameters
Returns
Round the corners of these polygons and fractures them into polygons with less vertices if necessary.
Parameters
Returns
Slice these polygons in the horizontal and vertical directions so that each resulting piece has at most max_points. This opertaion occur in place.
Parameters
Returns
Rotate this object.
Parameters
Returns
Convert this object to a series of GDSII elements.
Parameters
Returns
Bases: gdspy.PolygonSet
Polygonal text object.
Each letter is formed by a series of polygons.
Parameters
Examples
>>> text = gdspy.Text(8, 'Sample text', 20, (-10, -100))
>>> myCell.add(text)
Calculate the total area of the path(s).
Parameters
Returns
Round the corners of these polygons and fractures them into polygons with less vertices if necessary.
Parameters
Returns
Slice these polygons in the horizontal and vertical directions so that each resulting piece has at most max_points. This opertaion occur in place.
Parameters
Returns
Rotate this object.
Parameters
Returns
Convert this object to a series of GDSII elements.
Parameters
Returns
Execute any boolean operation on polygons and polygon sets.
Parameters
Returns
Notes
Since operation receives a list of integers as input, it can be somewhat more general than boolean operations only. See the examples below.
Examples
>>> circle = gdspy.Round(0, (0, 0), 10)
>>> triangle = gdspy.Round(0, (0, 0), 12, number_of_points=3)
>>> bad_poly = gdspy.L1Path(1, (0, 0), '+y', 2,
[6, 4, 4, 8, 4, 5, 10], [-1, -1, -1, 1, 1, 1])
>>> union = gdspy.boolean(1, [circle, triangle],
lambda cir, tri: cir or tri)
>>> intersection = gdspy.boolean(1, [circle, triangle],
lambda cir, tri: cir and tri)
>>> subtraction = gdspy.boolean(1, [circle, triangle],
lambda cir, tri: cir and not tri)
>>> multi_xor = gdspy.boolean(1, [badPath], lambda p: p % 2)
Slice polygons and polygon sets at given positions along an axis.
Parameters
Returns
Examples
>>> ring = gdspy.Round(1, (0, 0), 10, inner_radius = 5)
>>> result = gdspy.slice(1, ring, [-7, 7], 0)
>>> cell.add(result[1])