KicadModTree.nodes.base package¶
Those nodes represent the primitives which we can use to create footprints. They are 1:1 mappings to the corresponding types used in .kicad_mod files.
KicadModTree.nodes.base.Arc module¶
-
class
KicadModTree.nodes.base.Arc.Arc(**kwargs)[source]¶ Bases:
KicadModTree.nodes.Node.Node,KicadModTree.util.geometric_util.geometricArcAdd an Arc to the render tree
Parameters: **kwargs – See below
Keyword Arguments: - geometry (
geometricArc) alternative to using geometric parameters - center (
Vector2D) – center of arc - start (
Vector2D) – start point of arc - midpoint (
Vector2D) – alternative to start point point is on arc and defines point of equal distance to both arc ends arcs of this form are given as midpoint, center plus angle - end (
Vector2D) – alternative to angle arcs of this form are given as start, end and center - angle (
float) – angle of arc - layer (
str) – layer on which the arc is drawn (default: ‘F.SilkS’) - width (
float) – width of the arc line (default: None, which means auto detection)
Example: >>> from KicadModTree import * >>> Arc(center=[0, 0], start=[-1, 0], angle=180, layer='F.SilkS')
- geometry (
KicadModTree.nodes.base.Circle module¶
-
class
KicadModTree.nodes.base.Circle.Circle(**kwargs)[source]¶ Bases:
KicadModTree.nodes.Node.Node,KicadModTree.util.geometric_util.geometricCircleAdd a Circle to the render tree
Parameters: **kwargs – See below
Keyword Arguments: - center (
Vector2D) – center of the circle - radius (
float) – radius of the circle - layer (
str) – layer on which the circle is drawn (default: ‘F.SilkS’) - width (
float) – width of the circle line (default: None, which means auto detection)
Example: >>> from KicadModTree import * >>> Circle(center=[0, 0], radius=1.5, layer='F.SilkS')
-
cut(*other)[source]¶ cut line with given other element
Params: - other (
Line,Circle,Arc) - cut the element on any intersection with the given geometric element
- other (
- center (
KicadModTree.nodes.base.Line module¶
-
class
KicadModTree.nodes.base.Line.Line(**kwargs)[source]¶ Bases:
KicadModTree.nodes.Node.Node,KicadModTree.util.geometric_util.geometricLineAdd a Line to the render tree
Parameters: **kwargs – See below
Keyword Arguments: - start (
Vector2D) – start point of the line - end (
Vector2D) – end point of the line - layer (
str) – layer on which the line is drawn (default: ‘F.SilkS’) - width (
float) – width of the line (default: None, which means auto detection)
Example: >>> from KicadModTree import * >>> Line(start=[1, 0], end=[-1, 0], layer='F.SilkS')
- start (
KicadModTree.nodes.base.Model module¶
-
class
KicadModTree.nodes.base.Model.Model(**kwargs)[source]¶ Bases:
KicadModTree.nodes.Node.NodeAdd a 3D-Model to the render tree
Parameters: **kwargs – See below
Keyword Arguments: - filename (
str) – name of the 3d-model file - at (
Vector3D) – position of the model (default: [0, 0, 0]) - scale (
Vector3D) – scale of the model (default: [1, 1, 1]) - rotate (
Vector3D) – rotation of the model (default: [0, 0, 0])
Example: >>> from KicadModTree import * >>> Model(filename="example.3dshapes/example_footprint.wrl", ... at=[0, 0, 0], scale=[1, 1, 1], rotate=[0, 0, 0])
- filename (
KicadModTree.nodes.base.Pad module¶
-
class
KicadModTree.nodes.base.Pad.Pad(**kwargs)[source]¶ Bases:
KicadModTree.nodes.Node.NodeAdd a Pad to the render tree
Parameters: **kwargs – See below
Keyword Arguments: - number (
int,str) – number/name of the pad (default: “”) - 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,SHAPE_ROUNDRECT,
Pad.SHAPE_TRAPEZE,SHAPE_CUSTOM) –shape of the pad
- layers (
Pad.LAYERS_SMT,Pad.LAYERS_THT,Pad.LAYERS_NPTH) – layers on which are used for the pad - at (
Vector2D) – center position 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 - radius_ratio (
float) – The radius ratio of the rounded rectangle. Ignored for every shape except round rect. - maximum_radius (
float) – The maximum radius for the rounded rectangle. If the radius produced by the radius_ratio parameter for the pad would exceed the maximum radius, the ratio is reduced to limit the radius. (This is useful for IPC-7351C compliance as it suggests 25% ratio with limit 0.25mm) Ignored for every shape except round rect. - round_radius_exact (
float) – Set an exact round radius for a pad. Ignored for every shape except round rect - round_radius_handler (
RoundRadiusHandler) – An instance of the RoundRadiusHandler class If this is given then all other round radius specifiers are ignored Ignored for every shape except round rect - solder_paste_margin_ratio (
float) – solder paste margin ratio of the pad (default: 0) - solder_paste_margin (
float) – solder paste margin of the pad (default: 0) - solder_mask_margin (
float) – solder mask margin of the pad (default: 0) - x_mirror (
[int, float](mirror offset)) – mirror x direction around offset “point” - y_mirror (
[int, float](mirror offset)) – mirror y direction around offset “point”
Example: >>> from KicadModTree import * >>> Pad(number=1, type=Pad.TYPE_THT, shape=Pad.SHAPE_RECT, ... at=[0, 0], size=[2, 2], drill=1.2, layers=Pad.LAYERS_THT)
- number (
-
class
KicadModTree.nodes.base.Pad.RoundRadiusHandler(**kwargs)[source]¶ Bases:
objectHandles round radius setting of a pad
Parameters: **kwargs – See below Keyword Arguments: - radius_ratio (
float [0 <= r <= 0.5]) – The radius ratio of the rounded rectangle. (default set by default_radius_ratio) - maximum_radius (
float) – The maximum radius for the rounded rectangle. If the radius produced by the radius_ratio parameter for the pad would exceed the maximum radius, the ratio is reduced to limit the radius. (This is useful for IPC-7351C compliance as it suggests 25% ratio with limit 0.25mm) - round_radius_exact (
float) – Set an exact round radius for a pad. - default_radius_ratio (
float [0 <= r <= 0.5]) – This parameter allows to set the default radius ratio (backwards compatibility option for chamfered pads)
-
getRadiusRatio(shortest_sidelength)[source]¶ get the resulting round radius ratio
Parameters: shortest_sidelength – shortest sidelength of a pad Returns: the resulting round radius ratio to be used for the pad
- radius_ratio (
KicadModTree.nodes.base.Polygon module¶
-
class
KicadModTree.nodes.base.Polygon.Polygon(**kwargs)[source]¶ Bases:
KicadModTree.nodes.Node.NodeAdd a Polygon to the render tree
Parameters: **kwargs – See below
Keyword Arguments: - polygon (
list(Point)) – outer nodes of the polygon - layer (
str) – layer on which the line is drawn (default: ‘F.SilkS’) - width (
float) – width of the line (default: None, which means auto detection) - x_mirror (
[int, float](mirror offset)) – mirror x direction around offset “point” - y_mirror (
[int, float](mirror offset)) – mirror y direction around offset “point”
Example: >>> from KicadModTree import * >>> Polygon(nodes=[[-2, 0], [0, -2], [4, 0], [0, 2]], layer='F.SilkS')
-
cut(other)[source]¶ Cut other polygon from this polygon
More details see PolygonPoints.cut docstring.
Parameters: other – the other polygon
- polygon (
KicadModTree.nodes.base.Text module¶
-
class
KicadModTree.nodes.base.Text.Text(**kwargs)[source]¶ Bases:
KicadModTree.nodes.Node.NodeAdd a Line to the render tree
Parameters: **kwargs – See below
Keyword Arguments: - type (
str) – type of text - text (
str) – text which is been visualized - at (
Vector2D) – position of text - rotation (
float) – rotation of text (default: 0) - mirror (
bool) – mirror text (default: False) - layer (
str) – layer on which the text is drawn (default: ‘F.SilkS’) - size (
Vector2D) – size of the text (default: [1, 1]) - thickness (
float) – thickness of the text (default: 0.15) - hide (
bool) – hide text (default: False)
Example: >>> from KicadModTree import * >>> Text(type='reference', text='REF**', at=[0, -3], layer='F.SilkS') >>> Text(type='value', text="footprint name", at=[0, 3], layer='F.Fab') >>> Text(type='user', text='test', at=[0, 0], layer='Cmts.User')
- type (