Skip to main content

Crate rvt

Crate rvt 

Source
Expand description

§rvt-rs · open reader for Autodesk Revit files

Reads .rvt, .rfa, .rte and .rft files without Revit or any Autodesk component: metadata, previews and the embedded schema of every release from 2016 to 2026, and, on Revit 2024 and 2025 project files, the building itself (typed elements with Revit’s ElementIds, names, types, storeys, materials, layers, GlobalIds and some type parameters), written out as IFC4, glTF or plan SVG.

What it recovers is measured against Revit’s own IFC export of the same file, model by model; it is a reader, not a converter for every model. docs/supported-profile.md and docs/support-matrix.json in the repository say exactly what is read on which input, and every export comes with diagnostics naming what was approximated or left out.

§Read a file’s identity

use rvt::RevitFile;

let mut rf = RevitFile::open("model.rvt")?;
let summary = rf.summarize()?;
println!("Revit {} ({})", summary.version, summary.build.as_deref().unwrap_or("—"));

§List the elements of a Revit 2024 or 2025 project

use rvt::RevitFile;
use rvt::ifc::RvtDocExporter;
use rvt::ifc::entities::IfcEntity;

let mut rf = RevitFile::open("project.rvt")?;
let result = RvtDocExporter.export_with_diagnostics(&mut rf)?;
for entity in &result.model.entities {
    if let IfcEntity::BuildingElement { ifc_type, name, type_guid, .. } = entity {
        // `type_guid` carries the Revit ElementId (the IFC Tag).
        println!("{ifc_type} {name} {}", type_guid.as_deref().unwrap_or("-"));
    }
}
// What was approximated or left out, as the CLI's --diagnostics writes it.
println!("{}", serde_json::to_string_pretty(&result.diagnostics).unwrap());

§Write IFC4 and glTF

use rvt::RevitFile;
use rvt::ifc::{Exporter, RvtDocExporter, gltf::model_to_glb, write_step};

let mut rf = RevitFile::open("project.rvt")?;
let model = RvtDocExporter.export(&mut rf)?;
std::fs::write("project.ifc", write_step(&model))?;
std::fs::write("project.glb", model_to_glb(&model))?;

