via module#

Via definitions#

This module provides classes for defining vias, including via types, backdrill specifications, and via properties.

class Via[source]#

Bases: Positionable

Via definition that can be instantiated in the board. Layer indexes referenced in this definition are absolute in the board: 0 is always the top layer. They are not relative to any component / circuit. Flipping via instances in the UI will not flip those layers, contrary to landpattern pads.

>>> class StandardVia(Via):
...     start = Side.Top
...     stop = Side.Bottom
...     diameter = 0.6
...     diameters = {0: 0.5, 1: ViaDiameter(0.5, nfp=0.2)}
...     hole_diameter = 0.3
...     type = ViaType.MechanicalDrill
type: ClassVar[ViaType]#

MechanicalDrill or LaserDrill.

Type:

Type of via drilling method

start_layer: ClassVar[int]#

Starting layer for the via. Setting this to a layer index other than the top layer allows for creating buried or blind vias.

stop_layer: ClassVar[int]#

Ending layer for the via.

diameter: ClassVar[float | ViaDiameter]#

Pad diameter of the via, in mm. Can be overridden on a per-layer basis by diameters.

diameters: dict[int | tuple[int, ...], float | ViaDiameter] = {}#

Pad diameters of the via for specific layers. Overrides diameter for the given layers.

hole_diameter: ClassVar[float]#

Drilled or laser-cut hole diameter for the via, in mm.

filled: ClassVar[bool] = False#

Whether the via is filled.

tented: ClassVar[set[Side] | Side | None | bool] = True#

Whether the via is tented on Top, Bottom, or both sides. Untented sides will have a solder mask opening.

via_in_pad: ClassVar[bool] = False#

Whether the via is allowed to be placed inside a component’s pads.

backdrill: ClassVar[BackdrillSet | Backdrill | None] = None#

Backdrill specifications. If a Backdrill is used, it will be assumed to be drilled from bottom.

models: ClassVar[dict[tuple[int, int], PinModel]] = {}#

Specifies delay and loss models for the via.

class ViaDiameter(pad, *, nfp=None)[source]#

Diameters of various features of a via.

Parameters:
pad: float#

Pad diameter for the via, in mm.

nfp: float | None = None#

Pad diameter for the via when non-functional pads are removed, in mm. When provided, it overrides the pad diameter except on the start layer if there is no top backdrill, stop layer if there is no bottom backdrill and intermediate copper layers that have traces or pours connected to the via.

class ViaType(*values)[source]#

Bases: Enum

Type of via drilling method.

MechanicalDrill = 1#
LaserDrill = 2#
class Backdrill(diameter, startpad_diameter, solder_mask_opening, copper_clearance)[source]#

Backdrill specification for a via.

Parameters:
diameter: float#

Diameter of the backdrill in mm.

startpad_diameter: float#

Diameter of the starting pad in mm.

solder_mask_opening: float#

Solder mask opening size in mm.

copper_clearance: float#

Copper clearance diameter in mm.

class BackdrillSet(top=None, bottom=None)[source]#

Set of backdrill specifications for top and bottom sides.

Parameters:
top: Backdrill | None = None#

Backdrill specification for the top side.

bottom: Backdrill | None = None#

Backdrill specification for the bottom side.