Repository navigation
IFC: compute element dimensions from the exported geometry - #151
Merged
mahach666 merged 1 commit intoNov 12, 2026
Merged
Conversation
Pset_NwcElementProperties used the mesh's local bounding box, so the dimensions ignored the length-unit scale and the mesh transform, and clipped meshes, which have no bounding box, lost them. Both export paths now pass the exported vertices and scale, and the values are written as IFCLENGTHMEASURE. Fixes IOExtend#41 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #41
WriteMeshPropertiestookLength_X/Width_Y/Height_Zfrommesh.BoundingBox. That bounding box is in local, unscaled units, so the dimensions ignored the length unit and the mesh transform. Clipped meshes have no bounding box, so they lost the dimensions altogether.Following the issue's suggested fix:
WriteandWriteAssemblypass the exportedverticesandscaleintoWriteMeshProperties.WriteMeshPropertiescomputes the axis-aligned extents of those vertices, multiplied byscale. It writes them asIFCLENGTHMEASUREinstead ofIFCREAL.The dimensions therefore always describe the geometry written to the file: world or local coordinates as selected, metres or millimetres, and clipped or not.
Tests (
IfcExportTests), each for both the document and the assembly export:SaveIfc_Dimensions_UseExportedLengthUnits: millimetres, and the conversion to metres.SaveIfc_Dimensions_UseSelectedCoordinateSpace: a rotated mesh with world coordinates on and off.SaveIfc_Dimensions_RetainPostClipExtents: dimensions after clipping by a section plane.All 12 cases fail without the src change.
dotnet build NwcIO.slnxsucceeds, andNwcIO.Testspasses locally: 251 passed, and 2 skipped because they need private Navisworks files (.NET 10.0.400 on Windows, withglobal.jsonpinned down to it temporarily; not committed).The change was drafted with OpenAI Codex, then reviewed and verified with Claude Code.
🤖 Generated with Claude Code