Symbol elements

Symbols consist of multiple elements. These are well known elements like lines, circles and arcs. Additionally elements are added, the help construct symbols out of element primitives.

Examples

Here is a simple example:

>>> element = pykicadlib.symbol.elements.Rectangle(10, 10, 20, 20, 5, pykicadlib.symbol.types.Fill.none)
>>> print(element)
S 10 10 20 20 0 1 5 N

API

Alias

Field

class pykicadlib.symbol.elements.Field(type_, x, y, value)

Component field.

Parameters:
  • type (types.Field) – Type of Field
  • value (str) – Value of Field text
  • x (int) – X coordinate
  • y (int) – Y coordinate
  • size (int) – Text size
  • orientation (Orientation) – Text orientation
  • visibility (Visibility) – Text visibility
  • hjustify (HJustify) – Horizontal text justify
  • vjustify (VJustify) – Vertical text justify
  • style (Style) – Text style
__str__()

Return Field in KiCAD format.

type = None

Type of Field

x = None

X coordinate

y = None

Y coordinate

value = None

Value of Field text

size = None

Text size

orientation = None

Text orientation

visibility = None

Text visibility

hjustify = None

Horizontal text justify

vjustify = None

Vertical text justify

style = None

Text style

class HJustify

Field horizontal justify.

class Orientation

Field orientation.

class Style

Field style.

Type

alias of pykicadlib.symbol.types.Field

class VJustify

Field vertical justify.

class Visibility

Field visibility.

Graphics

class pykicadlib.symbol.elements.Arc(x, y, radius, start_x, start_y, end_x, end_y, start_angle, end_angle)

Arc with center at x/y and radius.

Parameters:
  • x (int) – X coordinate
  • y (int) – Y coordinate
  • start_x (int) – Start X coordinate
  • start_y (int) – Start Y coordinate
  • end_x (int) – End X coordinate
  • end_y (int) – End Y coordinate
  • start_angle (int) – Start angle (?..?)
  • end_angle (int) – End angle (?..?)
  • radius (int) – Arc radius
  • thickness (int) – Thickness of outline
  • fill (Fill) – Fill type
  • unit (int) – Unit index
  • representation (Representation) – Representation type
__eq__(other)

Compare Arc instances.

__str__()

Return Arc in KiCAD format.

x = None

X coordinate

y = None

Y coordinate

radius = None

Arc radius

start_x = None

Start X coordinate

start_y = None

Start Y coordinate

end_x = None

End X coordinate

end_y = None

End Y coordinate

start_angle = None

Start angle

end_angle = None

End angle

thickness = None

Thickness of outline

fill = None

Fill type

bounds

Element boundary.

Type:Boundary
class Boundary(x1, y1, x2, y2)

Element/symbol boundary class.

Parameters:
  • x1 (int) – X1 coordinate
  • y1 (int) – Y1 coordinate
  • x2 (int) – X2 coordinate
  • y2 (int) – Y2 coordinate
class Fill

Element fill.

class Representation

Symbol representation.

priority

Element priority.

Type:int
class pykicadlib.symbol.elements.Circle(x, y, radius)

Circle with center at x/y and radius.

Parameters:
  • x (int) – X coordinate
  • y (int) – Y coordinate
  • radius (int) – Circle radius
  • thickness (int) – Thickness of outline
  • fill (Fill) – Fill type
  • unit (int) – Unit index
  • representation (Representation) – Representation type
__eq__(other)

Compare Circle instances.

__str__()

Return Circle in KiCAD format.

x = None

X coordinate

y = None

Y coordinate

radius = None

Circle radius

thickness = None

Thickness of outline

fill = None

Fill type

bounds

Element boundary.

Type:Boundary
class Boundary(x1, y1, x2, y2)

Element/symbol boundary class.

Parameters:
  • x1 (int) – X1 coordinate
  • y1 (int) – Y1 coordinate
  • x2 (int) – X2 coordinate
  • y2 (int) – Y2 coordinate
class Fill

Element fill.

class Representation

Symbol representation.

priority

Element priority.

Type:int
class pykicadlib.symbol.elements.Pin(x, y, name, number)

Pin at x/y with name/number.

Parameters:
  • x (int) – X coordinate
  • y (int) – Y coordinate
  • name (str) – Pin name
  • number (str) – Pin number
  • length (int) – Pin length
  • direction (Direction) – Pin direction
  • name_size (int) – Pin name size
  • number_size (int) – Pin number size
  • electric (Electric) – Electric type
  • shape (Shape) – Shape type
  • visible (bool) – Visibility
  • unit (int) – Unit index
  • representation (Representation) – Representation type
__eq__(other)

Compare Pin instances.

__str__()

