pads module#

class ShapeAdjustment[source]#

Base class to be used in a PadConfig to specify how to adjust a template shape to generate the shape for a specific feature (cutout, soldermask, paste, etc.).

adjust_shape(shape)[source]#
Return type:

Shape

Parameters:

shape (Shape)

class RelAdj(amount)[source]#

Bases: ShapeAdjustment

Relative Adjustment Amount

This class indicates a relative (proportional) amount to adjust the template shape for a pad by to generate the shape for a specific feature (cutout, soldermask, paste, etc.). A value of 0.0 indicates no adjustment, 1.0 indicates a doubling in size, -0.5 indicates a halving in size.

Parameters:

amount (float)

amount: float#

Relative adjustment amount

adjust_shape(shape)[source]#

Adjust the shape by this relative adjustment amount

Parameters:

shape (Shape) – the shape to adjust

Return type:

Shape

Returns:

The adjusted shape

make_feature_shape(template, config)[source]#

Make a feature shape from a template and a pad feature configuration

This function is used to create the shapes for the soldermask, paste, and cutout features of a pad.

Parameters:
  • template (Shape | None) – the template shape to use

  • config (TypeAliasType) – the configuration to use

Return type:

Shape | None

Returns:

The feature shape

smaller_shape(a, b)[source]#

Return the shape with the smaller bounding box area

This function is used to determine the smaller of two shapes based on their bounding box area. If either shape is None, the other shape is returned. If both shapes are None, None is returned.

Parameters:
  • a (Shape | None) – the first shape, or None

  • b (Shape | None) – the second shape, or None

Return type:

Shape | None

Returns:

The shape with the smaller bounding box area, or None if both shapes are None

copper_contains_cutout(copper, cutout)[source]#

Check if a copper shape contains a cutout shape

This function checks if a copper shape contains a cutout shape. If the cutout shape is None or an empty shape, this function returns True. If the copper shape is None or an empty shape, this function returns False.

Parameters:
Return type:

bool

Returns:

True if the copper shape contains the cutout shape, False otherwise

class SMDPad(copper, *, soldermask=Ellipsis, paste=Ellipsis)[source]#

Bases: Pad

SMD Pad

This class creates an SMD landpattern pad. By default, the soldermask shape is the copper shape expanded by the current design soldermask registration amount. The paste shape is the smaller of the copper and soldermask shapes.

Parameters:
  • copper (Shape)

  • soldermask (PadFeatureConfig | EllipsisType)

  • paste (PadFeatureConfig | EllipsisType)

soldermask: Soldermask | None = None#

The soldermask shape for the pad

paste: Paste | None = None#

The paste shape for the pad

class THPad(copper, cutout, *, soldermask=Ellipsis, paste=None)[source]#

Bases: Pad

Through-Hole Pad

This class creates a through-hole landpattern pad. By default, the soldermask shape is the copper shape expanded by the current design soldermask registration amount, and no paste is generated.

Parameters:
  • copper (Shape)

  • cutout (Shape)

  • soldermask (PadFeatureConfig | EllipsisType)

  • paste (PadFeatureConfig)

cutout: Cutout | None = None#

The cutout shape for the pad

soldermask: Soldermask | None = None#

The soldermask shape for the top side of the pad

soldermask_bottom: Soldermask | None = None#

The soldermask shape for the bottom side of the pad

paste: Paste | None = None#

The paste shape for the pad

class NPTHPad(cutout, *, soldermask=Ellipsis)[source]#

Bases: Composite

Non-Plated Through-Hole “Pad”

This class creates a non-plated through-hole landpattern object. Since Pad implies a possible connection with a Port and requires a copper shape, this class is not actually a Pad, but rather a subclass of Composite instead and will just generate a hole in the landpattern that can’t be connected.

Parameters:
cutout: Cutout#

The cutout shape for the pad

soldermask: Soldermask | None = None#

The soldermask shape for the top side of the pad

soldermask_bottom: Soldermask | None = None#

The soldermask shape for the bottom side of the pad

class PadConfig[source]#

Pad Configuration

This abstract class defines an interface for classes to specify how pads should be constructed from a template shape.

make_pad(template)[source]#
Return type:

Pad

Parameters:

template (Shape)

class SMDPadConfig(copper=Ellipsis, soldermask=Ellipsis, paste=Ellipsis)[source]#

Bases: PadConfig

SMD Pad Configuration

This class specifies how the feature shapes for an SMD pad should be constructed from a template shape. The default behaviors are: - copper = match template - soldermask = expand template by the design soldermask registration amount - paste = smaller of copper or soldermask

