padstacks module#

Vias, component pads and the drill files they produce.

Every pad is a flash: 4.10 requires that all pads are flashed and all flashes are pads, so nothing here ever emits a pad as a region, whatever its shape.

Hole sizes pass straight through. Via.hole_diameter and a Cutout’s dimension are the finished hole, which is exactly what a drill file states - XNC 2.3, “the tool diameter is the end (or finished) diameter, after plating” - so the exporter applies no plating allowance in either direction. The fabricator picks the bit. A value compensated here would be compensated twice, which is how holes come back undersize.

Drill TA.AperFunction is the bare function name. Plating is a file attribute by design, which is also why plated and non-plated hits cannot share a file.

A backdrilled via is two files, per 6.6.1: the via itself is drilled to the surface and lands in a plated file spanning the whole drilled depth, and the stub removal lands in a non-plated file spanning only the layers that lose their plating. The via’s own start_layer/stop_layer describe the functional span, not the drilled one.

class NpthHole(x, y, diameter)[source]#

Bases: object

A non-plated round hole: placed center and finished diameter, in mm.

Parameters:
x: float#
y: float#
diameter: float#
class Padstacks(flashes=dict(), pieces=dict(), drills=dict(), profile=list())[source]#

Bases: object

What the via and pad walk produced.

Parameters:
  • flashes (dict[int, list[Flash]]) – per absolute conductor index, in emission order. Flashes go out after every region, so nothing can erase them.

  • pieces (dict[int, list[Piece]]) – pad and via copper in the connectivity graph. They are not in the union: a pad contributes no region geometry, and its own holes live in its aperture, where they are transparent.

  • drills (dict[tuple[int, int, bool], DrillFile]) – one file per (span, plating), keyed so the two can never merge.

  • profile (list[Island]) – pad cutouts of a general shape, placed. 6.6 sends these to the profile layer rather than to a drill file, and the profile file is built before this walk runs, so they are collected here and stroked in afterwards.

flashes: dict[int, list[Flash]]#
pieces: dict[int, list[Piece]]#
drills: dict[tuple[int, int, bool], DrillFile]#
profile: list[Island]#
flash(layer, item)[source]#
Return type:

None

Parameters:
piece(layer, item)[source]#
Return type:

None

Parameters:
build(design, model, nets, npth, components, drill_format=DrillFormat.GERBER, compat=Compat(bake_macro_rotation=False))[source]#

Walk vias and pads into flashes, drill hits and connectivity pieces.

Parameters:
Return type:

Padstacks

pad_attributes(net, pin, layer)[source]#

The object attributes one layer of a pad carries.

.C goes on every layer of a component pad; .P goes only on the copper layer the component sits on. 5.6.15 restricts .P to component layers and the copper layers carrying the components, so the inner-layer rings of a through-hole pad name their net and their component but not a pin - the pin is on the surface, and the ring is not it.

Return type:

tuple[tuple[str, tuple[str, ...]], ...]

Parameters: