Skip to content

fix(ifc): every type object has a GlobalId of its own, so one type read for several symbols no longer repeats the writer's fallback (#1667) - #1668

Merged
DrunkOnJava merged 3 commits into
mainfrom
fix/1667-unique-type-global-ids
Nov 11, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
fix/1667-unique-type-global-ids

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Every type object now has a GlobalId of its own. In the type-object loop of src/ifc/step_writer.rs, a type object that finds no Revit GlobalId left to take gets the writer's fallback gid(&["type", entity_name, tag]) only when no earlier object used it, and otherwise the same fallback with its index; the fallback is entered in used_gids, which it was not. The BIM4LCA office at permit (timber), where one mullion type was written as 7 IfcMemberType objects with one GlobalId (IfcOpenShell flags the 6 repeats), now writes 7 different ones, and its property sets and relationships, which derive theirs from the type's, follow.

Motivation

Closes #1667. The timber permit office is the one Measure model whose export fails IfcOpenShell's validation: validate: findings 24, all IfcRoot.UR1 ("The attribute GlobalId should be unique"): 6 IfcMemberType + 12 IfcPropertySet + 6 IfcRelDefinesByType repeats of the type Rectangular Mullion:150 x 50 mm alumiini maalattu (Tag 1907093). A repeated GlobalId is invalid IFC4, and importers that key objects by GlobalId merge or drop the later ones. The same 24 findings are in every Measure run read since #1650 on both sides, so they are on main.

Changes

  • src/ifc/step_writer.rs: the type-object loop takes Revit's GlobalId when it is unused, else the writer's fallback when it is unused, else the fallback with the type object's index.
  • changelog.d/fixed/1667-unique-type-global-ids.md.

Testing

No unit tests added. Measured end to end on Measure's models (every scorer, samples=true): run 42934767155, this head (main merged in, so the only difference between the two sides is this change) against main. The rows were registered on #1667 before the first run and are judged as registered:

  1. nordic-office-timber-permit: validate reads 0 findings (24 on main), and the six IfcMemberType of Tag 1907093 have six different GlobalIds.
  2. Every other export is byte-identical (ifc.sha256 of the other models does not move), since no other model has a repeated type GlobalId.
  3. The timber permit office keeps every object it wrote: entity counts by class unchanged, only GlobalIds differ.

