landpattern module#
Landpattern and Pad definitions#
This module provides classes for defining component landpatterns, pads, and mappings between ports and pads.
- class Landpattern[source]#
Bases:
PositionableComponent landpattern definition, also known as a footprint, package, or land-pattern.
Defines the pads and associated geometry for the interface between an electrical component and the circuit board.
>>> class ZigZagLandpattern(Landpattern): ... pad1 = MyPad().at(-0.5, 0) ... pad2 = MyPad().at(0.5, 0) ... ... silkscreen = Silkscreen( ... Polyline( ... 0.1, ... [ ... (-0.4, 1), (-0.3, 1.2), (-0.2, 0.8), ... (-0.1, 1.2), (0, 0.8), (0.1, 1.2), ... (0.2, 0.8), (0.3, 1.2), (0.4, 1), ... ] ... ) ... ) ... ... courtyard = Courtyard(rectangle(2, 1))
- class Pad[source]#
Bases:
PositionableClass representing a pad, user code should overload this class in order to create new pad definitions. If the pad contains a
Cutoutit will be interpreted as a through-hole pad, otherwise it will be interpreted as a surface mount pad.>>> class MyPad(Pad): ... shape = Circle(diameter=0.8) ... shapes = { ... (0, 2): Circle(diameter=0.7), ... 1: PadShape(Circle(diameter=0.8), nfp=Circle(diameter=0.4)), ... -1: rectangle(2., 2.), ... } ... ... def __init__(self): ... self.cutout = Cutout(Circle(diameter=0.4) ... self.soldermask = Soldermask(self.shape)
- class PadMapping(entries)[source]#
Bases:
Structural,RefMapping between component ports and landpattern pads.
If no pad mapping is provided, a default mapping will be created that maps ports to pads in declaration order. If a port needs to be mapped to multiple pads, a PadMapping is required.
>>> class MyComponent(Component): ... GND = Power() ... VIN = Power() ... VOUT = Power() ... ... lp = MyLandpattern() ... mappings = PadMapping({ ... GND: [lp.p[1], lp.p[4]], ... VIN: lp.p[3], ... VOUT: lp.p[3], ... })
>>> class MyComponent(Component): ... GND = Power() ... VIN = Power() ... VOUT = Power() ... ... lp = MyLandpattern() ... mappings = PadMapping({ ... GND: lp.p[1], ... VIN: lp.p[2], ... VOUT: lp.p[3], ... })
- Parameters:
entries (Mapping[Port, Pad | Sequence[Pad]] | Iterable[tuple[Port, Pad | Sequence[Pad]]])