Skip to content

feat(native): read the native records of Revit 2011 to 2014 - #2306

Open
puzzbobb wants to merge 1 commit into
DrunkOnJava:mainfrom
puzzbobb:feat-pre2015-native-reader
Open

puzzbobb wants to merge 1 commit into
DrunkOnJava:mainfrom
puzzbobb:feat-pre2015-native-reader

Conversation

@puzzbobb

@puzzbobb puzzbobb commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Summary

RE-510. The native record reader, and with it saved parameters, now works on Revit 2011 to 2014 files. Before, it stopped at 2015.

Five things stopped it, each now read:

  • Schema: a schema written before 2014 has no GUID list after a class's fields. schema_registry::parse tries with the lists, then without (as formats::schema_classes already does, RE-259).
  • Element table: before 2015 its IdentifierSource follows a shared-object token (2 on the 2014 file), not u32::MAX. native_index::parse now refuses only a null token.
  • Element: 2011 to 2013 add m_famParamDrivenData; 2008 to 2010 add three helper pointers and m_groupMemberships. decode_base checks the 20 fields of 2014 on by name and order, allows these five besides, and reads such an Element through the graph decoder.
  • Extensible storage: schemas of 2008 to 2011 have no ESSchemaStorage, so the catalogue is empty.
  • Revit 2011 partitions (header word 6) write 2012's segments with no class tag, and in a different field order: flags, size, uncompressed size, count, channel, member, checkback. A word of 0 starts the terminal. native_segments::walk_selected reads that layout.

native_document::FRAMED_RELEASES (2011 to 2027) is what the framing admits. NATIVE_RELEASES (2015 to 2027) stays every other reader's measured default. Only saved parameters (PARAMETER_RELEASES) widen. The reader of parameters named for a property, which the default export uses, does not.

Evidence

  • Nine local files of 2011 to 2014 (closed source, local only, hashes in the report), plus the committed 2013 family fixture:
    • every record group frames as on 2015 to 2017;
    • 98.7 to 99.4% of graphs decode (the rest are mostly VarSketch, as on 2015 to 2017);
    • the Element base decodes on every record.
  • Autodesk's 2013 rac_advanced against its pinned 2015 save: every shared ElementId keeps its class. Through rvt-elements, 59,683 of 59,683 shared saved parameter values are equal. This is the only same-model pair; Autodesk's host has no 2012 to 2014 samples.
  • rvt-elements on the nine files: saved parameters where there were none (694 to 59,707 values a file); all other output identical to main.
  • rvt-ifc default export: identical to main apart from the timestamp on the nine files and on the 2015 and 2019 rac_advanced, the BIM4LCA office and 13_Rooms_Stairs. --revit-property-sets now writes saved parameters on 2011 to 2014 files, which no Revit export here scores.

Not done: Revit 2008 to 2010. Their preamble now reads, but each partition is one gzip member with no record channels, which this reader does not frame.

Tests and checks

  • New tests/pre2015_native_records.rs (corpus=none, on tests/fixtures/families/empty.rfa): 2,858 records, 2,842 graphs, 87 saved parameter values.
  • The integration suite passes with the project, BIM4LCA, R2025 and samples corpora (357).
  • fmt, clippy (--test integration, the probe), rustdoc, MSRV 1.87, measured_numbers, api-doc-ids, readme-matrix, changelog.py check and verify-real-files.sh --check-only pass. clippy --lib stops only on partition_name_candidates.rs (enum_variant_names), which this does not touch and which is already on main.

…r saved parameters (RE-510)

Five things stopped the native reader before Revit 2015:
- a schema of 2008 to 2013 has no GUID list after a class's fields;
- the element table writes its IdentifierSource after a shared-object
  token, not u32::MAX, on 2008 to 2014;
- an Element of 2008 to 2013 has up to five fields 2014 dropped;
- 2008 to 2011 have no extensible storage;
- Revit 2011 writes its partition segments with no class tag.