Parameters:
  • copper (PadFeatureConfig | EllipsisType)

  • soldermask (PadFeatureConfig | EllipsisType)

  • paste (PadFeatureConfig | EllipsisType)

copper: TypeAliasType | EllipsisType = Ellipsis#

The copper shape configuration

soldermask: TypeAliasType | EllipsisType = Ellipsis#

The soldermask shape configuration

paste: TypeAliasType | EllipsisType = Ellipsis#

The paste shape configuration

make_pad(template)[source]#

Make an SMD pad from a template shape

Parameters:

template (Shape) – the template shape

Return type:

SMDPad

Returns:

The SMD pad

class THPadConfig(copper=Ellipsis, cutout=Ellipsis, soldermask=Ellipsis, paste=Ellipsis)[source]#

Bases: PadConfig

Through-Hole Pad Configuration

This class specifies how the feature shapes for a through-hole pad should be constructed from a template shape. The default behaviors are: - copper = match template - cutout = match template - soldermask = expand copper by the design soldermask registration amount - paste = do not generate

Parameters:
  • copper (PadFeatureConfig | EllipsisType)

  • cutout (PadFeatureConfig | EllipsisType)

  • soldermask (PadFeatureConfig | EllipsisType)

  • paste (PadFeatureConfig | EllipsisType)

copper: TypeAliasType | EllipsisType = Ellipsis#

The copper shape configuration

cutout: TypeAliasType | EllipsisType = Ellipsis#

The cutout shape configuration

soldermask: TypeAliasType | EllipsisType = Ellipsis#

The soldermask shape configuration

paste: TypeAliasType | EllipsisType = Ellipsis#

The paste shape configuration

make_pad(template)[source]#

Make a through-hole pad from a template shape

Parameters:

template (Shape) – the template shape

Return type:

THPad

Returns:

The through-hole pad

class IPCTHPadConfig(copper=Ellipsis, cutout=Ellipsis, soldermask=Ellipsis, paste=Ellipsis, density_level=Ellipsis)[source]#

Bases: PadConfig

IPC Through-Hole Pad Configuration

This class uses the IPC-2222 standard for calculating through-hole pad and hole sizes based on the lead diameter. The default behaviors are: - copper = based on IPC-2222 - cutout = based on IPC-2222 - soldermask = expand copper by the design soldermask registration amount - paste = do not generate

Parameters:
  • copper (PadFeatureConfig | EllipsisType)

  • cutout (PadFeatureConfig | EllipsisType)

  • soldermask (PadFeatureConfig | EllipsisType)

  • paste (PadFeatureConfig | EllipsisType)

  • density_level (DensityLevel | EllipsisType)

copper: TypeAliasType | EllipsisType = Ellipsis#

The copper shape configuration

cutout: TypeAliasType | EllipsisType = Ellipsis#

The cutout shape configuration

soldermask: TypeAliasType | EllipsisType = Ellipsis#

The soldermask shape configuration

paste: TypeAliasType | EllipsisType = Ellipsis#

The paste shape configuration

density_level: DensityLevel | EllipsisType = Ellipsis#

The density level to use for IPC calculations

make_pad(template)[source]#

Make an IPC through-hole pad from a template shape

Parameters:

template (Shape) – the template shape

Return type:

THPad

Returns:

The IPC through-hole pad

class ThroughHolePadConfigurationContext(min_outer_layer_pad_size=0.2032, max_hole_size_tolerance=0.0508, min_hole_size_tolerance=0.0508, hole_position_tolerance=0.0508, hole_to_lead_tolerance=<factory>)[source]#

Bases: Context

Configuration for through-hole pad generation. The default values can be overridden by declaring this context in your design hierarchy; the values will then be used for anything generated beneath that point.

>>> class MyCircuit(Circuit):
...     th_settings = ThroughHolePadConfigurationContext(
...         min_outer_layer_pad_size=0.4
...     )
Parameters:
min_outer_layer_pad_size: float = 0.2032#

The minimum size of a circular pad on the outer layers

max_hole_size_tolerance: float = 0.0508#

The tolerance on the diameter of a hole of the largest size

min_hole_size_tolerance: float = 0.0508#

The tolerance on the diameter of a hole of the smallest size

hole_position_tolerance: float = 0.0508#

The tolerance on placing any hole

hole_to_lead_tolerance: Mapping[DensityLevel, tuple[float, float]]#

IPC 2222 Table 9-3

classmethod get()[source]#

Get the current active context of this type.

Return type:

ThroughHolePadConfigurationContext

Returns:

The current context instance, or None if not set.

compute_hole_diameter(lead_diameter, density_level)[source]#

