altium monkey v2026.11.26 · gobblerito
On This Page (11)

Multi-Board Systems (Experimental, Read-Only)

altium-monkey provides a read-only, experimental multi-board system stack for inspecting Altium multi-board projects (.PrjMbd), logical system design documents (.MbsDoc), cross-board system netlists, and full system-level C0 compiled designs with schematic graphics.

Because the surface is experimental, import multi-board classes from their submodules rather than the package root. Nothing in these modules writes or mutates files.

Architecture Overview

An Altium multi-board project is a manifest (.PrjMbd) that ties together a logical system design document (.MbsDoc), optional assembly/harness members, and one or more ordinary child board projects (.PrjPcb). Altium itself never builds a single global cross-board netlist; altium-monkey derives it in two stages:

text
  System.PrjMbd (INI manifest) ──▶ AltiumPrjMbd
  System.MbsDoc (ZIP of JSON)  ──▶ AltiumMbsDoc
         │
         ▼  AltiumMultiboardProject.from_file("System.PrjMbd")
  Module resolution (lexically matches each module to a child .PrjPcb)
         │
         ├──▶ project.system_netlist() ──▶ MbsSystemNetlist (V1 JSON + aliases)
         │
         └──▶ AltiumSystem.from_file("System.PrjMbd")
                ├── system.structural_graph   (structural_graph.c0)
                ├── system.compiled_view      (compiled_view.c0 + explain_net)
                ├── system.compilation        (compilation.c0 + realized sources)
                ├── system.fields_for_net() / impacts_for_field()
                └── system.schematic_graphics(page_ref, instance_path=[...])

Five Public Modules

ModuleEntry Point(s)Role
altium_monkey.altium_prjmbdAltiumPrjMbd, PrjMbdMember, PrjMbdMemberKind, PrjMbdPathForm, PrjMbdFileMatchLenient .PrjMbd INI manifest reader, altium_visible contiguous Document1..N selection, path/existence checks, and managed GUID cross-checks
altium_monkey.altium_mbsdocAltiumMbsDoc, MbsObjectRef, MbsModule, MbsConnection, MbsPinPair, MbsContainer, …Lenient .MbsDoc ZIP/JSON reader (format versions 1 & 2) modeling the complete logical.json connectivity graph with json_pointer locators
altium_monkey.altium_multiboardAltiumMultiboardProject, MbsModuleResolution, MultiboardDiagnostic, MultiboardDiagnosticCodeProject facade cross-checking PrjMbd/MbsDoc identity, deterministic module-to-child resolution, and 50 typed diagnostic codes
altium_monkey.altium_multiboard_netlistMbsSystemNetlist, MbsSystemNet, MbsLink, MbsTerminal, MbsNetAlias, load_system_netlist_json, SYSTEM_NETLIST_SCHEMACross-board system netlist with Altium per-link nets, exact child-pin joins, rename-ready alias sources, and versioned altium_monkey.multiboard.system_netlist.v1 JSON
altium_monkey.altium_systemAltiumSystem, AltiumSystemEndpoint, AltiumSystemFieldImpact, AltiumSystemSourceFieldUnified C0 system compilation over retained child AltiumPreparedDesign snapshots, cross-board source-field impact tracing, and system-scoped Paint IR schematic graphics

Quick Start

1. Inspect Project Membership, Resolve Modules & Build the System Netlist

python
from altium_monkey.altium_multiboard import AltiumMultiboardProject
from altium_monkey.altium_multiboard_netlist import load_system_netlist_json

mb = AltiumMultiboardProject.from_file("System.PrjMbd")

# Inspect module-to-child-project resolution (never compiles child boards)
for res in mb.resolve_modules():
    path = res.member.normalized_path if res.member else "<unresolved>"
    print(res.module_ref.full_id, res.status, res.rule, path)

# Compile each resolved child board once and compute cross-board system nets
netlist = mb.system_netlist()
print("Complete:", netlist.connectivity_complete, "Nets:", len(netlist.nets))

for net in netlist.nets_with_alias("SPI_CLK"):
    print(f"System net #{net.index}: names={net.names}")
    for alias in net.aliases:
        print(" ", alias.origin, alias.name, alias.source)

# Serialize and validate as altium_monkey.multiboard.system_netlist.v1 JSON
raw_json = netlist.to_json()
dto = load_system_netlist_json(raw_json)

2. Full C0 System Compilation, Impact Tracing & Scoped Schematic Graphics

python
from altium_monkey.altium_system import AltiumSystem
from altium_monkey.sch_compiled_design.generated import NetOccurrence

system = AltiumSystem.from_file("System.PrjMbd")

# Same C0 compiled-design stack used by single-board AltiumDesign
compilation = system.compilation          # AltiumCompilation (compilation.c0)
view = system.compiled_view               # AltiumCompiledView (compiled_view.c0)
graph = system.structural_graph           # AltiumStructuralGraph (structural_graph.c0)

# Trace every authored schematic field contributing to a system net across all boards
root_def = graph.to_dto().definitions[0]
for net in root_def.nets:
    fields = system.fields_for_net(net.id)
    if fields:
        print(net.id, len(fields), "source fields across boards")
        # See every board occurrence impacted by editing one authored field
        first = fields[0]
        impacts = system.impacts_for_field(first.definition_id, first.source_field)
        print("  impacts:", [(i.module_source_key, i.net_id) for i in impacts])
        break

# Render a child schematic page scoped to one specific board occurrence
first_instance = root_def.instances[0]
child_def = next(
    d for d in compilation.to_dto().definitions if d.id == first_instance.definition_ref
)
page_ref = child_def.schematic.pages[0].id
gfx = system.schematic_graphics(page_ref, instance_path=[first_instance.id])
# gfx.svg (bytes) / gfx.bindings_json (bytes) / gfx.select_occurrence(...)

Key Semantics

Module Resolution Rules

AltiumMultiboardProject.resolve_modules(mapping=None) resolves each module occurrence deterministically without opening or compiling child boards:

  1. The module's sourceProject path matches a .PrjPcb member in .PrjMbd (relative paths resolve against the .MbsDoc folder, matching Altium).
  2. The project name or sourceProject file stem matches exactly one board project member.
  3. An explicit caller mapping maps the module's full_id (or designator) to a member path relative to the .PrjMbd folder.

A GUID alone never resolves a module. Modules without a source are marked not_applicable. system_netlist() runs rules (1) and (2) with no caller mapping so unresolvable modules are reported rather than guessed.

AltiumSystem Composition & Repeated Board Instances

When a single child .PrjPcb backs multiple module occurrences (for example, four identical sensor boards in one system):

Lenient Diagnostics & connectivity_complete

Malformed or partial inputs produce structured MultiboardDiagnostic records (50 catalog codes across info, warning, error, and fatal) rather than exceptions; only unreadable files raise OSError. Always check connectivity_complete on AltiumMbsDoc and MbsSystemNetlist before making completeness-sensitive decisions (such as automated net refactoring).

Read-Only Scope & What Is Not Covered

For shared C0 compilation and cross-board source tracing, see AltiumDesign & Compiled Design, JSON Schemas & TypeSpec, and the runnable multiboard_system_netlist_and_c0 example.

altium-monkey v2026.11.26 · gobblerito·Docs updated 2026.11.29 17:55 UTC (0665053)