Skip to content

(Feat) #1189 read family files - #2304

Open
puzzbobb wants to merge 2 commits into
DrunkOnJava:mainfrom
puzzbobb:feat-1189-family-files
Open

puzzbobb wants to merge 2 commits into
DrunkOnJava:mainfrom
puzzbobb:feat-1189-family-files

Conversation

@puzzbobb

@puzzbobb puzzbobb commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of #1189 (W3: types and parameters; geometry not touched). RE-508.

  • A family's own types, read from its records. They are not the family's FamilySymbol records, which are its nested families' types. They are the FamilyTypeTable of the family's own Family record (the one no FamilySurrogate names, with an empty m_name). Its m_pairs hold one {name, params} per type, with the slots in PartAtom's order, plus a blank entry that copies the saved type; in a family with no named type, that blank entry is its one type, which PartAtom names after the family. research::native_family_types reads the table and names each value by the family's definitions, with SI lengths, and material and nested-type names. elements::parameters::family_types_lossy gives the types as JSON, and rvt-info lists them as family_type_records beside the PartAtom table (summary.schema.json updated).
  • Family files are no longer refused by the native preamble. Every Autodesk family of 2016 to 2027 failed with invalid increment episode range. The table opens with the template's increments, which count no episode and forward to the first stored increment, and one of them has a greatest episode below its predecessor's. Such rows are accepted only where they forward alike, so routing is unchanged. A route is now bounded by the table's length instead of 128 (a 2015 template chains 236 redirects).

Measured

tools/re/family_types_vs_partatom.py checks the record types against each family's PartAtom table, on 23 family files of 2015 to 2027. These are the phi-ag samples for 2016 to 2026 and, local only, Autodesk's 2027 sample, a 2015 family template, four 2020 families and six 2025 families.

  • All 59 types PartAtom lists are read.
  • All 279 compared values are equal at PartAtom's precision.
  • 8 voltages are not compared, since no electrical unit is converted.
  • 194 values are not read: 178 built-ins and 16 electrical values whose definitions give no storage type.

tests/family_types.rs (corpus=samples) holds every release 2016 to 2027 to this.

rvt-ifc output is identical to main's, apart from the timestamp, on all 28 family and template files read. rvt-elements now gives the sample families' elements their saved parameters, where each said saved-parameters-unread before.

Not done: built-in slots, Revit's export of a family placed in a project (which W3 asks for), and geometry. W3 stays failed.

Clean-room

The changes in this PR are based on public byte observations of the files above and on the PartAtom text Revit writes into each family (CLEANROOM.md source 1). I have not used Autodesk SDK source, ODA SDK source, leaked internal documentation, NDA material, or decompiled internal Revit implementation code beyond public symbol exports, and I have not copied or translated code from revit-ifc.

Checks

These pass locally:

  • cargo fmt --check
  • clippy -D warnings on the lib and bins (all features), the integration tests and the new probes
  • rustdoc -D warnings
  • cargo +1.87 check
  • the full integration suite with the samples, project, R2025 and BIM4LCA corpora: 356 passed
  • changelog.py check, api-doc-ids.py, readme-matrix.py --check and measured_numbers.py

…read from its records, and family files are no longer refused by the native reader (DrunkOnJava#1189) (RE-508)

A family's types are not its FamilySymbol records, which are its nested
families' types, but the FamilyTypeTable of its own Family record (the
one no FamilySurrogate names, with an empty m_name): one {name, params}
entry per type, the slots in PartAtom's order, and a blank entry copying
the saved type, or, in a family with no named type, being its one type.
native_family_types reads it, names each value by the family's
definitions with its SI value, and rvt-info lists the types as
family_type_records (elements::parameters::family_types_lossy).

On Autodesk's sample family of every release 2016 to 2027 and, local
only, 11 more families and templates of 2015, 2020 and 2025, all 59
types PartAtom lists are read and all 279 values compared equal it
(tools/re/family_types_vs_partatom.py, tests/family_types.rs). Built-in
slots are not read.

