Repository navigation
fix(ifc): declare the SI units every value is written in (#403) - #411
Merged
Merged
Conversation
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_b6556a90-f794-487e-8fcc-39b1994cac9d) |
The writer writes lengths in metres, areas and volumes in square and cubic metres, angles in radians and masses in kilograms, but the unit assignment declared millimetres when a model carried no units, so IfcOpenShell read the synthetic fixture's 20 ft wall as 6 mm long; and on real files it declared Revit's display units (square inches, cubic inches, degrees, pounds on Snowdon Towers). The assignment is now always metre, square metre, cubic metre, radian, kilogram and second. Revit's display units stay in the export diagnostics.
DrunkOnJava
force-pushed
the
fix/ifc-si-unit-assignment
branch
from
September 27, 2026 19:32
1e735c8 to
3685061
Compare
… unit set (#403) The IFC no longer writes Revit's display units as conversion-based units, so its entity counts lose four IFCCONVERSIONBASEDUNIT, IFCDIMENSIONALEXPONENTS and IFCMEASUREWITHUNIT entries. Both Core Interior verdicts replay PASS with three matches.
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 #403.
What changes
StepWriter::emit_unit_assignmentalways declares what the writer writes:METRE,SQUARE_METRE,CUBIC_METRE,RADIAN,KILO GRAM,SECOND.model.units(Revit's display units, IFC-40) no longer drives theIfcUnitAssignment; they remain inIfcModel.unitsand in the export diagnostics (recovered_unit_identifiers), where they describe the source model. The missing-units warning now says the IFC declares the SI units its values are written in.Evidence (IfcOpenShell 0.8.5 as the reader)
synthetic-project.ifcon mainReal exports (Einhoven, Projeto1) now declare the six SI units; before, Einhoven declared
SQUARE_INCH/CUBIC_INCH/DEGREE/POUNDand Projeto1CENTI SQUARE_METRE, over values the writer converts to SI. No value in those exports used those measures yet, so their geometry does not change; the fix matters from the first area, volume, angle or mass property on. Their display units (meters,squareInches… /squareCentimeters…) still appear in--diagnostics.Checks
tools/check-local.sh: passed (fmt, clippy, rustdoc, 204 suites).DUMP_IFC/DUMP_IFC_STRUCTURAL;tools/ci/ifc_schema_arity.pypasses on both.FOOTlength unit over metre values); they are replaced by one test of the corrected rule. No new tests beyond that.Residual
Which display unit rvt-rs reports is the most frequent
autodesk.unit.*identifier per category in the partitions; on Einhoven (a Dutch model) that reports square inches for area, which looks wrong as a display unit. It no longer affects the IFC; it is diagnostics-only.Breaking changes
Consumers that read the declared units get SI instead of the model's display units. Values are unchanged.
Legal and contribution hygiene
Note
Medium Risk
Changes IFC unit metadata for all exports (breaking for consumers that trusted Revit's display units) while numeric geometry is unchanged; fixes 1000× scale errors in viewers that honor
IfcUnitAssignment.Overview
IFC
IfcUnitAssignmentnow always matches the SI values the STEP writer emits (#403). Length is declared as metres (not millimetres on empty-unit models), and area, volume, angle, mass, and time are fixed to square metre, cubic metre, radian, kilogram, and second. Revit display units frommodel.unitsno longer drive STEP emission; they stay on the model and in export diagnostics (recovered_unit_identifiers).The writer drops Forge-based unit mapping,
IfcConversionBasedUnitchains, and the legacy millimetre default.emit_unit_assignmentis a fixed six-IfcSIUnittable; the missing-units warning text is updated accordingly. Tests are consolidated into one case that asserts the same SI assignment whetherunitsis empty or declares feet/inches/mm. Synthetic IFC fixtures are regenerated (metre length, mass/time units).Reviewed by Cursor Bugbot for commit 1e735c813c93641ea79d8d6c4082234dacee3a9c. Configure here.