§Format overview

  • Container: Microsoft Compound File Binary Format 3.0 ([MS-CFB])
  • Compression: truncated-gzip, a 10-byte gzip header followed by raw DEFLATE, and, for the database streams and Formats/Latest, stored in checksum pages that are stripped before inflating (compression::inflate_stream_at).
  • Schema: Formats/Latest declares every serialized class and its fields (formats::parse_schema).
  • Elements: Global/ElemTable declares the ElementIds; each element’s record in the Partitions/* streams carries its category, class, bounding box and references (partition_element_records).

§Module overview

  • reader — RevitFile, the main entry point
  • basic_file_info — version, GUID, build tag, creator path, worksharing text block
  • metadata — metadata::FileMetadata: document identity, readable without loading the whole file
  • part_atom — Atom XML with OmniClass + taxonomies
  • project_information — project-file ProjectInformation ZIP → Atom entry
  • formats — class schema with tags, parents, field types
  • object_graph — document history, string-record extraction
  • elem_table — Global/ElemTable parser
  • partitions — Partitions/NN header + chunk splitter
  • partition_scanner — version-gated generic partition record candidates
  • compression — truncated-gzip decode
  • class_index — fast class-name inventory
  • corpus — cross-version delta analysis
  • identity — document-scoped ElementId / UniqueId contracts (Phase 1)
  • evidence — evidence tiers + research edge ledgers (Phase 1)
  • es_refs — ES reference occurrence locator contracts (Phase 1; no decoder)
  • relations — experimental relation-domain registry + SCC/quarantine stubs
  • capability — honest capability manifest snapshot for doctor/CLI
  • transmission_data — TransmissionData UTF-16LE detect + opportunistic XML/UUID/path extract
  • compound_framing — compound ArcWall 0x0821 marker tokenization (research; no opening decode)
  • writer — byte-preserving OLE round-trip
  • redact — shared PII scrubbers for all CLIs
  • cli — behaviour shared by the shipped CLIs (quiet exit on a closed pipe)
  • ifc — IFC4 / glTF / plan SVG / CSV export and diagnostics
  • error — Error + Result aliases
  • streams — named constants for every invariant OLE stream

§Safety

This crate is read-only for the OLE container and performs no privileged operations. Files are opened via the cfb crate with standard POSIX read semantics. The writer::copy_file function writes a new file at a caller-specified path.

All decompression uses flate2 in safe Rust (miniz_oxide backend by default, no C toolchain required). No unsafe blocks in the public surface.

§License

Apache-2.0. See LICENSE. Not affiliated with Autodesk. “Revit” and related marks are trademarks of Autodesk, Inc.

rvt-rs is intended as a clean-room interoperability implementation. It does not use Autodesk/ODA SDK sources, leaked documentation, or decompiled proprietary implementation code — see CLEANROOM.md for the formal policy on accepted / forbidden sources. Users with specific legal constraints should evaluate the project with their own counsel. Nothing in this crate’s documentation is legal advice.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use reader::RevitFile;

Modules§

arc_wall_record
Raw-byte decoder for ArcWall (tag 0x0191) partition records.
basic_file_info
Parse the BasicFileInfo OLE stream — UTF-16LE metadata every Revit file carries.
capability
Honest capability manifest snapshot (Phase 1 leftovers).
class_index
Extract the class/schema inventory from the Formats/Latest stream.
class_tag_map
Cross-version class-tag lookup (L5B-10).
cli
Behaviour shared by the shipped command-line tools.
compound_framing
Compound ArcWall (0x0821) stamp / marker investigation harness.
compression
Truncated-gzip decompression for Revit streams.
control
Cooperative cancellation and progress reporting for long scans.
corpus
Phase B · Corpus-wide delta inference engine.
elem_table
Global/ElemTable — Revit’s element-id index.
element_record_beam_cuts
Beam bodies on Revit 2023: a beam stops at the face of the column its record names (RE-122).
element_record_column_cuts
Column bodies: the record box is the whole prism, the joined walls cut it.
element_record_level_refs
Level ElementId binding from a partition element record’s counted reference list (#219, RE-27).
element_record_plan_profiles
Plan profiles for sketched elements, from OST_SketchLines partition element records (#31, RE-25).
element_record_storeys
Storey elevations recovered from partition element-record bboxes.
element_record_wall_joins
Wall bodies: the record box is the untrimmed wall, the joins cut it.
elements
Per-class element decoders.
error
es_refs
ES reference occurrence locator contracts (Phase 1).
evidence
Named evidence tiers and lightweight ledgers (Phase 1).
formats
Parse Formats/Latest into a real schema table.
geometry
Geometry primitives and Lane Six recovery helpers.
identity
Document-scoped identity and source-span contracts (Phase 1).
ifc
Layer 5 — IFC export (document-level scaffold).
level_bind
Fail-closed Level ElementId → building-storey index binding.
metadata
Document identity at a glance — the answer to “what is this file?”.
object_graph
Phase D v0 · Object graph deserializer — starter pieces.
parse_mode
Strict vs lossy parse modes + diagnostics.
part_atom
Parse the PartAtom OLE stream — plain Atom-format XML that Autodesk uses to carry family metadata (title, category, taxonomy, links).
partition_arc_walls
Shared partition ArcWall iteration (RE-15 / D20).
partition_beam_axes
Beam location lines from their serialised element data (RE-49).
partition_compound_structure
Host types’ layers and which side of a wall is its exterior (RE-53).
partition_design_options
Design option sets and their primary options (#319, RE-40).
partition_element_records
Partition element-record headers: ElementId + BuiltInCategory + bbox.
partition_element_records_2023
Revit 2023 partition element records (RE-81, #421).
partition_id_objects
Serialised objects keyed by their ElementId, found in one pass.
partition_ifc_export_overrides
Per-element IFC export-type overrides carried in the Revit 2024 partition parameter blocks (#212, RE-22).
partition_instance_transforms
A family instance’s transform, from its own element data (RE-87).
partition_level_records
Revit Level elements recovered from the partition streams (#218, RE-24).
partition_materials
Material shading colours and transparency (RE-53).
partition_name_candidates
Partition UTF-16LE display-name candidates (RE-15 / #86).
partition_names
Family and type names from partition name entries (RE-38).
partition_roof_slopes
Roof edges’ slopes (RE-56).
partition_room_boundaries
Room plan outlines from the faces of each room’s stored solid (RE-101).
partition_room_parameters
Room number / name / host Level from the Revit 2024 partition parameter block a room owns (#90, RE-29).
partition_scanner
Generic partition-stream record scanner (M3-03 / M3-04).
partition_schema_mvp
Schema / partition MVP recovers for production iter_elements.
partition_stairs
Stair and stair-run dimensions from their serialised element data (RE-47).
partition_type_materials
The materials a family type’s geometry uses (#355, RE-82).
partition_type_parameters
Text parameters of element types, stored under their BuiltInParameter (#35, RE-77).
partition_type_records
Revit type records recovered from the partition streams (#88, RE-28).
partitions
Partitions/NN stream — Revit’s bulk BIM content.
project_information
Parse the ProjectInformation OLE stream — project files only.
reader
High-level reader API. Opens a .rvt / .rfa / .rte / .rft file and exposes its streams + parsed metadata.
rect_opening_index
Version-gated decoder for Revit 2024 ArcWallRectOpening 60 B index records (RE-15-09).
redact
Shared redaction helpers — strip PII from free-form strings while preserving surrounding structure so the shape of a finding remains verifiable. Used by every CLI that surfaces user-authored paths or Autodesk-internal identifiers.
relations
Experimental typed-relation domains, SCC condensation, and quarantine.
revit_global_ids
The IFC GlobalId Revit’s own exporter gives an element, rebuilt from the file (RE-48).
round_trip
Round-trip verification harness (WRT-04).
streams
Known OLE stream names in Revit files.
transmission_data
TransmissionData stream — encoding detection + opportunistic extracts.
walker
Layer 5a walker — schema-directed instance reader for ADocument.
wasm
WASM bindings (VW1-01) — JS-callable wrappers around the viewer API.
writer
Write path — round-trip Revit files + stream-level patching.