Expand description
openbim-bcf — BIM Collaboration Format (BCF-XML).
§What this is
BCF is the open issue-exchange format of openBIM: a ZIP archive holding one directory per topic, each with a markup document and optionally viewpoints (camera plus component visibility) and snapshot images. It is how findings from a model audit leave one toolchain and land in any BCF-aware reviewer.
let archive = openbim_bcf::read_path("issues.bcfzip")?;
for topic in archive.topics() {
// Status is whatever the file says — see the tolerance section below.
println!("{} [{}]", topic.title(), topic.status().unwrap_or("<unset>"));
}§BCF is two standards
BCF-XML (buildingSMART S1005) is the file container this crate targets. BCF-API (S1006) is a separate REST/JSON service specification for the same domain. They share a data model and nothing else; conflating them is why this crate is not simply named for the file extension. BCF-API is out of scope here and, if implemented, gets its own crate.
§🚨 The reader is tolerant, and that is evidence-based
Measured with scripts/measure-corpus.py over 44 real
third-party archives (Schependomlaan plus four German audit projects) and
the 33 official buildingSMART BCF-XML v3.0 test archives:
| The spec says | The corpus says |
|---|---|
bcf.version declares the version | 21 of 44 third-party archives have none |
project.bcfp describes the project | 0 of 44 third-party archives have one |
TopicStatus comes from an agreed set | free text: Open, OPEN, Offen, Active, ReOpened, In Progress |
TopicType comes from an agreed set | free text: Error, ERROR, formale Prüfung, Sichprüfung, Clash |
A spec-strict reader rejects nearly every file in that corpus — files every
other BIM tool opens without complaint. So this crate rejects only what
cannot be interpreted at all, and keeps status/type strings verbatim
rather than mapping them onto an enum. "Offen" is not a parse failure; it
is what the file says, and normalising it would corrupt a round-trip.
Everything the reader had to tolerate is reported as a
Tolerance diagnostic rather than being swallowed,
so a caller that wants strictness can enforce it with
BcfArchive::diagnostics.
§Version detection
BcfVersion is resolved through openbim_core::Detected, so a caller
can always tell a declared version from an inferred one, and a file whose
bcf.version disagrees with its actual shape yields
Detected::Conflict instead of a
silent pick. This matters: 2.0 and 2.1 differ in where TopicStatus lives
and whether comments nest a back-reference Topic element, and guessing
wrong yields a different document rather than an error.
§Writing is strict
The write module is the reader’s opposite: it refuses every value the
official schemas reject, and produces byte-identical archives for identical
input. It targets BCF 2.1 and 3.0. See its module documentation for what is
written and what is refused.
§Status
Reading, implemented: archive scanning, version detection, tolerant markup reading (topics, comments, viewpoint references, header files, labels), and each viewpoint’s component selection. Not implemented: viewpoint camera, visibility, colouring, and clipping geometry, snapshots as decoded images, and project extensions.
Writing, implemented for 2.1 and 3.0: topics, comments, viewpoints with a
component selection and camera, and 3.0 extensions.xml; validated against
the official XSDs by scripts/validate-written.py. Not implemented: header
files, snapshots, visibility, colouring, document references,
project.bcfp, and writing 2.0.
Read and write support are tracked separately and must never be inferred from one another.
Re-exports§
pub use diagnostic::Diagnostic;pub use diagnostic::Tolerance;
Modules§
- diagnostic
- Non-fatal deviations the reader had to tolerate.
- write
- Writing BCF-XML: strict, deterministic
.bcfzipoutput for 2.1 and 3.0.
Structs§
- BcfArchive
- A BCF archive that has been read.
- Comment
- One comment on a topic.
- Component
- One model element referenced by a viewpoint.
- Header
File - A file referenced by a topic header — the model the issue is about.
- Limits
- Bounds applied while reading an archive.
- Markup
- A parsed BCF markup document: one topic with its comments and viewpoints.
- Topic
- One BCF topic — a single issue.
- View
Point Ref - A viewpoint attached to a topic: the camera and visibility state, plus its snapshot.
- Visualization
- The parts of a
.bcfvviewpoint document this crate reads.
Enums§
- BcfError
- A failure that prevents reading a BCF archive.
- BcfVersion
- A BCF-XML container version.
Functions§
- read_
path - Read a BCF archive from a path, with default
Limits. - read_
path_ with - Read a BCF archive from a path with explicit limits.
- read_
reader - Read a BCF archive from any seekable reader, with default
Limits. - read_
reader_ with - Read a BCF archive from any seekable reader with explicit limits.
- read_
slice - Read a BCF archive from bytes already in memory.
- read_
slice_ with - Read a BCF archive from bytes already in memory, with explicit limits.