Compute the hole diameter for a through-hole pad based on IPC 2222 rules.

Parameters:
  • lead_diameter (Toleranced) – Size of the lead for this hole. This should be the overall diameter of the lead, ie, for a square lead this diameter is the diagonal measurement of the square.

  • density_level (DensityLevel) – IPC density level for board manufacturing

Return type:

float

Returns:

The hole diameter in mm.

class THPadAdjustment[source]#

Bases: ShapeAdjustment

Adjustment Amount for Through-Hole Pads given the hole shape as template, and can be used as a THPadConfig copper adjustment, in particular if IPCTHPadConfig is not appropriate.

>>> THPadConfig(copper=THPadAdjustment())
adjust_shape(shape)[source]#
Return type:

Shape

Parameters:

shape (Shape)

compute_pad_diameter(hole_diameter)[source]#

Compute the pad diameter for a through-hole pad based on IPC 2222 rules.

Parameters:

hole_diameter (float) – Size of the hole for this pad.

Return type:

float

Returns:

The pad diameter in mm.

compute_hole_and_pad_diameters(lead_diameter, density_level)[source]#

Compute the hole and pad diameters for a through-hole pad based on IPC 2222 rules.

Parameters:
  • lead_diameter (Toleranced) – Size of the lead for this hole. This should be the overall diameter of the lead, ie, for a square lead this diameter is the diagonal measurement of the square.

  • density_level (DensityLevel) – IPC density level for board manufacturing

Return type:

tuple[float, float]

Returns:

A tuple of (hole diameter, pad diameter) in mm.

class PadConfigurationMixin[source]#
pad_config(pad_config)[source]#
Return type:

Self

Parameters:

pad_config (PadConfig)

class GridPadShapeGenerator[source]#
pad_shape(pos)[source]#
Return type:

Shape

Parameters:

pos (GridPosition)

class FixedPadShapeGenerator(shape)[source]#

Bases: GridPadShapeGenerator

Parameters:

shape (Shape)

pad_shape(pos)[source]#
Return type:

Shape

Parameters:

pos (GridPosition)

class PadShapeProvider[source]#

Sub-classes of this can be mixed in to provide a pad shape override for a specific grid position. It is not intended to be used for all pads, use a pad shape generator through GridPadShapeGeneratorMixin for that.

class GridPadShapeGeneratorMixin[source]#

Bases: PadConfigurationMixin, PadShapeProvider, GridLayoutInterface

pad_shape_generator(pad_shape_generator)[source]#

Use a generator to create pad shapes based on grid position

Return type:

Self

Parameters:

pad_shape_generator (GridPadShapeGenerator)

pad_shape(shape)[source]#

Set a fixed pad shape for all pads in the landpattern

Return type:

Self

Parameters:

shape (Shape)

class ThermalPadGeneratorMixin[source]#

Bases: PadConfigurationMixin, LandpatternProvider

Mixin to allow adding a separate thermal pad to the landpattern

thermal_pads: list[Pad]#

The generated thermal pad. It can be referenced in a jitx.landpattern.PadMapping to map a port to it.

thermal_pad(shape, config=None)[source]#

Set the thermal pad for the landpattern, with optional configuration to control the pad features.

Parameters:
  • shape (Shape) – The shape of the thermal pad

  • config (SMDPadConfig | None) – Optional configuration to control the pad features. If not provided, the default SMDPadConfig will be used.

Return type:

Self

class WindowSubdivide(padding=0.25, gridShape=(2, 2))[source]#

Bases: ShapeAdjustment

This class generates a windowed grid adjustment to a pad shape, ideal for paste applications. For example, you might use this for generating a large thermal pad for a QFN where you do not want the entire pad to be covered in paste.

Parameters:
padding: float | tuple[float, float] = 0.25#

Pad distance between copper and window edge

Sets the buffer distance between window openings and between the edge of copper to the window opening. If this is a tuple, the first element is the horizontal buffer distance and the second element is the vertical buffer distance. The default is 0.25.

gridShape: tuple[int, int] = (2, 2)#

Window grid dimensions

Dimensions of the grid of window openings. By default this uses a 2 x 2 grid.

generate_window(w, h)[source]#

Generate the window opening shape.

By default, this generates a rectangle.

Parameters:
  • w (float) – width of the window

  • h (float) – height of the window

Return type:

Shape

Returns:

The window opening shape

adjust_shape(shape)[source]#

Generate the paste application

Parameters:
  • copper – shape of the copper pad that this paste will be applied to

  • shape (Shape)

Return type:

Shape

Returns:

The paste application shape