Result of run 42934767155 (100 models with results on each side), judged as registered:

  1. Holds. nordic-office-timber-permit: validate reads findings 0 (24 on main) and ports_vs_ifc.txt "0 findings, 0 about the port entities". The run keeps no IFC, so "six different GlobalIds" is read as the validator's IfcRoot.UR1 finding no GlobalId repeated anywhere in the file.
  2. Holds. One export moved, nordic-office-timber-permit; the other 99 are byte-identical (ifc.sha256), and no scorer line of any other model changed.
  3. Holds on its substance, with one scorer line I did not foresee. Total entities are 76,041 on both sides, by_ifc_type and the whole diagnostics are identical, and global_ids_vs_ifc (10,511 equal, 9 not in Revit's export) and class_sets_vs_ifc are identical. type_objects_vs_ifc.txt reads "type objects in ours: 1391" on main and 1397 here: it counts distinct GlobalIds, so the +6 is the repeats becoming six further distinct ids, not new objects. That also corrects the issue's count: 7 IfcMemberType shared the GlobalId, and IfcOpenShell flags the 6 repeats. "The type objects' count the same" is true of the objects, not of that line.

The first unfiltered run, 42928822492, compared this change, which then lacked #1647, against newer main, so its other differences were #1647's; this re-run, after merging main, is the one judged. The same-project gates passed on this head (check run of 2026-11-11T01:07:24Z, "pass: 15 samples held to their earlier saves"); the semantic check read NOT MEASURED on it (#1675: the timber office had no dump, fixed by #1677).

  • tools/check-local.sh passes: not run locally (no local builds here); CI runs it
  • Verified end to end on real Revit files: the runs above (BIM4LCA office, Revit 2024, CC BY-SA 4.0, fetched by Measure)
  • If this touches the IFC exporter: the witness verdicts replay or the changed observations are refreshed: Core Interior's GlobalIds are not changed (row 2), so no observation moves
  • If this is a performance change: N/A

Audit-honesty checklist

  • README / docs reflect the current state after this PR: no capability claim changes
  • A user-visible change has its changelog fragment under changelog.d/fixed/
  • No emojis, private paths or personal addresses in committed files

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0
  • No Autodesk proprietary source, decompiled internals or NDA'd SDK content
  • No new test fixtures

Breaking changes

None. A type object that already had a unique GlobalId keeps it; only the repeats change.

…llion types of one GlobalId, 6 of them repeats, not 6 (#1667)

Measure 42934767155 read the count: the scorer's distinct GlobalIds went 1391 to 1397 with the objects unchanged, so 7 type objects shared one GlobalId and IfcOpenShell flagged the 6 repeats.
@DrunkOnJava
DrunkOnJava merged commit 562faeb into main Nov 11, 2026
37 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1667-unique-type-global-ids branch November 11, 2026 01:35
DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
… says so too, so every box has a reason (#1645) (#1669)

## Summary

An element drawn as a record box, a beam's box or a turned box that the
saved-mesh pass did not take as a candidate now has a `SavedMeshRefusal`
of its own: `not_a_candidate: ` and one of `whole_drawn_by_its_parts`,
`no_location`, `no_element_id` or `class_not_in_scope`.
`exported.saved_mesh_refusals` then counts every such box, not only the
candidates whose saved graphics were read. The candidate set is the
same, and no body is drawn differently.

## Motivation

Refs #1645. After #1647, 153 of the BIM4LCA office's 168 box bodies
carried a refusal; the other 15 (14 `IfcStair` and 1 `IfcCurtainWall`,
wholes that their parts draw) said nothing, and the scorer of #1672
lists them as boxes with no reason.

## Changes

- `src/ifc/saved_meshes.rs`: the candidate loop reads each element's
type GUID and location, works out why an element is not a candidate
(`whole_drawn_by_its_parts`, `no_location`, `no_element_id`,
`class_not_in_scope`), and records that as its refusal; the refusals are
applied on the early return too. The candidates are the same elements as
before.
- `src/ifc/export_content.rs`: `SAVED_MESH_NOT_CANDIDATE_PREFIX`.
- `src/ifc/mod.rs`, `docs/export-diagnostics.md`,
`docs/schemas/export-diagnostics.schema.json`: the new refusal text is
documented.
- `changelog.d/changed/1645-saved-mesh-not-candidate.md`.

## Testing

No unit tests added. Measured end to end on Measure's models: the
unfiltered run 42929175797 (every scorer, 100 models with results on
each side, this head against main at 6e58c27). The rows were registered
on #1645 before it (comment of 2026-11-11T00:09:50Z) and are judged as
registered:

1. Holds. On the BIM4LCA office as built `exported.saved_mesh_refusals`
sums to 168, its `bounding_box_bodies` (153 on main), and the 15 are
`not_a_candidate: whole_drawn_by_its_parts`, which accounts for the
whole difference.
2. Holds on the diagnostics, and a sum is not the whole proof. Every
model of Revit 2023 to 2027 sums to at least its box count; the BIM4LCA,
Revit 2025 and RE1 models sum to it exactly except the two terrain
housing files (12 reasons against 11 boxes: the count of box bodies
leaves out the turned boxes and a roof's level block, which the pass
also reads). On the Autodesk samples a sum cannot decide (Snowdon
architectural 518 against 394 boxes), so the per-element read,
registered on #1645 before it ran, is Measure run 42936559329 (the box
scorer of main, #1672, on the head): each model's line must read "N of N
have one" with no `(none)` row. Result: it holds on every model with a
Revit export I named (each reads "N of N have one", no `(none)` row:
housing concrete as built 73 of 73, its terrain file 11 of 11, the four
office files, Revit 2025 stairs 13 and 17, RE1 architecture and
electrical), and it missed as registered on the three Autodesk samples,
which have no Revit export here for the scorer to pair with, so for them
only the sums above are read and nothing shows each box has its reason.
The scorer's 73 against the diagnostics' 74 on the concrete as built is
the boxes whose Tag Revit's export also holds.
3. Holds. The 29 exports that moved are exactly the 29 models whose
counters gained `whole_drawn_by_its_parts` (the 10 BIM4LCA files, the 5
Revit 2025 stair models and 14 of Autodesk's samples); no body, quantity
or property scorer line changed in any model. The only scorer files that
differ are two validation texts of `nordic-office-timber-permit`
(`ports_vs_ifc.txt` 10 lines, `schema.txt` 20), which are identical once
instance numbers are normalised: the added properties shift the numbers
inside its 24 existing `IfcRoot.UR1` findings (#1667, fixed by #1668).

What the data do not exercise: only `whole_drawn_by_its_parts` occurs
(15 on each office file, 7 on each large housing file, 1 on each terrain
file, 1 on each Revit 2025 stair model, 1 to 26 on the Autodesk
samples). `no_location`, `no_element_id` and `class_not_in_scope` occur
in none of the 100 models, so those three branches are covered by
reading the loop, not by a measurement.

- [ ] `tools/check-local.sh` passes: not run locally (no local builds
here); CI runs it
- [x] Verified end to end on real Revit files: the runs above (BIM4LCA,
Revit 2024, CC BY-SA 4.0; Autodesk's samples, counts only)
- [x] If this touches the IFC exporter: the witness verdicts replay or
the changed observations are refreshed: CI's replay decides; the Core
Interior export does not move (it has no box with a new reason)
- [x] If this is a performance change: N/A

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR:
`docs/export-diagnostics.md` and its schema name the new text
- [x] A user-visible change has its changelog fragment under
`changelog.d/changed/`
- [x] No emojis, private paths or personal addresses in committed files

## Legal and contribution hygiene

- [x] I agree this work is licensable under Apache-2.0
- [x] No Autodesk proprietary source, decompiled internals or NDA'd SDK
content
- [x] No new test fixtures

## Breaking changes

None. `exported.saved_mesh_refusals` has more keys (`not_a_candidate:
...`); the schema allows them.
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.

IFC export: the office at permit (timber) writes one mullion type as 6 type objects with one GlobalId (24 IfcRoot.UR1 findings)

1 participant