The native preamble refused every Autodesk family with "invalid
increment episode range": its increment table opens with the template's
increments, which count no episode and forward to the first stored one.
They are accepted where they forward alike, and a route is bounded by
the table's length rather than 128 (a 2015 template chains 236). A
family's elements now get their saved parameters; no IFC changes on the
28 family and template files read.
A project's every record is more than a small machine holds; with a
filter, the census now selects only the classes it matches.
@puzzbobb
puzzbobb requested a review from DrunkOnJava as a code owner December 6, 2026 12:33
@DrunkOnJava

Copy link
Copy Markdown
Owner

@puzzbobb, thank you. As you describe it, this reads a family's own types from its FamilyTypeTable and gets family files past the native preamble, two long-standing gaps on #1189.

CI is running, and main's offline checks from the PII guard job pass on your head. Next, ours: a read of the change and a full Measure run on its head, with what it shows posted here.

@DrunkOnJava

Copy link
Copy Markdown
Owner

@puzzbobb, one more thing: this branch predates today's framing changes on main (#2295, #2298), so the same-project check can't pass on its head as it stands. A merge of main into the branch (not a rebase) fixes that.

@DrunkOnJava

Copy link
Copy Markdown
Owner

@puzzbobb, what the measurements show so far, before the code read, on a merge of main into your head (a scratch branch here, dad6445b), with the family files (run 47650857319):

  • Every export is unchanged: 120 of 120, the sample projects of 2015 to 2027 included, so the preamble change moves no project file's output.
  • Diagnostics move only on the 12 Autodesk families of 2016 to 2027, and on each only by losing the "phases could not be read (invalid increment episode range)" warning.
  • rvt-info gains family_type_records on 18 of the 19 family files, with nothing removed. Against each file's own PartAtom table:
    • the 12 Autodesk families: 3 of 3 types, and 15 of PartAtom's 18 values equal (lengths to 0.005 mm, materials by name); the other 3 are each type's Default Elevation, a built-in the records don't read;
    • the six bim4gib families: the one type, Reference, named in the family's own table as PartAtom names it; PartAtom's one value for it, Default Elevation, isn't read either.
    • The 2014 family is unchanged: its 112 PartAtom types are before the 2015 where the native reader starts.

Nothing stands in the way from these, beyond the merge of main. Next, ours: the code read, then a Measure run on the merged head.

@DrunkOnJava

Copy link
Copy Markdown
Owner

@puzzbobb, the code read, and one correction to my earlier comment: on 2016 to 2019 PartAtom lists 15 values per file, and all 15 are equal; 15 of 18, with Default Elevation not read, is 2020 to 2027.

Nothing to change in the code:

  • The reader fails closed: a file with no Family record of its own, or two, gets no types, and a blank entry stands in for a type only where no type is named. Its unguarded reads are safe: a decoded graph always holds its root object, and a missing field reads as null.
  • The preamble: a route still moves only forward, so it visits each increment row at most once, linear in the table as the scan that starts it already was. A row that counts no episode passes only where it forwards, and a row below an earlier one only where both forward to the same increment, so routing is the same whichever is taken.
  • family_types_lossy returns JSON entries and a family-types-unread warning the way saved_parameters_lossy does, and tests/family_types.rs ran and passed in CI with the sample families.

Two asks, both docs only:

  1. The support-matrix entry says Revit 2015 to 2027. By RE-508's table, 2015 rests on one local template (Metric_Casework.rft), whose three values aren't read. The note should say so, or start at 2016.
  2. The full SHA-256 of each local file in RE-508's table, in place of the first twelve characters, as RE-65 gives its local files, so anyone holding a copy can tell it's the same file.

Next, yours: the merge of main and those two. Then ours: a Measure run on the merged head, with the family files.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants