Common

class edea.kicad.common.StrokeType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Available stroke types that can be used for lines, outlines, etc.

KiCad stroke definition

DEFAULT = 'default'

Stroke type.

DASH = 'dash'

Evenly spaced dashes.

DASH_DOT = 'dash_dot'

Alternating dashes and dots.

DASH_DOT_DOT = 'dash_dot_dot'

Alternating dashes and double dots.

DOT = 'dot'

Evenly spaced dots.

SOLID = 'solid'

Continuous solid.

class edea.kicad.common.Stroke(width: float = 0, type: StrokeType = 'default', color: tuple[int, int, int, float] = (0, 0, 0, 0.0))

Bases: KicadExpr

Properties of a stroke used within KiCad expressions.

KiCad stroke definition

Parameters:
  • width – The line width of the graphic object.

  • type – The line style of the graphic object.

  • color – The red, green, blue, and alpha color settings.

width: float = 0
type: StrokeType = 'default'
color: tuple[int, int, int, float] = (0, 0, 0, 0.0)
kicad_expr_tag_name: ClassVar[Literal['stroke']] = 'stroke'
class edea.kicad.common.PaperFormat(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Various standard paper formats like A series A0, A1, B series, etc.

KiCad paper format

A0 = 'A0'
A1 = 'A1'
A2 = 'A2'
A3 = 'A3'
A4 = 'A4'
A5 = 'A5'
A = 'A'
B = 'B'
C = 'C'
D = 'D'
E = 'E'
US_LETTER = 'USLetter'
US_LEDGER = 'USLedger'
class edea.kicad.common.PaperOrientation(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

The two common paper shown modes: landscape and portrait.

KiCad paper format

LANDSCAPE = ''

The default value (empty string), represents horizontal orientation.

PORTRAIT = 'portrait'

Represents vertical orientation.

class edea.kicad.common.PaperUser(format: Literal['User'] = 'User', width: float = 0, height: float = 0)

Bases: KicadExpr

A custom KiCad paper size definition.

Parameters:
  • format – Always set to “User” to indicate a custom format.

  • width – The width of the paper in KiCad units.

  • height – The height of the paper in KiCad units

Variables:

kicad_expr_tag_name – The KiCad expression tag name for this element (“paper”).

format: Literal['User'] = 'User'
width: float = 0
height: float = 0
kicad_expr_tag_name: ClassVar[Literal['paper']] = 'paper'
as_dimensions_mm() tuple[float, float]

Calculates the paper dimensions based on the user-defined width and height.

Returns:

A tuple containing the width and height of the paper.

class edea.kicad.common.PaperStandard(format: PaperFormat = 'A4', orientation: PaperOrientation = '')

Bases: KicadExpr

A standard KiCad paper size.

KiCad paper format

Parameters:
  • format – The paper format from the PaperFormat enum.

  • orientation – The paper orientation from the PaperOrientation enum.

Variables:

kicad_expr_tag_name – The KiCad expression tag name for this element (“paper”).

format: PaperFormat = 'A4'
orientation: PaperOrientation = ''
kicad_expr_tag_name: ClassVar[Literal['paper']] = 'paper'
as_dimensions_mm() tuple[float, float]

Calculates dimensions of the paper in millimeters based on the standard.

Returns:

A tuple containing the width and height of the paper.

class edea.kicad.common.PolygonArc(start: tuple[float, float], mid: tuple[float, float], end: tuple[float, float])

Bases: KicadExpr

A polygonal arc KiCad expression element.

KiCad arc

Parameters:
  • start – The starting X-Y coordinates of the arc.

  • mid – The midpoint X-Y coordinates of the arc.

  • end – The ending X-Y coordinates of the arc.

Variables:

kicad_expr_tag_name – The KiCad expression tag name for this element (“arc”).

start: tuple[float, float]
mid: tuple[float, float]
end: tuple[float, float]
kicad_expr_tag_name: ClassVar[Literal['arc']] = 'arc'
class edea.kicad.common.XY(x: float, y: float)

Bases: KicadExpr

A 2D coordinate point.

KiCad coordinate point list

Parameters:
  • x – The X coordinate of the point.

  • y – The Y coordinate of the point.

x: float
y: float
kicad_expr_tag_name: ClassVar[Literal['xy']] = 'xy'
class edea.kicad.common.Pts(xys: list[~edea.kicad.common.XY] = <factory>, arcs: list[~edea.kicad.common.PolygonArc] = <factory>)

Bases: KicadExpr

A collection of points and arcs.

KiCad coordinate point list, KiCad arc

Parameters:
  • xys – A list of XY instances representing points.

  • arcs – A list of PolygonArc instances representing arcs.

xys: list[XY]
arcs: list[PolygonArc]
kicad_expr_tag_name: ClassVar[Literal['pts']] = 'pts'
class edea.kicad.common.Image(at: tuple[float, float], scale: float | None = None, uuid: ~uuid.UUID = <factory>, data: list[str] = <factory>)

Bases: KicadExpr

An embedded image in a KiCad expression.

KiCad image

Parameters:
  • at – The X-Y coordinates specifying the image placement.

  • scale – The scale factor of the image.

  • uuid – The unique identifier (UUID) for the image.

  • data – The image data in the portable network graphics format (PNG) encoded with MIME type base64.

at: tuple[float, float]
scale: float | None = None
uuid: UUID
data: list[str]
kicad_expr_tag_name: ClassVar[Literal['image']] = 'image'
class edea.kicad.common.TitleBlockComment(number: int = 1, text: str = '')

Bases: KicadExpr

A comment within a KiCad title block.

KiCad title block

Parameters:
  • number – A sequential comment number.

  • text – The comment text content.

Variables:

kicad_expr_tag_name – The KiCad expression tag name for this element (“comment”).

number: int = 1
text: str = ''
kicad_expr_tag_name: ClassVar[Literal['comment']] = 'comment'
class edea.kicad.common.TitleBlock(title: str = '', date: str = '', rev: str = '', company: str = '', comments: list[~edea.kicad.common.TitleBlockComment] = <factory>)

Bases: KicadExpr

The contents of a KiCad title block.

KiCad title block

Parameters:
  • title – The title of the document.

  • date – The document date using the YYYY-MM-DD format.

  • rev – The revision number of the document.

  • company – The company name associated with the document.

  • comments – The document comments where N is a number from 1 to 9 and COMMENT is a quoted string.

title: str = ''
date: str = ''
rev: str = ''
company: str = ''
comments: list[TitleBlockComment]
kicad_expr_tag_name: ClassVar[Literal['title_block']] = 'title_block'
class edea.kicad.common.Font(face: str | None = None, size: tuple[float, float] = (1.27, 1.27), thickness: float | None = None, bold: bool = False, italic: bool = False, color: tuple[int, int, int, float] = (0, 0, 0, 1.0))

Bases: KicadExpr

The font style for KiCad expressions.

KiCad text effects

Parameters:
  • face – The font face name. Defaults to None.

  • size – The font size (width, height) in KiCad units. Defaults to (1.27, 1.27).

  • thickness – The font thickness.

  • bold – Whether the font is bold or not.

  • italic – Whether the font is italic or not.

  • color – The font color as a 4-tuple of integers (R, G, B, A).

face: str | None = None
size: tuple[float, float] = (1.27, 1.27)
thickness: float | None = None
bold: bool = False
italic: bool = False
color: tuple[int, int, int, float] = (0, 0, 0, 1.0)
kicad_expr_tag_name: ClassVar[Literal['font']] = 'font'
class edea.kicad.common.Effects(font: ~edea.kicad.common.Font = <factory>, justify: list[~typing.Literal['left', 'right', 'top', 'bottom', 'mirror']] = <factory>, hide: bool = False, href: str | None = None)

Bases: KicadExpr

The text effects for KiCad expressions.

KiCad text effects

Parameters:
  • font – How the text is shown.

  • justify – Text justified horizontally right or left and/or vertically top or bottom and/or mirrored.

  • hide – Whether to hide the text element or not.

  • href – A hyperlink reference.

font: Font
justify: list[Literal['left', 'right', 'top', 'bottom', 'mirror']]
hide: bool = False
href: str | None = None
kicad_expr_tag_name: ClassVar[Literal['effects']] = 'effects'
exception edea.kicad.common.VersionError

Bases: ValueError

Source file was produced with an unsupported KiCad version.