README
1python-gdsii --- a GDSII manipulation libaray
2=============================================
3
4python-gdsii is a library that can be used to read, create, modify and save
5GDSII files. It supports both low-level record I/O and high level interface to
6GDSII libraries (databases), structures, and elements.
7
8This package also includes scripts that can be used to convert binary GDS file
9to a simple text format (gds2txt), YAML (gds2yaml), and from text fromat
10back to GDSII (txt2gds).
11
12Usage
13-----
14
15For most cases interface provided by Library class from gdsii.library should be
16enough. Here is a small example::
17
18 from gdsii.library import Library
19 from gdsii.elements import *
20
21 # read a library from a file
22 with open('file.gds', 'rb') as stream:
23 lib = Library.load(stream)
24
25 # let's move the first structure to a new library
26 new_lib = Library(5, b'NEWLIB.DB', 1e-9, 0.001)
27 struc = lib.pop(0) # libraries and structures are derived from list class
28 new_lib.append(struc)
29
30 # let's also add some elements...
31 # Note: first and last points in the boundary should be the same
32 # this is required by GDSII spec.
33 struc.append(Boundary(45, 0, [(-100000, -100000), (-100000, 0), (0,0), (0, -100000), (-100000, -100000)]))
34
35 # Save both files with different names...
36 with open('newfile1.gds', 'wb') as stream:
37 lib.save(stream)
38
39 with open('newfile2.gds', 'wb') as stream:
40 new_lib.save(stream)
41