PCB

Dataclasses describing the contents of .kicad_pcb files.

class edea.kicad.pcb.__init__.General(thickness: float = 0, legacy_teardrops: bool | None = None)

Bases: KicadPcbExpr

General board config.

Param:

legacy_teardrops: Whether to use legacy teardrops or not.

Parameters:

thickness – The overall board thickness.

Note

The legacy_teardrops was added in 20240108 (KiCad 8).

thickness: float = 0
legacy_teardrops: bool | None = None
kicad_expr_tag_name: ClassVar[Literal['general']] = 'general'
class edea.kicad.pcb.__init__.StackupLayerThickness(value: float, locked: bool = False)

Bases: KicadPcbExpr

A layer thickness within a stackup in KiCad PCB expressions.

Parameters:
  • value – The thickness value of the layer.

  • locked – Whether the layer thickness is locked or not.

Variables:

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

value: float
locked: bool = False
kicad_expr_tag_name: ClassVar[Literal['thickness']] = 'thickness'
class edea.kicad.pcb.__init__.StackupLayer(name: str, type: str, color: str | None = None, thickness: StackupLayerThickness | None = None, material: str | None = None, epsilon_r: float | None = None, loss_tangent: float | None = None, addsublayer: bool = False)

Bases: KicadPcbExpr

A layer within a stackup in KiCad PCB expressions.

KiCad layer

Parameters:
  • name – The name of the layer.

  • type – The type of the layer.

  • color – The layer color.

  • thickness – The thickness of the layer.

  • material – The material of the layer.

  • epsilon_r – The dielectric constant of the layer material.

  • loss_tangent – The loss tangent of the layer material.

  • addsublayer – Whether the layer is an additional sublayer or not.

Variables:

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

Note

The type field is an arbitrary string, not a CanonicalLayer.

Note

The addsublayer field was added in 20240108 (KiCad 8).

name: str
type: str
color: str | None = None
thickness: StackupLayerThickness | None = None
material: str | None = None
epsilon_r: float | None = None
loss_tangent: float | None = None
addsublayer: bool = False
kicad_expr_tag_name: ClassVar[Literal['layer']] = 'layer'
class edea.kicad.pcb.__init__.Stackup(layers: list[~edea.kicad.pcb.__init__.StackupLayer] = <factory>, copper_finish: str | None = None, dielectric_constraints: bool = False, edge_connector: ~typing.Literal['yes', 'bevelled', None] = None, castellated_pads: bool = False, edge_plating: bool = False)

Bases: KicadPcbExpr

A PCB stackup in KiCad PCB expressions.

KiCad stackup

Parameters:
  • layers – The individual layers in the stackup.

  • copper_finish – The copper finish type for the PCB (e.g., ENIG, OSP).

  • dielectric_constraints – Whether dielectric constraints are applied during design rule check (DRC) or not.

  • edge_connector – The type of edge connector for the PCB.

  • castellated_pads – Whether castellated pads are used on the PCB or not.

  • edge_plating – Whether edge plating is applied to the PCB or not.

Note

The castellated_pads became optional in 20240108 (KiCad 8).

