Skip to content

docs(examples): three user examples that open a file, list its elements and export it, run in CI (#872) - #904

Merged
DrunkOnJava merged 3 commits into
mainfrom
docs/user-examples
Oct 23, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
docs/user-examples

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Three user examples, basics_inspect, basics_elements and basics_export, that open a Revit file, list its elements and export it. Each runs on the committed synthetic project without arguments, and CI runs all three. Part 2 of #872 ("examples/ separates user examples from research probes, and the README links the user examples").

Motivation

#872, criterion S3 of docs/release-1.0-criteria.md: examples/ held about 180 research programs and no example of ordinary use.

Changes

  • examples/basics_inspect.rs: release, title and last save (metadata::read_metadata), build, stream count and schema class count (RevitFile::summarize_strict).
  • examples/basics_elements.rs: walker::iter_elements, the first five with ElementId and provenance, then a count per class and a total.
  • examples/basics_export.rs: RvtDocExporter::export_with_diagnostics, then model.ifc (write_step), model.glb (gltf::model_to_glb), elements.csv (schedule_csv::elements_csv) and diagnostics.json, into a directory given as the second argument (the system temp directory by default).
  • examples/README.md: the naming. basics_* are the user examples; probe_* and the rest are research and use rvt::research.
  • README.md: the "Use the Rust library" row and the Library surface section link the examples.
  • ci.yml: a "Run the user examples" step after the real-file verification, Linux stable only. It runs all three and fails if basics_export leaves any of its four files missing or empty. tools/check-local.sh mirrors it.
  • CHANGELOG.md: an [Unreleased] entry.

The examples use only stable modules, so they keep working without unstable-research. They call the same entry points as the doctests in #900. That PR's run 39952498538 shows summarize_strict, iter_elements and export_with_diagnostics succeed on the fixture.

Testing

  • tools/check-local.sh passes: not run locally (compute stays on CI runners). CI's build compiles every example on Linux, and the new step runs them.
  • Verified end to end on real Revit files: N/A. The examples run on corpus/tier1/architectural-2024/architectural-2024.rvt, the synthetic fixture. Nothing about extraction changes.
  • IFC exporter: N/A, untouched.
  • Performance: N/A.

Audit-honesty checklist

  • README / docs reflect the current state after this PR
  • No limitation resolved or introduced
  • Commit messages describe what and why
  • No emojis
  • No private paths, personal email addresses, or internal jargon in committed files
  • Reverse-engineering finding: N/A

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87bca055b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/basics_elements.rs Resolved
Comment thread tools/check-local.sh Resolved
Comment thread examples/basics_inspect.rs Resolved
…s, the examples take any path, and CI runs them on Einhoven too
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

A correction to my reply on the basics_elements thread. I said walker::iter_elements does not see the partition element records. That's wrong. After the schema walk and the ArcWalls, it merges partition_schema_mvp::into_elements: levels, materials, rooms, areas, the opening index, and the element records' columns, walls, doors, windows, slabs and other products. I read only the walker's merge comment and didn't follow into_elements.

The change stays as it is. basics_elements lists what an export holds, by IFC type with ElementIds, the view the README describes; the walk and its provenance are shown by iter_elements' doctest in #900. The rest of that reply stands: no committed fixture carries element records, and CI now runs the examples on Einhoven and fails unless they produce elements.

@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 23, 2026 15:21
@DrunkOnJava
DrunkOnJava merged commit 338e43c into main Oct 23, 2026
28 checks passed
@DrunkOnJava
DrunkOnJava deleted the docs/user-examples branch October 23, 2026 16:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f47c22de3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/basics_export.rs
.next()
.map_or_else(|| PathBuf::from(FIXTURE), PathBuf::from);
let out = args.next().map_or_else(
|| std::env::temp_dir().join(format!("rvt-basics-export-{}", std::process::id())),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Create the default export directory securely

On a shared Unix host, this PID-only path is predictable and can already exist: another user can pre-create /tmp/rvt-basics-export-<pid> with a symlink such as model.ifc, after which create_dir_all succeeds and std::fs::write follows the symlink, truncating a file writable by the victim; ordinary PID reuse can also overwrite an earlier export. The follow-up moved the files out of the temp root, but the fresh evidence here is that the replacement is not actually unique or safely created, so use a securely randomized, atomically created temporary directory.

Useful? React with 👍 / 👎.

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

const FIXTURE: &str = "corpus/tier1/architectural-2024/architectural-2024.rvt";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve the fallback fixture from the manifest directory

When any no-argument example is launched from examples/, another workspace subdirectory, or externally with Cargo's documented --manifest-path <PATH> option, the child retains the caller's working directory and this relative path no longer points at the shipped fixture. All three examples use the same fallback while CI always invokes them from the repository root, so their advertised no-argument mode fails in those supported invocation contexts; construct the path from env!("CARGO_MANIFEST_DIR") instead.

Useful? React with 👍 / 👎.

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