Table Of Contents

Previous topic

gdsCAD.core

Next topic

gdsCAD.utils

This Page

gdsCAD.shapes

Classes to define simple shapes.

Filled Objects

Rectangle
A filled rectangle
Disk
A filled circle
Ellipse
A filled ellipse
RegPolygon
A filled regular polygon
Label
Printing text

Unfilled Objects

Box
An unfilled rectangle
RegPolyline
An ufilled regular polygon
Circle
An unfilled circle

Note

Copyright 2009-2012 Lucas Heitzmann Gabrielli

Copyright 2013 Andrew G. Mark

gdsCAD (based on gdspy) is released under the terms of the GNU GPL

Inheritance Diagram

digraph inheritance3acbfad5e1 { rankdir=LR; size="8.0, 12.0"; "core.Boundary" [style="setlinewidth(0.5)",URL="core_api.html#gdsCAD.core.Boundary",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="A filled, closed polygonal geometric object.",height=0.25,shape=box,fontsize=10]; "core.ElementBase" -> "core.Boundary" [arrowsize=0.5,style="setlinewidth(0.5)"]; "core.ElementBase" [style="setlinewidth(0.5)",URL="core_api.html#gdsCAD.core.ElementBase",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Base class for geometric elements. Other drawing elements derive from this.",height=0.25,shape=box,fontsize=10]; "core.Elements" [style="setlinewidth(0.5)",URL="core_api.html#gdsCAD.core.Elements",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="A list-like collection of Boundary and/or Path objects.",height=0.25,shape=box,fontsize=10]; "core.Path" [style="setlinewidth(0.5)",URL="core_api.html#gdsCAD.core.Path",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="An unfilled, unclosed polygonal line of fixed width.",height=0.25,shape=box,fontsize=10]; "core.ElementBase" -> "core.Path" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.Box" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.Box",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Unfilled rectangular geometric object.",height=0.25,shape=box,fontsize=10]; "core.Path" -> "shapes.Box" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.Circle" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.Circle",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="An unfilled circular path or section or arc.",height=0.25,shape=box,fontsize=10]; "core.Path" -> "shapes.Circle" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.Disk" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.Disk",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="A filled circle, or section of a circle",height=0.25,shape=box,fontsize=10]; "core.Boundary" -> "shapes.Disk" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.Ellipse" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.Ellipse",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="A filled ellipse, or section of an ellipse",height=0.25,shape=box,fontsize=10]; "core.Boundary" -> "shapes.Ellipse" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.Label" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.Label",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Printing text string object.",height=0.25,shape=box,fontsize=10]; "core.Elements" -> "shapes.Label" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.LineLabel" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.LineLabel",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Printing text string object as Line font.",height=0.25,shape=box,fontsize=10]; "core.Elements" -> "shapes.LineLabel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.Rectangle" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.Rectangle",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Filled rectangular geometric object.",height=0.25,shape=box,fontsize=10]; "core.Boundary" -> "shapes.Rectangle" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.RegPolygon" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.RegPolygon",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="An unfilled regular polgyon.",height=0.25,shape=box,fontsize=10]; "core.Boundary" -> "shapes.RegPolygon" [arrowsize=0.5,style="setlinewidth(0.5)"]; "shapes.RegPolyline" [style="setlinewidth(0.5)",URL="#gdsCAD.shapes.RegPolyline",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="An unfilled regular polgyon.",height=0.25,shape=box,fontsize=10]; "core.Path" -> "shapes.RegPolyline" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Class Summary

Box(point1, point2, width[, layer, datatype]) Unfilled rectangular geometric object.
Rectangle(point1, point2[, layer, datatype]) Filled rectangular geometric object.
Disk(center, radius[, inner_radius, ...]) A filled circle, or section of a circle
Circle(center, radius, width[, ...]) An unfilled circular path or section or arc.
RegPolygon(center, length, N[, layer, datatype]) An unfilled regular polgyon.
RegPolyline(center, length, N, width[, ...]) An unfilled regular polgyon.
Label(text, size[, position, horizontal, ...]) Printing text string object.

Class Definitions

Classes to define simple shapes.

Filled Objects

Rectangle
A filled rectangle
Disk
A filled circle
Ellipse
A filled ellipse
RegPolygon
A filled regular polygon
Label
Printing text

Unfilled Objects

Box
An unfilled rectangle
RegPolyline
An ufilled regular polygon
Circle
An unfilled circle

Note

Copyright 2009-2012 Lucas Heitzmann Gabrielli

Copyright 2013 Andrew G. Mark

gdsCAD (based on gdspy) is released under the terms of the GNU GPL

class gdsCAD.shapes.Box(point1, point2, width, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Path

Unfilled rectangular geometric object.

Parameters:
  • point1 – Coordinates of a corner of the rectangle.
  • point2 – Coordinates of the corner of the rectangle opposite to point1.
  • width – The width of the line
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Examples:

box = shapes.Box((0, 0), (10, 20), 0.5)
myCell.add(box)
class gdsCAD.shapes.Circle(center, radius, width, initial_angle=0, final_angle=0, number_of_points=199, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Path

An unfilled circular path or section or arc.

Parameters:
  • center – Coordinates of the disk’s center.
  • radius – The radius of the disk.
  • width – The width of the line.
  • initial_angle – The starting angle of the sweep.
  • final_angle – The final angle of the sweep.
  • number_of_points – The number of line segments that the disk will be composed of.
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Example:

circ=shapes.Circle((10,10), 10, 0.5)
circ.show()
class gdsCAD.shapes.Disk(center, radius, inner_radius=0, initial_angle=0, final_angle=0, number_of_points=199, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Boundary

A filled circle, or section of a circle

Parameters:
  • center – Coordinates of the disk’s center.
  • radius – The radius of the disk
  • inner_radius – The inner radius of the disk. If absent creates a solid disk.
  • initial_angle – The starting angle of the sweep
  • final_angle – The final angle of the sweep
  • number_of_points – The number of line segments that the disk will be composed of
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Example:

disk=shapes.Disk((-5,-5), 5)
disk.show()    
class gdsCAD.shapes.Ellipse(center, radius_x, radius_y, inner_radius_x=0, inner_radius_y=0, initial_angle=0, final_angle=0, number_of_points=199, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Boundary

A filled ellipse, or section of an ellipse

Parameters:
  • center – Coordinates of the ellipse’s center.
  • radius_x – The radius of the ellipse along x
  • radius_y – The radius of the ellipse along y
  • inner_radius_x – The inner radius of the ellipse along x. If absent creates a solid ellipse.
  • inner_radius_y – The inner radius of the ellipse along y. If absent creates a solid ellipse.
  • initial_angle – The starting angle of the sweep
  • final_angle – The final angle of the sweep
  • number_of_points – The number of line segments that the ellipse will be composed of
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Example:

ellipse=shapes.Ellipse((-5,-5), 2, 4)
ellipse.show()
class gdsCAD.shapes.Label(text, size, position=(0, 0), horizontal=True, angle=0, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Elements

Printing text string object.

Each letter is formed by a series of polygons collected together as an Elements list.

Parameters:
  • text – The text to be converted in geometric objects.
  • size – Base size of each character.
  • position – Text position (lower left corner).
  • horizontal – If True, the text is written from left to right; if False, from top to bottom.
  • angle – The angle of rotation of the text.
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Examples:

text = shapes.Label('Sample text', 20, (-10, -100))
text.show()
myCell.add(text)
class gdsCAD.shapes.LineLabel(text, size, position=(0, 0), style='romans', horizontal=True, line_width=None, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Elements

Printing text string object as Line font.

Each letter is formed by a series of lines collected together as an Elements list. The lines are Hershey vector fonts. The font is basically a collection of symbols, containing all kinds of font styles and symbols.

The font itself is not a monotype and no guarantee is given on the height of the characters. But for normal characters, the height should always be within the specified size.

Since the Hershey nearly as old as ASCII, it is unfortunately not ordered in these codes. The font itself also contains many styles, ranging from Cyrillic over Greek to Roman letters.

For convenience, lookup tables from ASCII to symbol number are provided for several font styles. But note, that only a fraction of all available symbols are mapped to ASCII characters in these tables. You can always add a specific symbol by yourself, once you know its Hershey code.

Table name Description
gothgbt Gothic English Triplex
gothgrt Gothic German Triplex
gothitt Gothic Italian Triplex
greekc Greek Complex
greekcs Greek Complex Small
greekp Greek Plain
greeks Greek Simplex
cyrilc Cyrillic complex
italicc Italic Complex
italiccs Italic Complex Small
italict Italic Triplex
scriptc Script Complex
scripts Script Simplex
romanc Roman Complex
romancs Roman Complex Small
romand Roman Duplex
romanp Roman Plain
romans Roman Simplex
romant Roman Triplex
Parameters:
  • text – The text to be converted in geometric objects.
  • size – Base size of each character.
  • position – Text position (lower left corner).
  • style – The default name of ASCII lookup table. Defaults to (romans) Roman Simplex.
  • horizontal – If True, the text is written from left to right; if False, from top to bottom.
  • line_width – Line width of the text. Defaults to one 40th of the text size.
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Examples:

text = shapes.LineLabel(20, (-10, -100))
text.add_text('Sample text', 'romand')
text.show()
myCell.add(text)
add_symbol(symbol)[source]

Add one or more symbols to the label.

Parameters:symbol – The integer symbol code as specified in the Hershey sign table.
add_text(text, style=None)[source]

Add text to the label.

The corresponding symbol codes are automatically looked in the specified lookup table.

Parameters:
  • text – The text to be converted in geometric objects.
  • style – The name of the lookup table. Defaults to the style passed during the creation of this object.
class gdsCAD.shapes.Rectangle(point1, point2, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Boundary

Filled rectangular geometric object.

Parameters:
  • point1 – Coordinates of a corner of the rectangle.
  • point2 – Coordinates of the corner of the rectangle opposite to point1.
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Examples:

rectangle = shapes.Rectangle((0, 0), (10, 20))
myCell.add(rectangle)
class gdsCAD.shapes.RegPolygon(center, length, N, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Boundary

An unfilled regular polgyon.

Parameters:
  • center – Coordinates of the disk’s center.
  • length – The length of an edge.
  • N – The number of sides
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Example:

pent = shapes.RegPolygon((10,10), 10, 5)
pent.show()
class gdsCAD.shapes.RegPolyline(center, length, N, width, layer=None, datatype=None)[source]

Bases: gdsCAD.core.Path

An unfilled regular polgyon.

Parameters:
  • center – Coordinates of the disk’s center.
  • length – The length of an edge.
  • N – The number of sides
  • width – The width of the line.
  • layer – The GDSII layer number for this element. Defaults to layer of 1st object, or core.default_layer.
  • datatype – The GDSII datatype for this element (between 0 and 255).

Example:

hex=shapes.RegPolylone((10,10), 10, 6, 0.5)
hex.show()