Skip to content

feat(ifc): name elements Family:Type:ElementId from partition name entries (RE-38) - #321

Merged
DrunkOnJava merged 2 commits into
mainfrom
feat/element-names-from-records
Sep 23, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
feat/element-names-from-records

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Family instances now carry Revit's own names. Revit 2024/2025 partitions hold a name entry for every loaded family and family type: u64 ElementId · u32 length · UTF-16 name · i64 BuiltInCategory. An element's type is the one reference of its own category that carries an entry, and the type's partition record (RE-35) names its family. The IFC Name becomes Family:Type:ElementId and the ObjectType becomes Family:Type, exactly as in Revit's export.

Motivation

Until now every element was named Class-ElementId (Door-416336). A user opening an rvt-rs IFC or the viewer could not tell a Single-Flush:36" x 84" door from a double slider. The table was found while looking for the "Empty" curtain-panel type behind #309.

Changes

  • src/partition_names.rs (new):
    • find_name_entries anchors on the closing category, then checks a matching length and a declared id; it rejects control characters and unpaired surrogates, and drops an id whose entries disagree;
    • compute_element_names, resolve_type, resolve_family.
  • RevitFile::element_names memoises the table and each type's family candidates.
  • src/partition_schema_mvp.rs: a post-pass gives walls, columns, doors, windows, slabs and products m_type_id / m_type_name / m_family_name when both joins are unique.
  • src/ifc/export_content.rs: the Family:Type:ElementId name, and FamilyName / TypeName in the element-record property set. src/ifc/step_writer.rs: ObjectType = Family:Type from those two properties. No struct change, so the fuzz targets are untouched.
  • tests/element_names.rs (new): every name in that form, and its ObjectType, equals Revit's for the same Tag on Core Interior (2024_Core_Interior_slim.ifc) and the RE1 models. Counts are pinned.
  • examples/probe_re38_names.rs, reports/element-framing/RE-38-family-and-type-names.md, a support-matrix row, README, status, CHANGELOG.

Measurements

file names written equal to Revit's Name and ObjectType different
Core Interior 394 394 0
Snowdon Towers Architectural (local) 3,765 3,693 (the other 72 are not in Revit's export) 0
RE1 Architecture / Mechanical / Plumbing 57 / 36 / 61 56 / 36 / 60 (one each not in Revit's export) 0
teste_export_2025 / Projeto1 (local) 1 / 1 1 / 1 (Projeto1 after decoding STEP escapes) 0

The name table matches the VIM export of Snowdon on every shared id: 348 of 348 on the architectural sample and 57 of 57 on the structural one, name and category. On the structural sample, 1,075 of 1,099 element names equal the VIM's; the other 24 are one type that the VIM's later edition renamed.

Testing

  • tools/check-local.sh
  • Every integration test with the family corpus and the magnetar + RE1 project corpus
  • cargo +1.85.0 check --profile ci --all-targets, cargo +nightly check --manifest-path fuzz/Cargo.toml
  • Unit tests for entry decoding (filler, undeclared ids, out-of-band categories, non-ASCII, control characters), disagreeing entries, unique-only joins, and ids at any offset of a record body
  • Core Interior's export changes only in Name / ObjectType of its 394 family instances and the two new properties

Audit-honesty checklist

  • Scope is stated. System families (walls, floors, roofs, ceilings, stairs, railings, curtain walls) keep Class-ElementId: their type names live in parameter blocks, not in these entries.
  • Names are as stored (a localised template gives localised names).
  • Reproducible probe under examples/

Legal and contribution hygiene

  • Apache-2.0
  • Clean-room: byte observations scored against Revit's own IFC exports and a VIM export; no SDK source or decompiled material. Snowdon, VIM and 255ribeiro oracles are local only.
  • No PII

Breaking changes

IFC element Names change for family instances (Door-416336 becomes Single-Flush:36" x 84":416336), and ObjectType is now set on them. Consumers matching the old Class-ElementId name should use the Tag, which is unchanged.

Related issues

Refs #309.


Note

Medium Risk
IFC Name and ObjectType change for many family instances (breaking for name-based consumers), though behavior is gated on unique type/family resolution and validated against Revit exports.

Overview
Family instances now get Revit-style naming in IFC exports (RE-38). A new partition_names decoder scans Revit 2024/2025 partition bytes for per–ElementId UTF-16 name entries, resolves each placed instance’s type from its reference list and family from the type’s partition record, and exposes the table via memoized RevitFile::element_names.

Decoded walls, doors, windows, columns, slabs, and products gain m_family_name / m_type_name (and type id) when both joins are unique. IFC export then writes Name = Family:Type:ElementId, ObjectType = Family:Type, and adds FamilyName / TypeName on the element-record property set—matching Revit’s exporter on corpus-checked projects. System families still use Class-ElementId.

Adds tests/element_names.rs, examples/probe_re38_names.rs, and doc/support-matrix/CHANGELOG updates. Breaking for IFC consumers that keyed off the old Class-ElementId names; Tag is unchanged.

Reviewed by Cursor Bugbot for commit 311f1f9. Configure here.

…tries (RE-38)

Revit 2024 and 2025 partitions carry a name entry for every loaded family
and family type: u64 ElementId, u32 length, UTF-16 name, i64
BuiltInCategory. An element record's type is the one reference-list id of
its own category that carries an entry, and the type's partition record
(RE-35) names its family the same way.

The IFC Name of such an element becomes Family:Type:ElementId and its
ObjectType Family:Type, as in Revit's own export, and the element-record
property set gains FamilyName and TypeName. All 4,241 names and object
types written across Core Interior, Snowdon Towers, the RE1 models and
teste_export_2025 are exactly Revit's. On Snowdon every name entry the VIM
export also carries has the VIM's name and category (348 of 348). System
families (walls, floors, roofs) keep Class-ElementId names: their types
are not in these entries.

rvt::partition_names and RevitFile::element_names expose the table;
examples/probe_re38_names.rs reports it for any file and
tests/element_names.rs checks every name against Revit's export on Core
Interior and the RE1 models.
@cursor

cursor Bot commented Sep 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_32816fb8-87e6-47e2-a699-5587cf87b3cd)

…mily and type properties

The two new element-record properties (FamilyName, TypeName) on Core
Interior's 394 family instances add 788 IfcPropertySingleValue rows, which
moves the rvt-rs observation hash both OctetProof replays compare. Both
verdicts stay PASS with all three witnesses; only the rvt-rs observation,
its witness version and the verdict hash change.
@DrunkOnJava
DrunkOnJava merged commit 007da04 into main Sep 23, 2026
22 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/element-names-from-records branch September 23, 2026 05:46
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.

1 participant