Skip to content

Replace .NET xeokit-metadata with a web-ifc-based Node CLI#23469

Draft
wielinde wants to merge 1 commit into
devfrom
code-maintenance/75484-remove-dotnet-net-dependency-from-openproject-replace-xeokit-metadata-with-a-web-ifc-based-solution
Draft

Replace .NET xeokit-metadata with a web-ifc-based Node CLI#23469
wielinde wants to merge 1 commit into
devfrom
code-maintenance/75484-remove-dotnet-net-dependency-from-openproject-replace-xeokit-metadata-with-a-web-ifc-based-solution

Conversation

@wielinde
Copy link
Copy Markdown
Member

Work package: #75484

Goals

  • Remove the .NET 6 runtime dependency from the OpenProject BIM edition. The only thing keeping dotnet-runtime-6.0 (and the abandoned opf/xeokit-metadata fork) on the image was the IFC metadata extractor that walks the spatial hierarchy and emits a JSON tree for the xeokit viewer.
  • Make the BIM pipeline ready for IFC4.3 ADD2 (schema identifier IFC4X3_ADD2). The legacy .NET tool fails to parse IFC4X3 files outright — Xbim.Ifc.IfcStore.Open throws on the schema — which would block adopting IFC4.3 for infrastructure projects (bridges, roads, rail, etc.).

What changed

The metadata extractor is reimplemented as a small Node.js CLI built on web-ifc (MPL-2.0, actively maintained by That Open Company). That Open Company and the xeokit project are independent vendors, but xeokit-sdk itself ships a WebIFCLoaderPlugin built on top of web-ifc — so adopting web-ifc as our parser stays within an ecosystem the viewer side already supports.

  • New package: extensions/web-ifc-xeokit-metadata/, sitting alongside op-blocknote-hocuspocus. TypeScript, vitest, ESLint — same conventions as the existing extension.
  • Drop-in CLI: identical signature to the .NET tool (<input.ifc> <output.json>), identical output JSON shape ({ id, projectId, author, createdAt, schema, creatingApplication, metaObjects[] }). The view conversion service swaps one constant string.
  • Validation:
    • For IFC2X3 and IFC4 fixtures, a parity test compares the new tool's output set-equally to reference JSON produced by the legacy .NET tool. Zero diff in (id, name, type, parent) tuples.
    • For IFC4.3 ADD2 fixtures (where the .NET tool cannot produce a reference), structural validation only: well-formed JSON, correct schema field, parent links form a tree rooted at the project.
  • Test fixtures: 1 from the existing repo (minimal.ifc, IFC2X3) + 3 from buildingSMART's official PCERT samples (Building-Architecture in IFC4 and IFC4X3_ADD2 for schema-parity comparison, plus Infra-Rail in IFC4X3_ADD2 for infrastructure entities). All buildingSMART fixtures licensed CC BY 4.0 with attribution in test/fixtures/README.md.
  • Install scripts updated in three places:
    • docker/prod/setup/preinstall-common.sh — removed the .NET tarball download.
    • docker/prod/setup/postinstall-common.sh — installs the extension's runtime deps via npm install --omit=dev and writes a /usr/local/bin/web-ifc-xeokit-metadata wrapper.
    • docker/dev/backend/scripts/setup-bim — same pattern for the dev container.
    • modules/bim/bin/setup_dev.sh — same for native host setup. Also removes the dotnet-runtime-6.0 apt install.

Schema support after this PR (metadata side only)

Schema Status
IFC2X3 identical output to the .NET tool
IFC4 identical output to the .NET tool
IFC4X3_ADD2 parses and produces structurally-valid output (no .NET ground truth exists)

Out of scope — logical next step

This PR only fixes the metadata side of the BIM conversion pipeline. The geometry side still uses IfcConvert 0.7.11, which also cannot parse IFC4.3 ADD2. To get full end-to-end IFC4.3 ADD2 support we need a follow-up:

  • Upgrade IfcConvert to IfcOpenShell 0.8.5 (current latest in the 0.8 series, where IFC4x3 parsing landed).
  • Re-validate using the fixtures already added in this PR. The infrastructure sample Infra-Rail-IFC4X3.ifc is included specifically to exercise IFC4X3-only entities (e.g. IfcRailway) that don't exist in IFC4.

This is intentionally separated because the IfcConvert upgrade has its own risk surface (no formal changelog, reported regressions vs 0.7.x on edge-case files) and benefits from being reviewed in isolation.

Test plan

  • cd extensions/web-ifc-xeokit-metadata && npm install && npm test — 18 tests pass
  • npm run lint — clean
  • In dev docker: docker compose exec -u root backend docker/dev/backend/scripts/setup-bim succeeds; which web-ifc-xeokit-metadata returns /usr/local/bin/web-ifc-xeokit-metadata
  • In dev docker: which xeokit-metadata returns nothing (legacy tool gone)
  • In dev docker: upload an IFC file via the UI, verify the XKT model renders in the viewer (golden path)
  • Optional: build the prod docker image with BIM_SUPPORT=true and confirm final image size shrank (no .NET runtime)

🤖 Generated with Claude Code

Drops the .NET 6 runtime dependency from the BIM IFC conversion
pipeline. The new extractor lives at extensions/web-ifc-xeokit-metadata
and supports IFC2X3, IFC4 and IFC4X3_ADD2 -- the latter being the
schema family the legacy .NET tool cannot parse.

For the IFC2X3 and IFC4 fixtures, a parity test compares the new
tool's output against reference JSON files produced by the .NET tool.
The IFC4X3_ADD2 fixtures cannot be compared this way (the .NET tool
fails to parse them), so they are only validated structurally: valid
JSON, correct schema field, parent links form a tree.

Refs: https://community.openproject.org/wp/75484

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant