Creating a blind or buried via with pcbnew's Python API

Published on September 19, 2026 by leZ

Turn a regular through via into a blind or buried via, restricted to certain inner layers, by script — with pcbnew or KiCad's IPC API.

The via creation tutorial creates a through via, drilled all the way across the board. On a multi-layer board, a blind via (from an outer layer to an inner one) or a buried via (between two inner layers only) saves routing density without drilling through the whole thickness.

Choosing the via type and its layer pair

SetViaType changes the type, then SetLayerPair sets the two layers the via is drilled between:

from pcbnew import PCB_VIA, VIATYPE_BLIND_BURIED, VECTOR2I, FromMM, F_Cu, In1_Cu

via = PCB_VIA(board)
via.SetPosition(VECTOR2I(FromMM(30), FromMM(20)))
via.SetViaType(VIATYPE_BLIND_BURIED)
via.SetLayerPair(F_Cu, In1_Cu)  # blind: from an outer layer to an inner one
board.Add(via)

Same idea, with dedicated properties for the type and the layer pair:

from kicad.geometry import Vector2

via = board.create_via()
via.position = Vector2.from_mm(30, 20)
via.via_type = "blind_buried"
via.layer_pair = ("F.Cu", "In1.Cu")
board.update_items(via)

Try it below: switch the type to see the via’s cross-section change based on which layers it spans.

via.SetViaType(VIATYPE_THROUGH)
via.SetLayerPair(F_Cu, B_Cu)
F.CuIn1.CuIn2.CuB.Cu

Going further

A buried via (between two inner layers, never reaching F.Cu or B.Cu) follows the exact same principle: just pick a pair of inner layers, for example In1_Cu/In2_Cu. These via types usually require a specific layer stackup and a fabricator that supports them — check fabrication rules before relying on them heavily.