kigadgets.zone

Zone (copper pour and keepout) handling for KiCad PCB objects.

This module provides classes for representing copper zones and keepout areas, which are used for copper pouring and design rule enforcement.

Key features: - Copper pour zones with customizable clearance and priority - Keepout areas for restricting component placement - Multi-layer zone support with complex polygon shapes - Filled polygon extraction and area calculations

Classes

RuleArea

Zone

Keepout

Module Contents

class kigadgets.zone.RuleArea(coords: List[kigadgets.units.CoordinateLike], name: str = '', layers: List[str] | None = None, board: Board | None = None)

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

digraph inheritance3493bd53e0 { 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)"]; "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."]; "RuleArea" [URL="#kigadgets.zone.RuleArea",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"]; "Selectable" -> "RuleArea" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BoardItem" -> "RuleArea" [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)"]; }
property name: str
property layers: List[str]
classmethod wrap(instance: Any) Zone | Keepout
property layerset: kigadgets.layer.LayerSet

Zones can have multiple layers Changing this layerset will not propagate back to this zone until you set layerset again. Common pattern:

zone.layerset = zone.layerset.add_layer('F.Cu')
property layer: None
classmethod from_polygon(poly: kigadgets.drawing.Polygon, **zkws: Any) RuleArea
to_polygon(layer: str = 'Margin') kigadgets.drawing.Polygon
property is_keepout: bool
class kigadgets.zone.Zone(coords: List[kigadgets.units.CoordinateLike], name: str = '', layers: List[str] | None = None, board: Board | None = None)

Bases: RuleArea, kigadgets.item.HasConnection

digraph inheritance06fc4ac919 { 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)"]; "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."]; "HasConnection" [URL="../item/index.html#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)"]; "RuleArea" [URL="#kigadgets.zone.RuleArea",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"]; "Selectable" -> "RuleArea" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BoardItem" -> "RuleArea" [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)"]; "Zone" [URL="#kigadgets.zone.Zone",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"]; "RuleArea" -> "Zone" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HasConnection" -> "Zone" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
property clearance: float
property priority: int
property min_width: float
property filled_area: float

The area of all poured polygons, not the zone outline polygon Returns in units of square mm

get_fill_polygons() List[kigadgets.drawing.Polygon]

Returns polygons on all layers. The Polygons have corresponding layers

geohash() int
property name: str
property layers: List[str]
classmethod wrap(instance: Any) Zone | Keepout
property layerset: kigadgets.layer.LayerSet

Zones can have multiple layers Changing this layerset will not propagate back to this zone until you set layerset again. Common pattern:

zone.layerset = zone.layerset.add_layer('F.Cu')
property layer: None
classmethod from_polygon(poly: kigadgets.drawing.Polygon, **zkws: Any) RuleArea
to_polygon(layer: str = 'Margin') kigadgets.drawing.Polygon
property is_keepout: bool
class kigadgets.zone.Keepout(coords: List[kigadgets.units.CoordinateLike], name: str = '', layers: List[str] | None = None, board: Board | None = None)

Bases: RuleArea

digraph inheritance55767a8689 { 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)"]; "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."]; "Keepout" [URL="#kigadgets.zone.Keepout",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"]; "RuleArea" -> "Keepout" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RuleArea" [URL="#kigadgets.zone.RuleArea",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"]; "Selectable" -> "RuleArea" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BoardItem" -> "RuleArea" [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)"]; }
property allow: _KeepoutAllowance
geohash() int
property name: str
property layers: List[str]
classmethod wrap(instance: Any) Zone | Keepout
property layerset: kigadgets.layer.LayerSet

Zones can have multiple layers Changing this layerset will not propagate back to this zone until you set layerset again. Common pattern:

zone.layerset = zone.layerset.add_layer('F.Cu')
property layer: None
classmethod from_polygon(poly: kigadgets.drawing.Polygon, **zkws: Any) RuleArea
to_polygon(layer: str = 'Margin') kigadgets.drawing.Polygon
property is_keepout: bool