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¶
Field¶
-
class
pykicadlib.symbol.elements.Field(type, value, x, y, size, orientation, visibility, hjustify, vjustify, style)¶ Component field
Parameters: - type (types.Field) – Type of
Field - value (str) – Value of
Fieldtext - 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
-
x= None¶ X coordinate
-
y= None¶ Y coordinate
-
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
- type (types.Field) – Type of
Graphics¶
-
class
pykicadlib.symbol.elements.Arc(x, y, start_x, start_y, end_x, end_y, start_angle, end_angle, radius, thickness, fill, unit=0, representation=<Representation.normal: 1>)¶ Arc with center at
x/yandradius.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
-
x= None¶ X coordinate
-
y= None¶ Y coordinate
-
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
-
radius= None¶ Arc radius
-
thickness= None¶ Thickness of outline
-
fill= None¶ Fill type
-
priority¶ Element priority depending on order and unit.
Type: int
-
class
pykicadlib.symbol.elements.Circle(x, y, radius, thickness, fill, unit=0, representation=<Representation.normal: 1>)¶ Circle with center at
x/yandradius.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
-
x= None¶ X coordinate
-
y= None¶ Y coordinate
-
radius= None¶ Circle radius
-
thickness= None¶ Thickness of outline
-
fill= None¶ Fill type
-
priority¶ Element priority depending on order and unit.
Type: int
-
class
pykicadlib.symbol.elements.Pin(x, y, name, number, length, direction, name_size, number_size, electric=<Electric.input: 'I'>, shape=<Shape.line: ''>, visible=True, unit=0, representation=<Representation.normal: 1>)¶ Pin at
x/ywithname/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
-
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 depending on order and unit.
Type: int
-
class
pykicadlib.symbol.elements.Polygon(thickness, fill, unit=0, representation=<Representation.normal: 1>)¶ Parameters: - thickness (int) – Thickness of outline
- fill (Fill) – Fill type
- unit (int) – Unit index
- representation (Representation) – Representation type
-
thickness= None¶ Thickness of outline
-
fill= None¶ Fill type
-
points= None¶ Outline points
-
priority¶ Element priority depending on order and unit.
Type: int
-
remove(index)¶ Remove element from polygon
Parameters: index (int) – Index of point to remove
-
class
pykicadlib.symbol.elements.Rectangle(x1, y1, x2, y2, thickness, fill, unit=0, representation=<Representation.normal: 1>)¶ Rectangle from
x1/y1tox2/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
-
x1= None¶ X1 coordinate
-
x2= None¶ X2 coordinate
-
y1= None¶ Y1 coordinate
-
y2= None¶ Y2 coordinate
-
thickness= None¶ Thickness of outline
-
fill= None¶ Fill type
-
priority¶ Element priority depending on order and unit.
Type: int
-
class
pykicadlib.symbol.elements.Text(x, y, value, size, angle, italic=<Italic.off: 'Normal'>, bold=<Bold.off: 0>, hjustify=<HJustify.center: 'C'>, vjustify=<VJustify.center: 'C'>, unit=0, representation=<Representation.normal: 1>)¶ Text at
x/ywithvalue,size,angleand 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
-
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
-
priority¶ Element priority depending on order and unit.
Type: int
Helper¶
-
pykicadlib.symbol.elements.from_str(string)¶ Generate elements out of string statements. Used to load a KiCAD symbol file line by line.
>>> element = pykicadlib.symbol.elements.from_str("S 10 10 20 20 0 1 5 N") >>> type(element) <class 'pykicadlib.symbol.elements.Rectangle'> >>> print(element) S 10 10 20 20 0 1 5 N
Parameters: string (str) – KiCAD symbol line to parse. Returns: Element object depending on input string. Return type: symbol.elements.Arc, symbol.elements.Circle, symbol.elements.Field, symbol.elements.Pin, symbol.elements.Polygon, symbol.elements.Rectangle, symbol.elements.Text Raises: KeyError, ValueError
-
class
pykicadlib.symbol.elements.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
-
__add__(other)¶ Merge boundary from
otherobject with own boundary.Parameters: other (Boundary) – Object to merge with Returns: Boundary of both merged objects Return type: Boundary
-
x1= None¶ X1 coordinate
-
y1= None¶ Y1 coordinate
-
x2= None¶ X2 coordinate
-
y2= None¶ Y2 coordinate
-
class
pykicadlib.symbol.elements.Point(x, y)¶ Point helper
Parameters: - x (int) – X coordinate
- y (int) – Y coordinate
Attributes: - x (int) - X cord
-
__eq__(other)¶ Compare
PointinstancesReturns: True, ifother==Pointand all attributes match. OtherwiseFalse.
-
x= None¶ X coordinate
-
y= None¶ Y coordinate