Return Pin in KiCAD format.

x = None

X coordinate

y = None

Y coordinate

name = None

Pin name

number = None

Pin number

length = None

Pin length

direction = None

Pin direction

name_size = None

Pin name size

number_size = None

Pin number size

electric = None

Electric type

shape = None

Shape type

visible = None

Visibility

priority

Element priority.

Type:int
bounds

Element boundary.

Type:Boundary
class Boundary(x1, y1, x2, y2)

Element/symbol boundary class.

Parameters:
  • x1 (int) – X1 coordinate
  • y1 (int) – Y1 coordinate
  • x2 (int) – X2 coordinate
  • y2 (int) – Y2 coordinate
class Direction

Pin direction (flipped in opposition to KiCAD documentation).

class Electric

Electric pin type.

class Fill

Element fill.

class Representation

Symbol representation.

class Shape

Pin shape.

Note: Add ‘N’ before characters, to create an invisible pin.

class pykicadlib.symbol.elements.Polygon

Polygon.

Parameters:
  • thickness (int) – Thickness of outline
  • fill (Fill) – Fill type
  • unit (int) – Unit index
  • representation (Representation) – Representation type
__eq__(other)

Compare Polygon instances.

__str__()

Return Polygon in KiCAD format.

thickness = None

Thickness of outline

fill = None

Fill type

points = None

Outline points

priority

Element priority.

Type:int
bounds

Element boundary.

Type:Boundary
add(point)

Add point to polygon.

Parameters:point (Point) – Point to add
remove(index)

Remove element from polygon.

Parameters:index (int) – Index of point to remove
class Boundary(x1, y1, x2, y2)

Element/symbol boundary class.

Parameters:
  • x1 (int) – X1 coordinate
  • y1 (int) – Y1 coordinate
  • x2 (int) – X2 coordinate
  • y2 (int) – Y2 coordinate
class Fill

Element fill.

class Point(x, y)

Point helper.

Parameters:
  • x (int) – X coordinate
  • y (int) – Y coordinate
class Representation

Symbol representation.

class pykicadlib.symbol.elements.Rectangle(x1, y1, x2, y2)

Rectangle from x1/y1 to x2/y2.

Parameters:
  • x1 (int) – X1 coordinate
  • y1 (int) – Y1 coordinate
  • x2 (int) – X2 coordinate
  • y2 (int) – Y2 coordinate
  • thickness (int) – Thickness of outline
  • fill (Fill) – Fill type
  • unit (int) – Unit index
  • representation (Representation) – Representation type
__eq__(other)

Compare Rectangle instances.

__str__()

Return Rectangle in KiCAD format.

x1 = None

X1 coordinate

x2 = None

X2 coordinate

y1 = None

Y1 coordinate

y2 = None

Y2 coordinate

thickness = None

Thickness of outline

class Boundary(x1, y1, x2, y2)

Element/symbol boundary class.

Parameters:
  • x1 (int) – X1 coordinate
  • y1 (int) – Y1 coordinate
  • x2 (int) – X2 coordinate
  • y2 (int) – Y2 coordinate
class Fill

Element fill.

class Representation

Symbol representation.

fill = None

Fill type

priority

Element priority.

Type:int
bounds

Element boundary.

Type:Boundary
class pykicadlib.symbol.elements.Text(x, y, value, size)

Text at x/y with value, size, angle and multiple style options.

New format since 2.4?

Parameters:
  • x (int) – X coordinate
  • y (int) – Y coordinate
  • value (str) – Text value
  • size (int) – Text size
  • angle (int) – Text angle
  • italic (Italic) – Text italic style
  • bold (Bold) – Text bold style
  • hjustify (HJustify) – Horizontal text justify
  • vjustify (VJustify) – Vertical text justify
  • unit (int) – Unit index
  • representation (Representation) – Representation type
__eq__(other)

Compare Text instances.

__str__()

Return Text in KiCAD format.

x = None

X coordinate

y = None

Y coordinate

value = None

Text value

size = None

Text size

angle = None

Text angle

italic = None

Text italic style

bold = None

Text bold style

hjustify = None

Horizontal text justify

vjustify = None

Vertical text justify

bounds

Element boundary.

Type:Boundary
class Bold

Text element bold.

class Boundary(x1, y1, x2, y2)

Element/symbol boundary class.

Parameters:
  • x1 (int) – X1 coordinate
  • y1 (int) – Y1 coordinate
  • x2 (int) – X2 coordinate
  • y2 (int) – Y2 coordinate
class Fill

Element fill.

class HJustify

Field horizontal justify.

class Italic

Text element italic.

class Representation

Symbol representation.

class VJustify

Field vertical justify.

priority

Element priority.

Type:int

Helper