Skip to content

IFC: compute element dimensions from the exported geometry - #151

Merged
mahach666 merged 1 commit into
IOExtend:mainfrom
menes97:fix/ifc-exported-dimension-properties
Nov 12, 2026
Merged

mahach666 merged 1 commit into
IOExtend:mainfrom
menes97:fix/ifc-exported-dimension-properties

Conversation

@menes97

@menes97 menes97 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #41

WriteMeshProperties took Length_X/Width_Y/Height_Z from mesh.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:

  • Write and WriteAssembly pass the exported vertices and scale into WriteMeshProperties.
  • WriteMeshProperties computes the axis-aligned extents of those vertices, multiplied by scale. It writes them as IFCLENGTHMEASURE instead of IFCREAL.

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.slnx succeeds, and NwcIO.Tests passes locally: 251 passed, and 2 skipped because they need private Navisworks files (.NET 10.0.400 on Windows, with global.json pinned down to it temporarily; not committed).

The change was drafted with OpenAI Codex, then reviewed and verified with Claude Code.

🤖 Generated with Claude Code

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>
@mahach666
mahach666 merged commit adfe54c into IOExtend:main Nov 12, 2026
4 checks passed
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 Pset_NwcElementProperties dimensions ignore length-unit scaling and mesh transform, and are dropped for clipped meshes

2 participants