Module Blocks

Each sub-board appears on the MBS as an SCH_MODULE_BLOCK: a rectangular block whose pins are the connector pins exposed by that board's schematic. Blocks are normally created and refreshed via refresh_from_sub_projects. The methods here let you inspect the result and adjust positions, references, and individual pin attributes.

get_blocks()

Returns every module block on the active MBS sheet.

mbs = kicad.get_mbs_schematic()
blocks = mbs.multi_board.get_blocks()

for b in blocks:
    print(f"{b.mbs_reference} ({b.component_ref}) — {b.display_name}")
    for pin in b.pins:
        print(f"  pin {pin.number}: {pin.label} ({pin.electrical_type})")

Each block carries:

FieldDescription
idKIID of the block
mbs_referenceThe MBS-level designator, e.g. B1
component_refThe connector reference on the source schematic, e.g. J1
sub_project_uuidUUID of the sub-project this block represents
sub_project_pathSub-project path
display_nameHuman-readable label
position, sizeGeometry on the MBS sheet
pinsList of pins (number, label, side, electrical type, id)

update_block(block_uuid, ...)

Move or rename a block.

# Move a block
mbs.multi_board.update_block(
    block_uuid="...",
    position=(150_000_000, 100_000_000),  # nanometers
)

# Change MBS-level reference
mbs.multi_board.update_block(
    block_uuid="...",
    mbs_reference="B3",
)

Returns True if any field changed.

update_pin(pin_uuid, ...)

Update a single MBS module pin's attributes.

from kipy.proto.common.types import base_types_pb2

mbs.multi_board.update_pin(
    pin_uuid="...",
    text="USB_DP",                                  # cross-board net label
    electrical_type=base_types_pb2.EPT_BIDIRECTIONAL,
    side=base_types_pb2.SPS_RIGHT,
    position=(50_000_000, 25_000_000),              # nanometers
)

Pass any subset of text, electrical_type, side, position. Returns True if any attribute changed.

delete_pin(pin_uuid)

Remove a single pin without touching the parent block.

mbs.multi_board.delete_pin(pin_uuid="...")

Returns True if the pin was removed.