kigadgets.item

Base classes and mixins for KiCad PCB objects using wrapper pattern.

This module implements property-like access to KiCad’s native SWIG object methods. Mixin classes (position, connections, etc.) provide reusable, modular, composable functionality

Key Components: - GeoHashable: Base class for geometric comparison and testing - BoardItem: Wrapper foundation for all PCB objects - Mixins: HasPosition, HasConnection, HasLayer, Selectable, TextEsque

Attributes

just_lookups_vcurrent

Classes

GeoHashable

Base class for objects that can be geometrically hashed.

BoardItem

Base class for all PCB board items.

HasPosition

Mixin for board items with position properties.

HasOrientation

Mixin for board items with orientation properties.

HasLayer

Mixin for layer handling based on strings (like 'F.Cu', 'B.Silkscreen', 'User.12', etc.).

HasConnection

Mixin for board items with electrical connections.

Selectable

Mixin for board items that can be selected in the GUI.

HasWidth

Mixin for board items with width properties.

TextEsque

Base class for items with text-like properties

Module Contents

class kigadgets.item.GeoHashable

Bases: object

Base class for objects that can be geometrically hashed.

A geohash is a hash of the geometric properties of an object. It is used to compare two objects for geometric equality, independent of non-geometric properties like iteration order of traces. Any tiny design change will result in a substantially different geohash.

Equivalence testing is essential for regression testing, versioning, and ensuring design integrity. KiCAD PCB formats do not guarantee binary equivalence of identical designs, even within a major version. Geohashing guarantees design equivalence, within and across KiCAD versions, enabling reliable change detection.

geohash() int
class kigadgets.item.BoardItem

Bases: GeoHashable

digraph inheritance2582a021a4 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BoardItem" [URL="#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)"]; "GeoHashable" [URL="#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."]; }

Base class for all PCB board items.

property native_obj: Any
property board: kigadgets.board.Board | None
classmethod wrap(instance: Any) BoardItem
geohash() int
class kigadgets.item.HasPosition

Bases: GeoHashable

digraph inheritancea6d6624bba { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeoHashable" [URL="#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."]; "HasPosition" [URL="#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)"]; }

Mixin for board items with position properties.

property position: kigadgets.Point
property x: float
property y: float
geohash() int
class kigadgets.item.HasOrientation

Bases: GeoHashable

digraph inheritance0bd58e3b7d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeoHashable" [URL="#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="#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)"]; }

Mixin for board items with orientation properties.

property orientation: float

Rotation of the item in degrees.

geohash() int
class kigadgets.item.HasLayer

Bases: GeoHashable

digraph inheritance9418adeb0e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeoHashable" [URL="#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="#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)"]; }

Mixin for layer handling based on strings (like ‘F.Cu’, ‘B.Silkscreen’, ‘User.12’, etc.). If the layer is not present, it will be caught at runtime, rather than disallowed.

property layer: str
geohash() int
class kigadgets.item.HasConnection

Bases: GeoHashable

digraph inheritance95e4da8945 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeoHashable" [URL="#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."]; "HasConnection" [URL="#kigadgets.item.HasConnection",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 electrical connections."]; "GeoHashable" -> "HasConnection" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Mixin for board items with electrical connections. All BoardItems that wrap BOARD_CONNECTED_ITEMs should inherit this.

property net_name: str
property net_code: int
geohash() int
class kigadgets.item.Selectable

Bases: GeoHashable

digraph inheritance950f0e98d6 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeoHashable" [URL="#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."]; "Selectable" [URL="#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)"]; }

Mixin for board items that can be selected in the GUI. Selection influences the main window. Make sure to pcbnew.Refresh() to see the effects

property is_selected: bool
select(value: bool = True) None

Selecting changes the appearance and also plays a role in determining what will be the subject of a subsequent command (delete, move to layer, etc.)

deselect() None
brighten(value: bool = True) None

Brightening gives a bright green appearance

geohash() int
class kigadgets.item.HasWidth

Bases: GeoHashable

digraph inheritancec58c678c0b { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeoHashable" [URL="#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."]; "HasWidth" [URL="#kigadgets.item.HasWidth",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 width properties."]; "GeoHashable" -> "HasWidth" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Mixin for board items with width properties.

property width: float
geohash() int
kigadgets.item.just_lookups_vcurrent
class kigadgets.item.TextEsque

Bases: GeoHashable

digraph inheritance2e0f861988 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeoHashable" [URL="#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."]; "TextEsque" [URL="#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)"]; }

Base class for items with text-like properties

Note

Text orientation and object rotation/orientation mean different things

justification_lookups
property text: str
property thickness: float
property mirrored: bool
property size: kigadgets.Size
property orientation: float

Rotation of the item in degrees.

property justification: Tuple[str, str]
geohash() int