kigadgets.module

Footprint (module) handling for KiCad PCB components.

This module provides classes for representing PCB footprints, which contain pads, graphical elements, text labels, and electrical connections.

Key features: - Footprint creation from libraries and copying existing footprints - Management of reference designators and component values - Access to pads and graphical items within footprints - Geohashing for layout comparison

Attributes

Module

ModuleLine

ModuleLabel

Classes

FootprintLabel

wrapper for TEXTE_MODULE (old) or FP_TEXT

FootprintLine

Wrapper for EDGE_MODULE (old) or FP_SHAPE

Footprint

Functions

wrap_footprint_item(→ Union[FootprintLine, FootprintLabel])

Module Contents

class kigadgets.module.FootprintLabel

Bases: kigadgets.drawing.TextPCB

digraph inheritance171374dbc4 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BoardItem" [URL="../item/index.html#kigadgets.item.BoardItem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all PCB board items."]; "GeoHashable" -> "BoardItem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FootprintLabel" [URL="#kigadgets.module.FootprintLabel",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="wrapper for `TEXTE_MODULE` (old) or `FP_TEXT`"]; "TextPCB" -> "FootprintLabel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GeoHashable" [URL="../item/index.html#kigadgets.item.GeoHashable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for objects that can be geometrically hashed."]; "HasLayer" [URL="../item/index.html#kigadgets.item.HasLayer",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin for layer handling based on *strings* (like `'F.Cu'`, `'B.Silkscreen'`, `'User.12'`, etc.)."]; "GeoHashable" -> "HasLayer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HasPosition" [URL="../item/index.html#kigadgets.item.HasPosition",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin for board items with position properties."]; "GeoHashable" -> "HasPosition" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Selectable" [URL="../item/index.html#kigadgets.item.Selectable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin for board items that can be selected in the GUI."]; "GeoHashable" -> "Selectable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TextEsque" [URL="../item/index.html#kigadgets.item.TextEsque",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for items with text-like properties"]; "GeoHashable" -> "TextEsque" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TextPCB" [URL="../drawing/index.html#kigadgets.drawing.TextPCB",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "HasLayer" -> "TextPCB" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HasPosition" -> "TextPCB" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Selectable" -> "TextPCB" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BoardItem" -> "TextPCB" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TextEsque" -> "TextPCB" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

wrapper for TEXTE_MODULE (old) or FP_TEXT

property visible: bool
class kigadgets.module.FootprintLine

Bases: kigadgets.item.HasLayer, kigadgets.item.Selectable, kigadgets.item.BoardItem

digraph inheritance804a78188a { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BoardItem" [URL="../item/index.html#kigadgets.item.BoardItem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all PCB board items."]; "GeoHashable" -> "BoardItem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FootprintLine" [URL="#kigadgets.module.FootprintLine",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wrapper for `EDGE_MODULE` (old) or `FP_SHAPE`"]; "HasLayer" -> "FootprintLine" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Selectable" -> "FootprintLine" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BoardItem" -> "FootprintLine" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GeoHashable" [URL="../item/index.html#kigadgets.item.GeoHashable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for objects that can be geometrically hashed."]; "HasLayer" [URL="../item/index.html#kigadgets.item.HasLayer",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin for layer handling based on *strings* (like `'F.Cu'`, `'B.Silkscreen'`, `'User.12'`, etc.)."]; "GeoHashable" -> "HasLayer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Selectable" [URL="../item/index.html#kigadgets.item.Selectable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin for board items that can be selected in the GUI."]; "GeoHashable" -> "Selectable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Wrapper for EDGE_MODULE (old) or FP_SHAPE

kigadgets.module.wrap_footprint_item(item: Any) FootprintLine | FootprintLabel
class kigadgets.module.Footprint(ref: str | None = None, pos: kigadgets.units.CoordinateLike | None = None, board: kigadgets.board.Board | None = None)

Bases: kigadgets.item.HasPosition, kigadgets.item.HasOrientation, kigadgets.item.Selectable, kigadgets.item.BoardItem

digraph inheritance609bc7847e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BoardItem" [URL="../item/index.html#kigadgets.item.BoardItem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all PCB board items."]; "GeoHashable" -> "BoardItem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Footprint" [URL="#kigadgets.module.Footprint",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "HasPosition" -> "Footprint" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HasOrientation" -> "Footprint" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Selectable" -> "Footprint" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BoardItem" -> "Footprint" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GeoHashable" [URL="../item/index.html#kigadgets.item.GeoHashable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for objects that can be geometrically hashed."]; "HasOrientation" [URL="../item/index.html#kigadgets.item.HasOrientation",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin for board items with orientation properties."]; "GeoHashable" -> "HasOrientation" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HasPosition" [URL="../item/index.html#kigadgets.item.HasPosition",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin for board items with position properties."]; "GeoHashable" -> "HasPosition" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Selectable" [URL="../item/index.html#kigadgets.item.Selectable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin for board items that can be selected in the GUI."]; "GeoHashable" -> "Selectable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
static load_from_library(library_path: str, name: str) Footprint | None
property reference: str
property reference_label: FootprintLabel

Caches the wrapped FootprintLabel so that subsequent accesses return the same object.

property value: str
property value_label: FootprintLabel

Caches the wrapped FootprintLabel so that subsequent accesses return the same object.

property graphical_items: List[FootprintLine | FootprintLabel]

Text and drawings of module iterator.

flip() None
property layer: str
property lib_name: str
property fp_name: str
copy(ref: str, pos: kigadgets.units.CoordinateLike | None = None, board: Board | None = None) Footprint

Create a copy of an existing module on the same board A new reference designator is required, example:

mod2 = mod1.copy('U2')
mod2.reference == 'U2'  # True

mod2 is automatically placed in mod1.board

property pads: List[kigadgets.pad.Pad]
remove(element: kigadgets.pad.Pad | FootprintLine | FootprintLabel, permanent: bool = False) None

Makes it so Ctrl-Z works. Keeps a reference to the element in the python pcb object, so it persists for the life of that object

restore_removed() None
geohash() int
kigadgets.module.Module
kigadgets.module.ModuleLine
kigadgets.module.ModuleLabel