kigadgets.item ============== .. py:module:: kigadgets.item .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: kigadgets.item.just_lookups_vcurrent Classes ------- .. autoapisummary:: kigadgets.item.GeoHashable kigadgets.item.BoardItem kigadgets.item.HasPosition kigadgets.item.HasOrientation kigadgets.item.HasLayer kigadgets.item.HasConnection kigadgets.item.Selectable kigadgets.item.HasWidth kigadgets.item.TextEsque Module Contents --------------- .. py:class:: GeoHashable Bases: :py:obj:`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. .. py:method:: geohash() -> int .. py:class:: BoardItem Bases: :py:obj:`GeoHashable` .. autoapi-inheritance-diagram:: kigadgets.item.BoardItem :parts: 1 Base class for all PCB board items. .. py:property:: native_obj :type: Any .. py:property:: board :type: Optional[kigadgets.board.Board] .. py:method:: wrap(instance: Any) -> BoardItem :classmethod: .. py:method:: geohash() -> int .. py:class:: HasPosition Bases: :py:obj:`GeoHashable` .. autoapi-inheritance-diagram:: kigadgets.item.HasPosition :parts: 1 Mixin for board items with position properties. .. py:property:: position :type: kigadgets.Point .. py:property:: x :type: float .. py:property:: y :type: float .. py:method:: geohash() -> int .. py:class:: HasOrientation Bases: :py:obj:`GeoHashable` .. autoapi-inheritance-diagram:: kigadgets.item.HasOrientation :parts: 1 Mixin for board items with orientation properties. .. py:property:: orientation :type: float Rotation of the item in degrees. .. py:method:: geohash() -> int .. py:class:: HasLayer Bases: :py:obj:`GeoHashable` .. autoapi-inheritance-diagram:: kigadgets.item.HasLayer :parts: 1 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. .. py:property:: layer :type: str .. py:method:: geohash() -> int .. py:class:: HasConnection Bases: :py:obj:`GeoHashable` .. autoapi-inheritance-diagram:: kigadgets.item.HasConnection :parts: 1 Mixin for board items with electrical connections. All BoardItems that wrap BOARD_CONNECTED_ITEMs should inherit this. .. py:property:: net_name :type: str .. py:property:: net_code :type: int .. py:method:: geohash() -> int .. py:class:: Selectable Bases: :py:obj:`GeoHashable` .. autoapi-inheritance-diagram:: kigadgets.item.Selectable :parts: 1 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 .. py:property:: is_selected :type: bool .. py:method:: 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.) .. py:method:: deselect() -> None .. py:method:: brighten(value: bool = True) -> None Brightening gives a bright green appearance .. py:method:: geohash() -> int .. py:class:: HasWidth Bases: :py:obj:`GeoHashable` .. autoapi-inheritance-diagram:: kigadgets.item.HasWidth :parts: 1 Mixin for board items with width properties. .. py:property:: width :type: float .. py:method:: geohash() -> int .. py:data:: just_lookups_vcurrent .. py:class:: TextEsque Bases: :py:obj:`GeoHashable` .. autoapi-inheritance-diagram:: kigadgets.item.TextEsque :parts: 1 Base class for items with text-like properties .. note:: Text orientation and object rotation/orientation mean different things .. py:attribute:: justification_lookups .. py:property:: text :type: str .. py:property:: thickness :type: float .. py:property:: mirrored :type: bool .. py:property:: size :type: kigadgets.Size .. py:property:: orientation :type: float Rotation of the item in degrees. .. py:property:: justification :type: Tuple[str, str] .. py:method:: geohash() -> int