With them read, every record group of nine local files of 2011 to 2014
frames as on 2015 to 2017, 98.7 to 99.4 per cent of the graphs decode and
the Element base decodes on every record. FRAMED_RELEASES (2011 to 2027)
is what frames; NATIVE_RELEASES stays the readers' measured default, and
only saved parameters widen. On Autodesk's 2013 rac_advanced every one of
the 59,683 values rvt-elements reads that its 2015 save holds is equal.
The default IFC export is unchanged. Revit 2008 to 2010 partitions are
one gzip member with no record channels and stay unread.
@puzzbobb
puzzbobb requested a review from DrunkOnJava as a code owner December 6, 2026 12:34
@DrunkOnJava

Copy link
Copy Markdown
Owner

@puzzbobb, thank you. main's offline checks from the PII guard job pass on your head, and CI is running. 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, the Measure run on a merge of main into your head (a scratch branch here, 4b28cdff; run 47654753006), with the family files: 120 of 120 exports and diagnostics identical, and no scorer moves. The one file of 2011 to 2014 that Measure reads, a 2014 family, doesn't move either, so Measure shows only that it leaves 2015 and later alone. On 2011 to 2014, what CI checks is your tests/pre2015_native_records.rs on the committed 2013 family fixture (empty.rfa), whose two tests ran and passed in the Linux job; the rest rests on your nine local files.

Next, ours: the code read, then a Measure run on the head once main is merged in. #2307 is being measured the same way.

@DrunkOnJava

Copy link
Copy Markdown
Owner

@puzzbobb, the code read of the changes to the eight source files. Three things to change, and three docs asks.

What holds up: decode_base still checks the 20 fields of 2014 on by name and order, setting aside only the five older ones; the element table's identifier source is one value read; the schema is parsed at most twice over the same bytes (your comment's reason only one reading can succeed holds where a class has fields or GUIDs); the 2011 segments are read only where the schema has no SegmentMarker and the header word is 6, and each then goes through the tagged segment's checks (the size floor and flags, a read bounded by the input, the group byte cap) and its checkback, with the terminal held to one storage page; saved parameters alone widen to FRAMED_RELEASES, the other readers keep 2015 on.

To change:

  1. Keep the old checks on the releases that always met them. The identifier source is now accepted when it's anything but 0, and the five older Element fields are set aside, on every release. Before, a 2015 or later file whose source isn't u32::MAX was refused at that test, and an Element of 2014 or later carrying one of the five failed the count of 20; now neither test refuses them. Please keep u32::MAX from 2015 on and the older fields to before 2014, or say why a file of those releases can't carry them.
  2. A hardening case for the 2011 segment reader. Nothing CI holds reaches it: the committed fixture is a 2013 save, and the one family Measure reads is 2014. Hand-made bytes in a hardening target under tests/ (a tagless segment, a bad checkback, a terminal past one page) would put it under test.
  3. One figure, two values: PARAMETER_RELEASES' doc says every one of the 6,262 values both saves hold is equal, a figure RE-510 doesn't give; RE-510 and the status page give 59,683 of 59,683 through rvt-elements. The doc should give RE-510's figure, or say what its 6,262 counts.

Docs asks, which can ride the push with the merge of main:

  1. The full SHA-256 of each local file in RE-510's §1 table, as I asked on feat(params): built-in parameters are named #1962 #2303, in place of the first twelve characters.
  2. The local files by release and kind, not by name, as your RE-259 describes what look like the same files by their per-release counts ("local project", "local files (4)"); your generator-schedule row already does. Are the names public where the files came from? If so, say so and keep them; if not, describing them keeps them out of the tree (they're in this PR's diff either way).
  3. A ## Clean-room section in the description, like the one on feat(params): built-in parameters are named #1962 #2303; RE-510's own sources paragraph would do.

Next, yours: those and the merge of main. Then ours: a Measure run on the merged head. #2307 gets the same read next.

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