On This Page (11)
- Architecture Overview
- Five Public Modules
- Quick Start
- 1. Inspect Project Membership, Resolve Modules & Build the System Netlist
- 2. Full C0 System Compilation, Impact Tracing & Scoped Schematic Graphics
- Key Semantics
- Module Resolution Rules
- System Nets vs. Altium Per-Link Nets
- AltiumSystem Composition & Repeated Board Instances
- Lenient Diagnostics & connectivity_complete
- Read-Only Scope & What Is Not Covered
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:
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
| Module | Entry Point(s) | Role |
|---|---|---|
altium_monkey.altium_prjmbd | AltiumPrjMbd, PrjMbdMember, PrjMbdMemberKind, PrjMbdPathForm, PrjMbdFileMatch | Lenient .PrjMbd INI manifest reader, altium_visible contiguous Document1..N selection, path/existence checks, and managed GUID cross-checks |
altium_monkey.altium_mbsdoc | AltiumMbsDoc, 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_multiboard | AltiumMultiboardProject, MbsModuleResolution, MultiboardDiagnostic, MultiboardDiagnosticCode | Project facade cross-checking PrjMbd/MbsDoc identity, deterministic module-to-child resolution, and 50 typed diagnostic codes |
altium_monkey.altium_multiboard_netlist | MbsSystemNetlist, MbsSystemNet, MbsLink, MbsTerminal, MbsNetAlias, load_system_netlist_json, SYSTEM_NETLIST_SCHEMA | Cross-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_system | AltiumSystem, AltiumSystemEndpoint, AltiumSystemFieldImpact, AltiumSystemSourceField | Unified 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
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
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:
- The module's
sourceProjectpath matches a.PrjPcbmember in.PrjMbd(relative paths resolve against the.MbsDocfolder, matching Altium). - The project name or
sourceProjectfile stem matches exactly one board project member. - An explicit caller
mappingmaps the module'sfull_id(or designator) to a member path relative to the.PrjMbdfolder.
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.
System Nets vs. Altium Per-Link Nets
- Per-link nets (
netlist.links): Altium compiles one net per pin pair (named by its defined name, or else its pins' runtimeExternalNetNamevalues joined with/in stored order, resolving harness far-end names iteratively with cycle detection). - Cross-board system nets (
netlist.nets):altium-monkeycomputes connected components across board-to-board links, harness internal conductors, and compiled child nets joined by exact pin matches. Equal net names alone never merge nets, and unequal net names on an explicit link stay connected. - Exact child-pin joins: System components pair with child connectors (
System=Connectorfirst; unmarked orSystem=Blockconnectors still pair by stored IDs with achild_connector_unmarkedwarning), and system pins pair 1-to-1 with child pins by unique ID (SourceId/PinUniqueId) with no name or pin-number fallback. - Rename-ready aliases (
net.aliases): Every alias identifies its exact authoring target:MbsLinkAliasSource— link defined or derived nameMbsTerminalAliasSource— system pin storedExternalNetNamesnapshotMbsChildNetAliasSource— compiled child netMbsChildContributorAliasSource— child net label, port, or power port withdocument_pathandobject_unique_id
AltiumSystem Composition & Repeated Board Instances
When a single child .PrjPcb backs multiple module occurrences (for example, four identical sensor boards in one system):
AltiumSystemcompiles each unique child.PrjPcbonce and retains itsAltiumPreparedDesignsnapshot — subsequentcompilation,compiled_view, andschematic_graphics(...)calls never recompile or reread files from disk.system.structural_graphkeeps both cross-board nets and every board's internal child nets distinct per module occurrence.system.impacts_for_field(definition_id, source_field)reports every module occurrence affected when editing a single shared schematic sheet.system.schematic_graphics(realized_page_ref, instance_path=[instance_id])scopespaint_bindings.c0hit-testing to that exact board occurrence so clicks on repeated boards never confuse sibling instances.
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
- No file writes: Writing or editing
.PrjMbd,.MbsDoc, or.MbaDocfiles is out of scope (useMbsObjectRef.full_idandjson_pointerif your tool owns edits). - No
.MbaDoc3D assembly parsing:.PrjMbdverifies assembly member existence and multiplicity, butgeometry.bin, STEP, C3D, and XBF payloads are not decoded. - No
.MbsDocdrawing rendering: Drawing pages are listed inAltiumMbsDoc.containeronly;logical.jsonis the connectivity authority. - No harness/drawing sub-project parsing:
.PrjHar,.WirDoc,.LdrDoc,.HarDwf,.MbDwf, and.PrjMbdStructureare inventoried as members only. - No system ERC or automated renaming: The netlist and
AltiumSystemexpose the exact edit targets and diagnostics; downstream tools own ERC and write-back.
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.