Previous topic

gdsii.structure — interface to a GDSII structure

Next topic

gdsii.tags — definitions of GDSII tags

This Page

gdsii.elements – interface to GDSII elements

This module contains definitions for classes representing various GDSII elements. Mapping between GDSII elements and classes is given in the following table:

GDSII Record Class
AREF ARef
BOUNDARY Boundary
BOX Box
NODE Node
PATH Path
SREF SRef
TEXT Text
This module implements the following GDS syntax:
element ::=  aref |
             boundary |
             box |
             node |
             path |
             sref |
             text
Additional definitions:
properties ::=  property*
property   ::=  PROPATTR
                PROPVALUE
strans     ::=  STRANS
                [MAG]
                [ANGLE]

Possible instance attributes:

elflags
Element flags (int, optional). Bit 15 specifies template data. Bit 14 specifies external data.
plex
Plex number (int, optional).
layer
Element layer (int)
data_type
Element data type (int)
path_type

Type of path endpoints (int, optional). The values have the following meaning:

  • 0 – square ends, flush with endpoints
  • 1 – round ends, centered on endpoints
  • 2 – square ends, centered on endpoints
  • 4 – custom square ends
width
Width of the path (int, optional). If the value is negative, then the width is absolute and not affected by magnification factor.
bgn_extn, end_extn
Start end end extensions for path_type 4 (int, optional).
xy
List of points (list of tuples (x, y)).
struct_name
Name of the referenced structure (bytes).
strans

Transformation flags (int, optional). Bits have the following meaning:

  • 0 – reclection about X axis
  • 13 – absolute magnification
  • 14 – absolute angle
mag
Magnification factor (float, optional).
angle
Rotation factor in degrees (float, optional). Rotation is counterclockwise.
cols
Number of columns (int).
rows
Number of rows (int).
text_type
Text type (int).
presentation

Bit array that specifies how the text is presented (int, optional). Meaning of bits:

  • Bits 10 and 11 specify font number (0-3).
  • Bits 12 and 13 specify vertical justification (0 – top, 1 – middle, 2 – bottom).
  • Bits 14 and 15 specify horizontal justification (0 – left, 1 – center, 2 – rigth).
string
String for TEXT element (bytes).
node_type
Node type (int).
box_type
Box type (int).
properties
Element properties, represented as a list of tupes (propattr, propvalue). propattr is an int, propvalue is bytes. This attribute is optional.
class gdsii.elements.ARef(struct_name, cols, rows, xy)

Class for AREF GDSII element.

GDS syntax:
aref ::=  AREF
          [ELFLAGS]
          [PLEX]
          SNAME
          [strans]
          COLROW
          XY
          [properties]
          ENDEL

Required attributes: struct_name, cols, rows, xy.

Optional attributes: elflags, plex, strans, mag, angle, properties.

class gdsii.elements.Boundary(layer, data_type, xy)

Class for BOUNDARY GDSII element.

GDS syntax:
boundary ::=  BOUNDARY
              [ELFLAGS]
              [PLEX]
              LAYER
              DATATYPE
              XY
              [properties]
              ENDEL

Required attributes: layer, data_type, xy.

Optional attributes: elflags, plex, properties.

class gdsii.elements.Box(layer, box_type, xy)

Class for BOX GDSII element.

GDS syntax:
box ::=  BOX
         [ELFLAGS]
         [PLEX]
         LAYER
         BOXTYPE
         XY
         [properties]
         ENDEL

Required attributes: layer, box_type, xy.

Optional attributes: elflags, plex, properties.

class gdsii.elements.Node(layer, node_type, xy)

Class for NODE GDSII element.

GDS syntax:
node ::=  NODE
          [ELFLAGS]
          [PLEX]
          LAYER
          NODETYPE
          XY
          [properties]
          ENDEL

Required attributes: layer, node_type, xy

Optional attributes: elflags, plex, properties

class gdsii.elements.Path(layer, data_type, xy)

Class for PATH GDSII element.

GDS syntax:
path ::=  PATH
          [ELFLAGS]
          [PLEX]
          LAYER
          DATATYPE
          [PATHTYPE]
          [WIDTH]
          [BGNEXTN]
          [ENDEXTN]
          XY
          [properties]
          ENDEL

Required attributes: layer, data_type, xy

Optional attributes: elflags, plex, path_type, width, bgn_extn, end_extn, properties

class gdsii.elements.SRef(struct_name, xy)

Class for SREF GDSII element.

GDS syntax:
sref ::=  SREF
          [ELFLAGS]
          [PLEX]
          SNAME
          [strans]
          XY
          [properties]
          ENDEL

Required attributes: struct_name, xy

Optional attributes: elflags, strans, mag, angle, properties

class gdsii.elements.Text(layer, text_type, xy, string)

Class for TEXT GDSII element.

GDS syntax:
text ::=  TEXT
          [ELFLAGS]
          [PLEX]
          LAYER
          TEXTTYPE
          [PRESENTATION]
          [PATHTYPE]
          [WIDTH]
          [strans]
          XY
          STRING
          [properties]
          ENDEL

Required attributes: layer, text_type, xy, string

Optional attributes: elflags, plex, presentation, path_type, width, strans, mag, angle, properties