layers: list[StackupLayer]
copper_finish: str | None = None
dielectric_constraints: bool = False
edge_connector: Literal['yes', 'bevelled', None] = None
castellated_pads: bool = False
edge_plating: bool = False
kicad_expr_tag_name: ClassVar[Literal['stackup']] = 'stackup'
class edea.kicad.pcb.__init__.PlotOutputFormat(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Defines the possible output formats for PCB plots generated in KiCad.

GERBER = '0'

Industry-standard format for PCB manufacturing.

POSTSCRIPT = '1'

Page description language for printing or generating vector graphics.

SVG = '2'

Scalable Vector Graphics format for web or vector editing.

DXF = '3'

Drawing Exchange Format for interoperability with CAD software.

HPGL = '4'

Hewlett-Packard Graphics Language for plotter output.

PDF = '5'

Portable Document Format for universal document sharing.

class edea.kicad.pcb.__init__.PlotSettings(layerselection: str = '0x00010fc_ffffffff', plot_on_all_layers_selection: str = '0x0000000_00000000', disableapertmacros: bool = False, usegerberextensions: bool = False, usegerberattributes: bool = True, usegerberadvancedattributes: bool = True, creategerberjobfile: bool = True, gerberprecision: int | None = None, dashed_line_dash_ratio: float | None = None, dashed_line_gap_ratio: float | None = None, svgprecision: int = 4, excludeedgelayer: bool = False, pdf_front_fp_property_popups: bool | None = None, pdf_back_fp_property_popups: bool | None = None, plotfptext: bool | None = None, plotframeref: bool = False, viasonmask: bool = False, mode: Literal[1, 2] = 1, useauxorigin: bool = False, hpglpennumber: int = 1, hpglpenspeed: int = 20, hpglpendiameter: float = 15.0, dxfpolygonmode: bool = True, dxfimperialunits: bool = True, dxfusepcbnewfont: bool = True, psnegative: bool = False, psa4output: bool = False, plotreference: bool = True, plotvalue: bool = True, plotinvisibletext: bool = False, sketchpadsonfab: bool = False, subtractmaskfromsilk: bool = False, outputformat: PlotOutputFormat = '0', mirror: bool = False, drillshape: int = 0, scaleselection: int = 0, outputdirectory: str = '')

Bases: KicadPcbExpr

The settings used for generating PCB plots (fabrication outputs) in KiCad.

Parameters:
  • layerselection – A string representing the bitmask for selecting layers to be plotted.

  • plot_on_all_layers_selection – A string representing another layer selection bitmask.

  • disableapertmacros – Whether to disable aperture macros during plotting or not.

  • usegerberextensions – Whether to use Gerber extensions for advanced features or not.

  • usegerberattributes – Whether to use Gerber attributes for enhanced data embedding or not.

  • usegerberadvancedattributes – Whether to use advanced Gerber attributes or not.

  • creategerberjobfile – Whether to create a Gerber job file or not.

  • gerberprecision – The precision (number of decimal places) used for Gerber data.

  • dashed_line_dash_ratio – The dash-to-gap ratio for dashed lines.

  • dashed_line_gap_ratio – The gap-to-dash ratio for dashed lines.

  • svgprecision – The precision (number of decimal places) used for SVG output.

  • excludeedgelayer – Whether to exclude the edge layer from plotting.

  • pdf_front_fp_property_popups – Whether to include front footprints in PDF property popups.

  • pdf_back_fp_property_popups – Whether to include back footprints in PDF property popups.

  • plotfptext – Whether to plot footprint text or not.

  • plotframeref – Whether to plot frame references.

  • viasonmask – Whether to plot vias on the mask layer.

  • mode – The plot mode (1 or 2, interpretation depends on context).

  • useauxorigin – Whether to use the auxiliary origin for plotting or not.

  • hpglpennumber – The pen number used for HPGL plots.

  • hpglpenspeed – The pen speed used for HPGL plots.

  • hpglpendiameter – The pen diameter used for HPGL plots.

  • dxfpolygonmode – Whether to use polygon mode for DXF output or not.

  • dxfimperialunits – Whether to use imperial units for DXF output or not.

  • dxfusepcbnewfont – Whether to use the KiCad PCB font for DXF output or not.

  • psnegative – Whether to generate negative output for PostScript plots or not.

  • psa4output – Whether to generate PS4 output for PostScript plots or not.

  • plotreference – Whether to plot references (designators) or not.

  • plotvalue – Whether to plot values (component values) or not.

  • plotinvisibletext – Whether to plot invisible text or not.

  • sketchpadsonfab – Whether to include the sketch pad on fabrication output or not.

  • subtractmaskfromsilk – Whether to subtract the mask from the silkscreen during plotting or not.

  • outputformat – The desired output format for the plot files.

  • mirror – Whether to mirror the output or not.

  • drillshape – The drill shape for drill plots.

  • scaleselection – The scale selection for plots.

  • outputdirectory – The output directory for the generated plot files.

Variables:

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

Warning

The dashed_line_dash_ratio, dashed_line_gap_ratio, and psa4output are undocumented in the KiCad file format documentation.

Note

The pdf_front_fp_property_popups, pdf_back_fp_property_popups, and plotfptext were added in 20240108 (KiCad 8).

layerselection: str = '0x00010fc_ffffffff'
plot_on_all_layers_selection: str = '0x0000000_00000000'
disableapertmacros: bool = False
usegerberextensions: bool = False
usegerberattributes: bool = True
usegerberadvancedattributes: bool = True
creategerberjobfile: bool = True
gerberprecision: int | None = None
dashed_line_dash_ratio: float | None = None
dashed_line_gap_ratio: float | None = None
svgprecision: int = 4
excludeedgelayer: bool = False
pdf_front_fp_property_popups: bool | None = None
pdf_back_fp_property_popups: bool | None = None
plotfptext: bool | None = None
plotframeref: bool = False
viasonmask: bool = False
mode: Literal[1, 2] = 1
useauxorigin: bool = False
hpglpennumber: int = 1
hpglpenspeed: int = 20
hpglpendiameter: float = 15.0
dxfpolygonmode: bool = True
dxfimperialunits: bool = True
dxfusepcbnewfont: bool = True
psnegative: bool = False
psa4output: bool = False
plotreference: bool = True
plotvalue: bool = True
plotinvisibletext: bool = False
sketchpadsonfab: bool = False
subtractmaskfromsilk: bool = False
outputformat: PlotOutputFormat = '0'
mirror: bool = False
drillshape: int = 0
scaleselection: int = 0
outputdirectory: str = ''
kicad_expr_tag_name: ClassVar[Literal['pcbplotparams']] = 'pcbplotparams'
class edea.kicad.pcb.__init__.Setup(stackup: ~edea.kicad.pcb.__init__.Stackup | None = None, pad_to_mask_clearance: float = 0.0, solder_mask_min_width: float = 0.0, pad_to_paste_clearance: float = 0.0, pad_to_paste_clearance_ratio: float = 100.0, allow_soldermask_bridges_in_footprints: bool = False, aux_axis_origin: tuple[float, float] = (0.0, 0.0), grid_origin: tuple[float, float] = (0.0, 0.0), pcbplotparams: ~edea.kicad.pcb.__init__.PlotSettings = <factory>)

Bases: KicadPcbExpr

The various settings and properties that govern the overall PCB design

Parameters:
  • stackup – A Stackup instance defining the layer stackup for the PCB.

  • pad_to_mask_clearance – The clearance between pads and the solder mask (in mm).

  • solder_mask_min_width – The minimum width of the solder mask (in mm).

  • pad_to_paste_clearance – The clearance between pads and the solder paste (in mm).

  • pad_to_paste_clearance_ratio – The ratio used to calculate solder paste clearance from pad size.

  • allow_soldermask_bridges_in_footprints – Whether to allow soldermask bridges within footprints or not.

  • aux_axis_origin – The coordinates of the auxiliary axis origin (in mm).

  • grid_origin – The coordinates of the grid origin (in mm).

  • pcbplotparams – A PlotSettings instance defining the PCB plot parameters for generating fabrication outputs.

stackup: Stackup | None = None
pad_to_mask_clearance: float = 0.0
solder_mask_min_width: float = 0.0
pad_to_paste_clearance: float = 0.0
pad_to_paste_clearance_ratio: float = 100.0
allow_soldermask_bridges_in_footprints: bool = False
aux_axis_origin: tuple[float, float] = (0.0, 0.0)
grid_origin: tuple[float, float] = (0.0, 0.0)
pcbplotparams: PlotSettings
kicad_expr_tag_name: ClassVar[Literal['setup']] = 'setup'
class edea.kicad.pcb.__init__.Segment(locked: bool = False, start: tuple[float, float] = (0, 0), end: tuple[float, float] = (0, 0), width: float = 0.0, layer: Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'] = 'F.Cu', net: int = 0, tstamp: UUID | None = None, uuid: UUID | None = None)

Bases: KicadPcbExpr

A PCB trace segment (connection) in KiCad PCB expressions.

Parameters:
  • locked – Whether the line is locked, cannot be edited.

  • start – The starting x-Y coordinates the line (in mm).

  • end – The ending x-Y coordinates of the line (in mm).

  • width – the width of the trace line (in mm).

  • layer – The canonical layer the track segment resides on.

  • net – The net ordinal number which net in the net section that the segment is part of.

  • tstamp – The unique identifier (UUID) for the line object.

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

Note

The tstamp field got renamed to uuid in 20240108 (KiCad 8).

locked: bool = False
start: tuple[float, float] = (0, 0)
end: tuple[float, float] = (0, 0)
width: float = 0.0
layer: Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'] = 'F.Cu'
net: int = 0
tstamp: UUID | None = None
uuid: UUID | None = None
kicad_expr_tag_name: ClassVar[Literal['segment']] = 'segment'
class edea.kicad.pcb.__init__.Via(type: ~typing.Literal['blind', 'micro', 'through'] = 'through', locked: bool = False, at: tuple[float, float] = (0, 0), size: float = 0, drill: float = 0, layers: list[str] = <factory>, remove_unused_layers: bool = False, keep_end_layers: bool = False, free: bool = False, zone_layer_connections: list[~typing.Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue']] = <factory>, net: int = 0, teardrops: ~edea.kicad.pcb.common.TearDrops | None = None, tstamp: ~uuid.UUID | None = None, uuid: ~uuid.UUID | None = None)

Bases: KicadPcbExpr

A via (plated hole) in KiCad PCB expressions.

Parameters:
  • type – The type of via (through-hole, blind, or microvia).

  • locked – Whether the via is locked, cannot be edited.

  • at – The coordinates of the center of the via (in mm).

  • size – The diameter of the via annular ring (in mm).

  • drill – The drill diameter of the via (in mm).

  • layers – The canonical layer set the via connects.

  • remove_unused_layers – Whether to remove unused layers from the via or not.

  • keep_end_layers – Whether to keep only the end layers connected to the via or not

  • free – Whether the via is free to be moved outside it’s assigned net.

  • zone_layer_connections – A list of zone layers the via connects to.

  • net – The net ordinal number which net in the net section that the segment is part of.

  • teardrops – The teardrops settings for the via.

  • tstamp – The unique identifier (UUID) for the line object.

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

Note

The teardrops field was added in 20240108 (KiCad 8).

Note

The tstamp field got renamed to uuid in 20240108 (KiCad 8).

type: Literal['blind', 'micro', 'through'] = 'through'
locked: bool = False
at: tuple[float, float] = (0, 0)
size: float = 0
drill: float = 0
layers: list[str]
remove_unused_layers: bool = False
keep_end_layers: bool = False
free: bool = False
zone_layer_connections: list[Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue']]
net: int = 0
teardrops: TearDrops | None = None
tstamp: UUID | None = None
uuid: UUID | None = None
kicad_expr_tag_name: ClassVar[Literal['via']] = 'via'
class edea.kicad.pcb.__init__.Arc(locked: bool = False, start: tuple[float, float] = (0, 0), mid: tuple[float, float] = (0, 0), end: tuple[float, float] = (0, 0), width: float = 0.0, layer: Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'] = 'F.Cu', net: int = 0, tstamp: UUID | None = None, uuid: UUID | None = None)

Bases: KicadPcbExpr

An arc (curved trace segment) in KiCad PCB expressions.

Parameters:
  • locked – Whether the line is locked, cannot be edited.

  • start – The starting X-Y coordinates of the arc (in mm).

  • mid – The midpoint X-Y coordinates of the radius of the arc (in mm).

  • end – The ending X-Y coordinates of the arc (in mm).

  • width – The line width (in mm).

  • layer – The canonical layer the track arc resides on.

  • net – The net ordinal number which net in the net section that the segment is part of.

  • tstamp – The unique identifier (UUID) of the line object.

  • uuid – The unique identifier (UUID) of the line object.

Note

The tstamp field got renamed to uuid in 20240108 (KiCad 8).

locked: bool = False
start: tuple[float, float] = (0, 0)
mid: tuple[float, float] = (0, 0)
end: tuple[float, float] = (0, 0)
width: float = 0.0
layer: Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'] = 'F.Cu'
net: int = 0
tstamp: UUID | None = None
uuid: UUID | None = None
kicad_expr_tag_name: ClassVar[Literal['arc']] = 'arc'
class edea.kicad.pcb.__init__.Target(type: str, at: Position, size: float, width: float, layer: Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'], tstamp: UUID | None = None, uuid: UUID | None = None)

Bases: KicadPcbExpr

A target (component placement reference) in KiCad PCB expressions.

Parameters:
  • type – The type of target.

  • at – The X-Y coordinates of the target placement (in mm).

  • size – The size of the target (in mm).

  • width – The width of the target.

  • layer – The layer on which the target is placed.

  • tstamp – A unique identifier (UUID) for the target.

  • uuid – A unique identifier (UUID) for the target.

Note

The tstamp field got renamed to uuid in 20240108 (KiCad 8).

type: str
at: Position
size: float
width: float
layer: Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue']
tstamp: UUID | None = None
uuid: UUID | None = None
kicad_expr_tag_name: ClassVar[Literal['target']] = 'target'
class edea.kicad.pcb.__init__.BoardSize(width_mm: float, height_mm: float)

Bases: object

The overall PCB size in KiCad PCB expressions.

Parameters:
  • width_mm – The width of the PCB board (in mm).

  • height_mm – The height of the PCB board (in mm).

width_mm: float
height_mm: float
class edea.kicad.pcb.__init__.GeneratedBaseLine(pts: list[~edea.kicad.common.Pts] = <factory>)

Bases: KicadPcbExpr

Warning

Undocumented in the KiCad file format documentation. Added in 20240108 (KiCad 8).

pts: list[Pts]
kicad_expr_tag_name: ClassVar[Literal['base_line', 'base_line_coupled']] = 'base_line'
class edea.kicad.pcb.__init__.GeneratedBaseLineCoupled(pts: list[~edea.kicad.common.Pts] = <factory>)

Bases: GeneratedBaseLine

Warning

Undocumented in the KiCad file format documentation. Added in 20240108 (KiCad 8).

kicad_expr_tag_name: ClassVar[Literal['base_line', 'base_line_coupled']] = 'base_line_coupled'
class edea.kicad.pcb.__init__.GeneratedOrigin(origin: list[~edea.kicad.common.XY] = <factory>)

Bases: KicadPcbExpr

Warning

Undocumented in the KiCad file format documentation. Added in 20240108 (KiCad 8).

origin: list[XY]
kicad_expr_tag_name: ClassVar[Literal['origin']] = 'origin'
class edea.kicad.pcb.__init__.GeneratedEnd(end: list[~edea.kicad.common.XY] = <factory>)

Bases: KicadPcbExpr

Warning

Undocumented in the KiCad file format documentation. Added in 20240108 (KiCad 8).

end: list[XY]
kicad_expr_tag_name: ClassVar[Literal['end']] = 'end'
class edea.kicad.pcb.__init__.Generated(uuid: ~uuid.UUID = <factory>, type: ~typing.Literal['tuning_pattern'] = 'tuning_pattern', name: str = '', layer: ~typing.Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'] = 'F.Cu', base_line: ~edea.kicad.pcb.__init__.GeneratedBaseLine | None = None, base_line_coupled: ~edea.kicad.pcb.__init__.GeneratedBaseLineCoupled | None = None, corner_radius_percent: float = 0.0, origin: ~edea.kicad.pcb.__init__.GeneratedOrigin = <factory>, end: ~edea.kicad.pcb.__init__.GeneratedEnd = <factory>, initial_side: ~typing.Literal['default', 'right', 'left'] = 'default', last_diff_pair_gap: float = 0.0, last_netname: str = '', last_status: str = '', last_track_width: float = 0.0, last_tuning: str = '', max_amplitude: float = 0.0, min_amplitude: float = 0.0, min_spacing: float = 0.0, override_custom_rules: bool = False, rounded: bool = False, single_sided: bool = False, target_length: float = 0.0, target_length_max: float = 0.0, target_length_min: float = 0.0, target_skew: float = 0.0, target_skew_max: float = 0.0, target_skew_min: float = 0.0, tuning_mode: ~typing.Literal['single', 'diff_pair', 'diff_pair_skew'] = 'single', members: list[~uuid.UUID] = <factory>)

Bases: KicadPcbExpr

Warning

Undocumented in the KiCad file format documentation. Added in 20240108 (KiCad 8).

uuid: UUID
type: Literal['tuning_pattern'] = 'tuning_pattern'
name: str = ''
layer: Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'] = 'F.Cu'
base_line: GeneratedBaseLine | None = None
base_line_coupled: GeneratedBaseLineCoupled | None = None
corner_radius_percent: float = 0.0
origin: GeneratedOrigin
end: GeneratedEnd
initial_side: Literal['default', 'right', 'left'] = 'default'
last_diff_pair_gap: float = 0.0
last_netname: str = ''
last_status: str = ''
last_track_width: float = 0.0
last_tuning: str = ''
max_amplitude: float = 0.0
min_amplitude: float = 0.0
min_spacing: float = 0.0
override_custom_rules: bool = False
rounded: bool = False
single_sided: bool = False
target_length: float = 0.0
target_length_max: float = 0.0
target_length_min: float = 0.0
target_skew: float = 0.0
target_skew_max: float = 0.0
target_skew_min: float = 0.0
tuning_mode: Literal['single', 'diff_pair', 'diff_pair_skew'] = 'single'
members: list[UUID]
kicad_expr_tag_name: ClassVar[Literal['generated']] = 'generated'
class edea.kicad.pcb.__init__.Pcb(version: ~typing.Literal['20240108', '20221018'] = '20240108', generator: str = 'edea', generator_version: str | None = None, uuid: ~uuid.UUID | None = None, general: ~edea.kicad.pcb.__init__.General = <factory>, paper: ~edea.kicad.common.PaperUser | ~edea.kicad.common.PaperStandard = <factory>, title_block: ~edea.kicad.common.TitleBlock | None = None, layers: list[tuple[int, ~typing.Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'], ~typing.Literal['jumper', 'mixed', 'power', 'signal', 'user']] | tuple[int, ~typing.Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'], ~typing.Literal['jumper', 'mixed', 'power', 'signal', 'user'], str]] = <factory>, setup: ~edea.kicad.pcb.__init__.Setup = <factory>, properties: list[~edea.kicad.pcb.common.Property] = <factory>, nets: list[~edea.kicad.pcb.common.Net] = <factory>, footprints: list[~edea.kicad.pcb.footprint.Footprint] = <factory>, zones: list[~edea.kicad.pcb.common.Zone] = <factory>, images: list[~edea.kicad.pcb.common.Image] = <factory>, gr_lines: list[~edea.kicad.pcb.graphics.GraphicalLine] = <factory>, gr_text_items: list[~edea.kicad.pcb.graphics.GraphicalText] = <factory>, gr_text_boxes: list[~edea.kicad.pcb.graphics.GraphicalTextBox] = <factory>, gr_rects: list[~edea.kicad.pcb.graphics.GraphicalRectangle] = <factory>, gr_circles: list[~edea.kicad.pcb.graphics.GraphicalCircle] = <factory>, gr_arcs: list[~edea.kicad.pcb.graphics.GraphicalArc] = <factory>, gr_curves: list[~edea.kicad.pcb.graphics.GraphicalCurve] = <factory>, gr_polys: list[~edea.kicad.pcb.graphics.GraphicalPolygon] = <factory>, beziers: list[~edea.kicad.pcb.graphics.GraphicalBezier] = <factory>, gr_bboxes: list[~edea.kicad.pcb.graphics.GraphicalBoundingBox] = <factory>, dimensions: list[~edea.kicad.pcb.graphics.GraphicalDimension] = <factory>, effects: ~edea.kicad.common.Effects | None = None, segments: list[~edea.kicad.pcb.__init__.Segment] = <factory>, vias: list[~edea.kicad.pcb.__init__.Via] = <factory>, arcs: list[~edea.kicad.pcb.__init__.Arc] = <factory>, groups: list[~edea.kicad.pcb.common.Group] = <factory>, generated: list[~edea.kicad.pcb.__init__.Generated] = <factory>, targets: list[~edea.kicad.pcb.__init__.Target] = <factory>)

Bases: KicadPcbExpr

A KiCad PCB file.

Parameters:
  • version – The version of the PCB file format.

  • generator – The software generator of the PCB file.

  • generator_version – The version of the software generator.

  • uuid – The unique identifier for the PCB file.

  • general – The general settings of the PCB layout.

  • paper – The paper settings for printing the PCB layout.

  • title_block – The title block information for the PCB layout.

  • layers – A list of layers used in the PCB layout.

  • setup – The setup settings for the PCB layout.

  • properties – A list of properties associated with the PCB layout.

  • nets – A list of nets (connections) in the PCB layout.

  • footprints – A list of footprints used in the PCB layout.

  • zones – A list of copper zones in the PCB layout.

  • images – A list of images included in the PCB layout.

  • gr_lines – A list of graphical lines in the PCB layout.

  • gr_text_items – A list of graphical text items in the PCB layout.

  • gr_text_boxes – A list of graphical text boxes in the PCB layout.

  • gr_rects – A list of graphical rectangles in the PCB layout.

  • gr_circles – A list of graphical circles in the PCB layout.

  • gr_arcs – A list of graphical arcs in the PCB layout.

  • gr_curves – A list of graphical curves in the PCB layout.

  • gr_polys – A list of graphical polygons in the PCB layout.

  • beziers – A list of Bezier curves in the PCB layout.

  • gr_bboxes – A list of graphical bounding boxes in the PCB layout.

  • dimensions – A list of graphical dimensions in the PCB layout.

  • effects – The effects settings for the PCB layout.

  • segments – A list of track segments in the PCB layout.

  • vias – A list of vias (connections between layers) in the PCB layout.

  • arcs – A list of arcs in the PCB layout.

  • groups – A list of groups in the PCB layout.

  • generated – A list of generated elements in the PCB layout.

  • targets – A list of targets in the PCB layout.

Variables:

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

Note

The fields generator_version, uuid, effects, and generated were added in 20240108 (KiCad 8).

version: Literal['20240108', '20221018'] = '20240108'
classmethod check_version(v: Any) Literal['20240108', '20221018']

Validator for the ‘version’ field, ensures that only the stable KiCad 7 PCB file format.

Parameters:

v – The version value to validate.

Returns:

The validated version value.

Raises:

VersionError – If an unsupported version is provided.

generator: str = 'edea'
generator_version: str | None = None
uuid: UUID | None = None
general: General
paper: PaperUser | PaperStandard
title_block: TitleBlock | None = None
layers: list[tuple[int, Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'], Literal['jumper', 'mixed', 'power', 'signal', 'user']] | tuple[int, Literal['F.Cu', 'In1.Cu', 'In2.Cu', 'In3.Cu', 'In4.Cu', 'In5.Cu', 'In6.Cu', 'In7.Cu', 'In8.Cu', 'In9.Cu', 'In10.Cu', 'In11.Cu', 'In12.Cu', 'In13.Cu', 'In14.Cu', 'In15.Cu', 'In16.Cu', 'In17.Cu', 'In18.Cu', 'In19.Cu', 'In20.Cu', 'In21.Cu', 'In22.Cu', 'In23.Cu', 'In24.Cu', 'In25.Cu', 'In26.Cu', 'In27.Cu', 'In28.Cu', 'In29.Cu', 'In30.Cu', 'B.Cu', 'B.Adhes', 'F.Adhes', 'B.Paste', 'F.Paste', 'B.SilkS', 'F.SilkS', 'B.Mask', 'F.Mask', 'Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User', 'Edge.Cuts', 'F.CrtYd', 'B.CrtYd', 'F.Fab', 'B.Fab', 'User.1', 'User.2', 'User.3', 'User.4', 'User.5', 'User.6', 'User.7', 'User.8', 'User.9', 'Margin', 'Rescue'], Literal['jumper', 'mixed', 'power', 'signal', 'user'], str]]
setup: Setup
properties: list[Property]
nets: list[Net]
footprints: list[Footprint]
zones: list[Zone]
images: list[Image]
gr_lines: list[GraphicalLine]
gr_text_items: list[GraphicalText]
gr_text_boxes: list[GraphicalTextBox]
gr_rects: list[GraphicalRectangle]
gr_circles: list[GraphicalCircle]
gr_arcs: list[GraphicalArc]
gr_curves: list[GraphicalCurve]
gr_polys: list[GraphicalPolygon]
beziers: list[GraphicalBezier]
gr_bboxes: list[GraphicalBoundingBox]
dimensions: list[GraphicalDimension]
effects: Effects | None = None
segments: list[Segment]
vias: list[Via]
arcs: list[Arc]
groups: list[Group]
generated: list[Generated]
targets: list[Target]
insert_layout(name: str, layout: Pcb, uuid_prefix: UUID | None = None) None

Inserts another PCB layout into this one.

Parameters:
  • name – The name of the layout being inserted.

  • layout – The layout object to be inserted.

  • uuid_prefix – UUID prefix.

size()

Calculates the size (width, height) of the board.

Returns:

The calculated board size.

Raises:
kicad_expr_tag_name: ClassVar[Literal['kicad_pcb']] = 'kicad_pcb'
exception edea.kicad.pcb.__init__.MissingBoardOutlineError

Bases: ValueError

This exception is raised when the PCB layout is missing the board outline information.

This error indicates a critical issue with the PCB data as the board outline defines the physical dimensions of the PCB.