Skip to main content

Module invasm

Module invasm 

Source
Expand description

Autodesk Inventor assemblies (.iam): how often the assembly places each file it references, read from the file descriptor table in the UFRxDoc stream of the compound file.

The format is not documented. This reader only relies on what was verified with 32 real Inventor 2025–2027 assemblies of one project (390 occurrences, 190 referenced files; the counts compared with Inventor’s own API, see docs/src/research/inventor-instance-counts.md):

u32 n, n × UTF-16LE   full path of the referenced file
u32                   kind of the path (0x43 workspace, 0x4d library, …)
u32 m, m × UTF-16LE   workspace or library ("Workspace", "Content Center Files")
u16                   flags
u32 k, k × UTF-16LE   display name (may be empty)
6 × 0
2 × 16 bytes          identifiers
u32
u16 0
u16                   occurrences of the file in this assembly
10 bytes              the next descriptor follows

The stream also keeps copies of the table from earlier saves (with the same or older paths); only the first table counts – the descriptors that follow each other without a gap.

The descriptor counts include suppressed occurrences. Inventor’s BOM leaves those out, and so does this reader: the same stream holds one property record per occurrence, in occurrence order (again followed by copies from earlier saves, so only the first records as many as the descriptors count are read):

01 05 01 00 00 00 05  u32 n, n × UTF-16LE   occurrence name ("Bolt" of "Bolt:3")
4 bytes
01 02 01 00 00 00 02  16 bytes, 4 bytes     identifier
01 07 01 00 00 00 07  u8                    1 = suppressed

The occurrence name is the descriptor’s display name, or the file name without extension when that is empty. Every suppressed record is taken off the count of the one file whose name it carries; a file with only suppressed occurrences counts 0 (still referenced, not in the BOM). When the records do not add up – fewer records than occurrences, a suppressed record whose name fits no file or several – the descriptor counts stay as they are: suppression is not guessed.

Anything that does not fit is skipped, never trusted: a file whose descriptor is not found has no count (not known), it is never guessed.

Constants§

DESCRIPTOR_STREAM
The stream with the file descriptors.

Functions§

file_occurrence_counts
How often an Inventor assembly places each referenced file: (file name, occurrences). None when the file is not a compound file or has no descriptor stream; reads at most max bytes of the stream.
occurrence_counts
The occurrence counts of the first descriptor table in the content of the UFRxDoc stream: (file name, occurrences) in table order, without suppressed occurrences where the occurrence records tell them. A file name that appears twice (two files of that name in different folders) is listed twice.