KicadModTree.nodes.specialized package

To simpilfy the creation on footprints, we have special classes which are build onto the base nodes. special nodes are converted to base nodes when creating the footprint, and allows us to create much more complex shapes with as little boilerplate code as possible.

KicadModTree.nodes.specialized.PolygoneLine module

class KicadModTree.nodes.specialized.PolygoneLine.PolygoneLine(**kwargs)[source]

Bases: KicadModTree.nodes.Node.Node

Add a Polygone Line to the render tree

Parameters:

**kwargs – See below

Keyword Arguments:
 
  • polygone (list(Point)) – edges of the polygone
  • layer (str) – layer on which the polygone is drawn (default: ‘F.SilkS’)
  • width (float) – width of the line (default: None, which means auto detection)
Example:
>>> from KicadModTree import *
>>> PolygoneLine(polygone=[[0, 0], [0, 1], [1, 1], [0, 0]], layer='F.SilkS')
getVirtualChilds()[source]

Get virtual childs of this node

KicadModTree.nodes.specialized.RectLine module

class KicadModTree.nodes.specialized.RectLine.RectLine(**kwargs)[source]

Bases: KicadModTree.nodes.specialized.PolygoneLine.PolygoneLine

Add a Rect to the render tree

Parameters:

**kwargs – See below

Keyword Arguments:
 
  • start (Vector2D) – start edge of the rect
  • end (Vector2D) – end edge of the rect
  • layer (str) – layer on which the rect is drawn
  • width (float) – width of the outer line (default: None, which means auto detection)
  • offset (Vector2D, float) – offset of the rect line to the specified one
Example:
>>> from KicadModTree import *
>>> RectLine(start=[-3, -2], end=[3, 2], layer='F.SilkS')

KicadModTree.nodes.specialized.RectFill module

class KicadModTree.nodes.specialized.RectFill.RectFill(**kwargs)[source]

Bases: KicadModTree.nodes.Node.Node

Add the filling of a Rect to the render tree

Normally, this class isn’t needed, because FilledRect combines RectLine with RectFill

Parameters:

**kwargs – See below

Keyword Arguments:
 
  • start (Vector2D) – start edge of the rect fill
  • end (Vector2D) – end edge of the rect fill
  • layer (str) – layer on which the rect fill is drawn (default: ‘F.SilkS’)
  • width (float) – width of the filling lines (default: 0.12)
Example:
>>> from KicadModTree import *
>>> RectFill(start=[-3, -2], end=[3, 2], layer='F.SilkS')
getVirtualChilds()[source]

Get virtual childs of this node

KicadModTree.nodes.specialized.FilledRect module

class KicadModTree.nodes.specialized.FilledRect.FilledRect(**kwargs)[source]

Bases: KicadModTree.nodes.Node.Node

Add a Filled Rect to the render tree

Combines RectLine and RectFill into one class for simpler handling

Parameters:

**kwargs – See below

Keyword Arguments:
 
  • start (Vector2D) – start edge of the rect
  • end (Vector2D) – end edge of the rect
  • layer (str) – layer on which the rect is drawn (default: ‘F.SilkS’)
  • width (float) – width of the outer line (default: 0.15)
Example:
>>> from KicadModTree import *
>>> FilledRect(start=[-3, -2], end=[3, 2], layer='F.SilkS')
getVirtualChilds()[source]

Get virtual childs of this node

KicadModTree.nodes.specialized.PadArray module

class KicadModTree.nodes.specialized.PadArray.PadArray(**kwargs)[source]

Bases: KicadModTree.nodes.Node.Node

Add a row of Pads

Simplifies the handling of pads which are rendered in a specific form

Parameters:

**kwargs – See below

Keyword Arguments:
 
  • start (Vector2D) – start edge of the pad array
  • center (Vector2D) – center pad array around specific point
  • pincount (int) – number of pads to render
  • spacing (Vector2D, float) – offset between rendered pads
  • x_spacing (float) – x offset between rendered pads
  • y_spacing (float) – y offset between rendered pads
  • initial (int) – name of the first pad
  • increment (int, function(previous_number)) – declare how the name of the follow up is calculated
  • type (Pad.TYPE_THT, Pad.TYPE_SMT, Pad.TYPE_CONNECT, Pad.TYPE_NPTH) – type of the pad
  • shape (Pad.SHAPE_CIRCLE, Pad.SHAPE_OVAL, Pad.SHAPE_RECT, Pad.SHAPE_TRAPEZE, …) – shape of the pad
  • rotation (float) – rotation of the pad
  • size (float, Vector2D) – size of the pad
  • offset (Vector2D) – offset of the pad
  • drill (float, Vector2D) – drill-size of the pad
  • solder_paste_margin_ratio (float) – solder paste margin ratio of the pad
  • layers (Pad.LAYERS_SMT, Pad.LAYERS_THT, Pad.LAYERS_NPTH) – layers on which are used for the pad
  • chamfer_corner_selection_first ([bool, bool, bool, bool]) Select which corner should be chamfered for the first pad. (default: None)
  • chamfer_corner_selection_last ([bool, bool, bool, bool]) Select which corner should be chamfered for the last pad. (default: None)
  • chamfer_size (float, Vector2D) – size for the chamfer used for the end pads. (default: None)
  • end_pads_size_reduction (dict with keys x-,x+,y-,y+) – size is reduced on the given side. (size reduced plus center moved.)
  • tht_pad1_shape (Pad.SHAPE_RECT, Pad.SHAPE_ROUNDRECT, …) – shape for marking pad 1 for through hole components. (deafult: Pad.SHAPE_ROUNDRECT)
  • tht_pad1_id (int, string) – pad number used for “pin 1” (default: 1)
  • hidden_pins (int, Vector1D) – pin number(s) to be skipped; a footprint with hidden pins has missing pads and matching pin numbers
  • deleted_pins (int, Vector1D) – pin locations(s) to be skipped; a footprint with deleted pins has pads missing but no missing pin numbers”
Example:
>>> from KicadModTree import *
>>> PadArray(pincount=10, spacing=[1,-1], center=[0,0], initial=5, increment=2,
...          type=Pad.TYPE_SMT, shape=Pad.SHAPE_RECT, size=[1,2], layers=Pad.LAYERS_SMT)
getVirtualChilds()[source]

Get virtual childs of this node

KicadModTree.nodes.specialized.Rotation module

class KicadModTree.nodes.specialized.Rotation.Rotation(r)[source]

Bases: KicadModTree.nodes.Node.Node

Apply rotation to the child tree

Parameters:r (float) – angle which the child should rotate
Example:
>>> from KicadModTree import *
>>> Rotation(90)
getRealPosition(coordinate, rotation=None)[source]

return position of point after applying all transformation and rotation operations

KicadModTree.nodes.specialized.Translation module

class KicadModTree.nodes.specialized.Translation.Translation(x, y)[source]

Bases: KicadModTree.nodes.Node.Node

Apply translation to the child tree

Parameters:
  • x (float) – change of x coordinate
  • y (float) – change of y coordinate
Example:
>>> from KicadModTree import *
>>> Translation(1, 2)
getRealPosition(coordinate, rotation=None)[source]

return position of point after applying all transformation and rotation operations