laygo2.interface.gdspy module#
This module implements interfaces with gds files via gdspy.
- laygo2.interface.gdspy.export(db, filename, cellname=None, scale=1e-09, layermapfile='default.layermap', physical_unit=1e-09, logical_unit=0.001, pin_label_height=0.1, svg_filename=None, png_filename=None)[source]#
Export a laygo2.object.database.Library object to a gds file via gdspy.
- Parameters:
db (laygo2.database.Library) – The library database to exported.
filename (str, optional) – The name of output gds file.
cellname (str or List[str]) – The name(s) of cell(s) to be exported.
scale (float) – The scaling factor between laygo2’s integer coordinats actual physical coordinates.
layermapfile (str) – the name of layermap file.
physical_unit (float, optional) – GDS physical unit.
logical_unit (float, optional) – GDS logical unit.
pin_label_height (float, optional) – the height of pin label.
svg_filename (str, optional) – If specified, it exports a svg file with the specified filename.
svg_filename – If specified, it exports a png file with the specified filename (svg_filename needs to be specified as well).
Example
>>> import laygo2 >>> from laygo2.object.database import Design >>> from laygo2.object.physical import Rect, Pin, Instance, Text >>> # Create a design. >>> dsn = Design(name="mycell", libname="genlib") >>> # Create layout objects. >>> r0 = Rect(xy=[[0, 0], [100, 100]], layer=["M1", "drawing"]) >>> p0 = Pin(xy=[[0, 0], [50, 50]], layer=["M1", "pin"], name="P") >>> i0 = Instance(libname="tlib", cellname="t0", name="I0", xy=[0, 0]) >>> t0 = Text(xy=[[50, 50], [100, 100]], layer=["text", "drawing"], text="T") >>> # Add the layout objects to the design object. >>> dsn.append(r0) >>> dsn.append(p0) >>> dsn.append(i0) >>> dsn.append(t0) >>> # >>> # Export to a gds file. >>> lib = laygo2.object.database.Library(name="mylib") >>> lib.append(dsn) >>> laygo2.interface.gds.export(lib, filename="mylayout.gds")