Repository navigation
fix(ifc): a surface style leaves a transparency it did not read unset instead of writing it opaque (#1820) - #1826
Merged
Merged
Conversation
… instead of writing it opaque (#1820)
Owner
Author
|
Two commits since
The synthetic project is not a Measure model, so the run's rows are unaffected. |
DrunkOnJava
marked this pull request as ready for review
November 12, 2026 21:29
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.
Summary
An IFC surface style no longer writes a transparency of 0, fully opaque, for a material whose colour was read but whose transparency was not.
IfcSurfaceStyleRendering.Transparencyis optional in IFC4, so it is now left unset ($). Closes #1820.Motivation
A material decoded from
Global/Latestreads its colour and its transparency from two separate fields (elements::styling::Material::from_decoded), so the colour can be read without the transparency.step_writerthen wrotemat.transparency.unwrap_or(0.0), a value no file gave. Revit's own export writes the material's own transparency (revit-ifcCategoryUtil). #1818 marks the same casealphaSource: "rvt-rs"in the GLB, and this PR makes the IFC fail closed on it.Changes
src/ifc/step_writer.rs, the material loop: an unread transparency is written$, and a read one as before ({:.6}).changelog.d/fixed/1820-unread-transparency.md.Testing
Unit tests are banned here. The evidence is one Measure run.
The count first. #1818's probe marks each GLB material
fileorrvt-rsfor its colour and its alpha. A model material is markedfile/rvt-rsexactly when its colour was read and its transparency was not, which is the case this PR changes. Run 43291027145 found no such material on any of the 100 models whose probe output it keeps (#1818, comment 6834758003). Its sixracadvshards and the held-out models were not counted.Rows, registered before the run, for one unfiltered Measure of this head against
main. It covers the samples of every year, the BIM4LCA models, the R2025 set,rac_advancedand the held-out models:ifc.sha256and every scorer file equalmain's, or the only lines that differ areIFCSURFACESTYLERENDERINGlines whose second attribute goes from0.000000to$. A model where an export moves is counted, and named unless it is held out, with how many lines moved. That count completes IFC surface styles: a material whose transparency was not read is written fully opaque (0) #1820's.material_colours_vs_ifcis unchanged on every model. It readsTransparency or 0, so an unset value scores as the 0 it replaces. This row checks that the scorer still reads the file.rustfmt --edition 2024 --checkpasses. CI runs the rest of the gate.Result, Measure 43298971854,
7f825b2cagainstmainateaf22753. It covered the samples of every year, the BIM4LCA offices and housing, the R2025 set,rac_advancedand the held-out models (counts only for the held-out ones):ifc.sha256and 101 of 101diagnostics.jsonequalmain's. No measured model has a material whose colour is read and whose transparency is not, so IFC surface styles: a material whose transparency was not read is written fully opaque (0) #1820's count is 0 on the measured corpus. The change is exercised only by the synthetic project, whose concrete now has no transparency read; CI validates its surface style there.areas_across_saves*.material_colours_vs_ifcis unchanged on every model.Since that run, the branch has had a clean merge of
main(75a4b423), the support-matrix line (b2dbabe7) and the synthetic fixture's assertions (d7f740f0). No export path changed, so the run carries.Audit-honesty checklist
changelog.d/<section>/Legal and contribution hygiene
Breaking changes
None to the API. An IFC consumer that required
Transparencyto be set gets$for a material whose transparency rvt-rs did not read. No measured model has one (row 1).Screenshots or output samples
Before:
#46=IFCSURFACESTYLERENDERING(#45,0.000000,$,$,$,$,$,$,.FLAT.);. After, for a material with no transparency read:#46=IFCSURFACESTYLERENDERING(#45,$,$,$,$,$,$,$,.FLAT.);.