Repository navigation
fix(ifc)!: derive generated GlobalIds from identity, not file position (#400) - #402
Merged
Merged
Conversation
#400) Entities Revit's export gives no GlobalId were numbered by their STEP entity index, so adding one profile point renumbered every GlobalId after it: RE-75's curved walls changed the ids of all 147 openings and 6 slab pieces on Snowdon Towers, and 12,409 of its 20,149 GlobalIds. Each is now a SHA-256 of a fixed namespace, the document's Unique Document GUID and the entity's own identity (ElementId and piece, the filling element for an opening, the participants for a relationship), as a version-8 UUID in IFC form. Revit's own GlobalIds are unchanged. Snowdon exported before and after RE-75 now keeps all 20,149 GlobalIds. tools/ifc_globalid_stability.py makes that comparison repeatable. BREAKING CHANGE: every generated GlobalId differs once from v0.2.0's.
Bugbot couldn't run - usage limit reachedBugbot 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_09a5cd9d-1f15-4527-93ab-87a1c41141c3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #400.
What changes
Every GlobalId rvt-rs generates (for entities Revit's export gives none) was
0rvtrs+ the STEP entity index, so any added or removed entity renumbered everything after it. Each is now a SHA-256 over a fixed namespace (rvt-rs ifc GlobalId v1), the document'sUnique Document GUIDfrom BasicFileInfo, and the entity's own identity, as an RFC 9562 version-8 UUID in IFC's 22-character form (revit_global_ids::compress_ifc_guid, the same encoder RE-48 uses).Revit's own GlobalIds (RE-48) are used exactly as before.
RevitGlobalIdsgainsdocument: Option<String>(serde default), filled by the exporter.Evidence (real entry point:
rvt-ifcon a real file)The pair from the issue: Snowdon Towers Architectural (Revit 2024, local only, no licence) exported by builds of 344deb3 and ebba730, i.e. before and after RE-75's curved walls, compared with the new
tools/ifc_globalid_stability.py(products matched by entity + Tag + occurrence).tools/ifc_globalid_stability.py --require-stableexits 1 on the old pair and 0 on the new one. No duplicate GlobalId in the new exports of Core Interior, the four RE1 models or Einhoven.Compatibility
One-time change: every generated GlobalId differs from v0.2.0's. On Snowdon Towers that is the 155 products without a Revit GlobalId (site, building, 147 openings, 6 slab pieces) plus every relationship and property set; the 6,093 products carrying Revit's own GlobalId are unchanged. Anything keyed on the old
0rvtrs…ids needs one re-import. Recorded in CHANGELOG[Unreleased]under Changed.Checks
tools/check-local.sh: passed (fmt, clippy -D warnings, rustdoc -D warnings, 204 test suites).tests/revit_global_ids.rsandtests/level_names.rswithRVT_PROJECT_CORPUS_DIRset (Core Interior + RE1): passed, so Revit's own GlobalIds are untouched.tests/fixtures/synthetic-project.ifcandsynthetic-structural.ifcregenerated withDUMP_IFC/DUMP_IFC_STRUCTURAL; the diff is GlobalIds plus the two header timestamps a dump always rewrites.tools/ci/ifc_schema_arity.pypasses on both (IfcOpenShell 0.8.5).IfcGloballyUniqueId(ifcopenshell.guid.expand).step_writertests: the twomake_guidtests went with the function;step_guids_are_unique_across_entitiesnow checks every rooted entity's GlobalId instead of grepping the removed prefix. No new unit tests.Legal and contribution hygiene
Note
Medium Risk
Breaking change to IFC GlobalId semantics for all rvt-rs–generated entities; downstream tools keyed on old
0rvtrsIDs must re-import, though Revit-native element GlobalIds stay the same.Overview
Breaking IFC export change (#400): Generated GlobalIds no longer use the
0rvtrs+ STEP entity index scheme, which shifted whenever unrelated entities were added or removed. They are now SHA-256–derived from a fixed namespace, the document’s Unique Document GUID (RevitGlobalIds.document), and per-entity identity keys (ElementId/tag + occurrence, opening → filling element, relationships → participants, etc.). Revit-rebuilt GlobalIds (RE-48) are unchanged.The STEP writer assigns these stable IDs across project/site/building, storeys, elements, openings, void/fill chains, property sets, material associations, aggregates, and spatial containment. Fixtures and docs reflect the new IDs;
tools/ifc_globalid_stability.pycompares two exports for stability.One-time migration: Anything keyed on old generated
0rvtrs…IDs (relationships, property sets, openings, etc.) needs a re-import; values differ from v0.2.0 even when geometry is unchanged.Reviewed by Cursor Bugbot for commit ca27bfd. Configure here.