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

Asset & Library Extraction

High-level inspection and extraction workflows let automation preview what is inside an Altium document or library, filter by asset kind, compute content hashes, and extract exactly one selected item — without writing temporary bulk directories or manipulating raw OLE streams.

Choosing An Extraction Surface

WorkflowAPISourcesOutput
Unified selectable inventory (symbols, footprints, models, fonts, opaque payloads)source.asset_inventory(...) + source.extract_asset(ref)AltiumPcbDoc, AltiumPcbLib, AltiumSchDoc, AltiumSchLibSingle-item AltiumPcbLib / AltiumSchLib or payload bytes (altium_monkey.extractable_assets.a0)
Focused PCB binary inventory (3D models, embedded fonts, opaque streams only)source.embedded_asset_inventory(...) + get_embedded_*_payload(index)AltiumPcbDoc, AltiumPcbLibPayload bytes (altium_monkey.pcb.embedded_assets.a0)
Library split / mergeAltiumSchLib.split(...) / merge(...), AltiumPcbLib.split(...)AltiumSchLib, AltiumPcbLibSplit per-entry libraries or combined library
Bulk extraction from documentsschdoc.extract_schlib(...) / extract_symbols(...), pcbdoc.extract_pcblib(...), schdoc.extract_embedded_images(...)AltiumSchDoc, AltiumPcbDocCombined or split libraries and decoded images
Integrated library unpackingAltiumIntLib.from_file(...).IntLibEmbedded .SchLib, .PcbLib, and model streams

Unified Extractable Assets (asset_inventory)

Use asset_inventory(...) and extract_asset(...) when a tool needs to preview or select one item from a document or library:

python
inventory = source.asset_inventory(include_hashes=True)
footprint = next(
    (item for item in inventory.by_kind("pcb_footprint") if item.can_extract),
    None,
)
if footprint is None:
    raise RuntimeError("no extractable footprint found")
extracted = source.extract_asset(footprint.ref)
extracted.pcblib.save(extracted.filename)

For schematic symbols from a .SchDoc or .SchLib:

python
symbol = next(
    (item for item in schdoc.asset_inventory().by_kind("sch_symbol") if item.can_extract),
    None,
)
if symbol is None:
    raise RuntimeError("no extractable schematic symbol found")
single_symbol = schdoc.extract_asset(symbol.ref)
single_symbol.schlib.save("selected_symbol.SchLib")

Inventory Types & Asset Kinds

  1. AltiumAssetInventory: source kind, source path, and asset summaries.
  2. AltiumAssetSummary: display name, extractability flags, optional payload SHA-256 hash, typed details, and one AltiumAssetRef.
  3. AltiumAssetRef: source-local selection handle returned by the inventory.
  4. AltiumExtractedAsset: result for one selected asset (pcblib, schlib, or payload bytes plus suggested filename).

Supported asset kinds and typed detail models:

KindPayloadTyped Details Class
embedded_modelDecompressed 3D model bytesEmbeddedModelAssetDetails (format, id, sizes, embedded flag, PCB references)
embedded_fontDecompressed PcbDoc TrueType font bytesEmbeddedFontAssetDetails (style, sizes, support status)
opaque_embeddedPreserved raw stream bytesOpaqueEmbeddedAssetDetails (raw size, support status, reason)
pcb_footprintSingle-footprint AltiumPcbLibPcbFootprintAssetDetails (pattern, occurrence, source library, components, pad/primitive counts)
sch_symbolSingle-symbol AltiumSchLibSchSymbolAssetDetails (display names, selected designator, library identity, pin/object/part counts)

sch_image is reserved in the in-process vocabulary for future schematic image inventory work and is not part of the A0 JSON schema. Use asset.details for consumer logic; asset.extras is reserved for non-contract annotations and is always {} in A0 JSON.

Reference Durability & Hashes

Focused Embedded PCB Assets (embedded_asset_inventory)

Use AltiumPcbDoc.embedded_asset_inventory(...) or AltiumPcbLib.embedded_asset_inventory(...) when a tool only needs PCB binary payload metadata (preview, dedupe, import dry-run) without enumerating logical footprints or symbols:

python
inventory = pcbdoc.embedded_asset_inventory(include_hashes=True)

for model in inventory.models:
    print(model.extraction_filename, model.payload_available, model.payload_sha256)

model = next((item for item in inventory.models if item.payload_available), None)
if model is None:
    raise RuntimeError("no available embedded model payload found")
payload = pcbdoc.get_embedded_model_payload(model.index)

Key guarantees:

Runnable Examples

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