Skip to content

feat: IFC → Pascal converter (package + app)#324

Merged
wass08 merged 2 commits into
mainfrom
feat/ifc-converter-app
May 21, 2026
Merged

feat: IFC → Pascal converter (package + app)#324
wass08 merged 2 commits into
mainfrom
feat/ifc-converter-app

Conversation

@wass08
Copy link
Copy Markdown
Collaborator

@wass08 wass08 commented May 21, 2026

What does this PR do?

Adds an IFC → Pascal converter to the monorepo, replacing a standalone repo that consumed published @pascal-app/* packages and drifted from their schemas.

  • packages/ifc-converter — pure conversion logic (no DOM/React). Parses IFC via web-ifc and maps elements onto @pascal-app/core node schemas (workspace-linked, so no version drift). Each node is built through the real Zod schemas (tryParse) and undefined metadata is stripped.
  • apps/ifc-converter — Next.js UI: drop zone, example picker, element search/filters, JSON download, and a 3D preview rendered through the real @pascal-app/viewer (registry bootstrap + read-only scene) with a custom toolbar (camera / level / wall / grid / theme), a level selector with camera-focus, auto-fit, and click-to-inspect.

Conversion specifics:

  • Door/window vertical centering (door height/2; window sill + height/2).
  • Nearest-wall hosting fallback for files lacking IFCRELFILLSELEMENT, preferring a wall long enough to contain the opening and clamping the along-wall position so cutouts can't overflow and break wall CSG.
  • Plain IFCWALL (Brep/mapped geometry) falls back to default height/thickness instead of collapsing to zero-height slivers.
  • Columns convert as plain structural shafts (no decorative base/capital), sized from the IFC profile.
  • Beams + items are skipped for now (no Pascal beam type; items need a catalog asset) — counted in the conversion summary.

Large example IFCs are fetched from a public bucket at runtime; the 4 small ones are committed. web-ifc.wasm is copied into public/ on install/dev/build. README flags early alpha and invites contributions.

How to test

  1. bun install (copies web-ifc.wasm into apps/ifc-converter/public/ via postinstall).
  2. From apps/ifc-converter: bun dev → open http://localhost:3003.
  3. Pick Duplex Apartment or Paris Building → it converts and renders in the viewer. Orbit/pan/zoom; toggle Levels: Solo + pick a level in the left selector → camera focuses that storey.
  4. Pick IFC Open House → confirm doors/windows sit at correct sill heights (not below the floor).
  5. Download Pascal JSON → load it into the editor's Load Build dialog → it imports/validates cleanly.
  6. bun run check-types at the repo root → green across all packages.

Screenshots / screen recording

N/A in the PR description — happy to attach a short clip. The converter page itself is the visual surface (drop zone + 3D preview).

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

🤖 Generated with Claude Code

@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 21, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
pascal 🔴 Failed May 21, 2026, 12:08 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@jelharou
Copy link
Copy Markdown
Contributor

Build failure addressed by #325

@wass08 wass08 force-pushed the feat/ifc-converter-app branch from 1d0f2fb to ef255b1 Compare May 21, 2026 14:43
wass08 and others added 2 commits May 21, 2026 10:45
Brings the IFC-to-Pascal converter into the monorepo as a pure-logic
package plus a Next.js app, replacing the standalone repo that consumed
published @pascal-app/* packages (and drifted from their schemas).

packages/ifc-converter — pure conversion. Parses IFC via web-ifc and
maps elements onto @pascal-app/core node schemas (workspace-linked, so
no more version drift). Builds doors/windows, walls, slabs, columns,
roofs, stairs, sites/buildings/levels. Validates each node via the real
Zod schemas at build time (tryParse) and strips undefined metadata.

apps/ifc-converter — the UI: drop zone, example picker, element search,
JSON download, and a 3D preview rendered through the real
@pascal-app/viewer (registry bootstrap + read-only scene) with a custom
toolbar (camera/level/wall/grid/theme), level selector with
camera-focus, auto-fit, and selection bridged to an inspector.

Conversion specifics worth noting:
- Door/window vertical centering (height/2; windows + sill).
- Nearest-wall hosting fallback for files lacking IFCRELFILLSELEMENT,
  preferring walls long enough to contain the opening and clamping the
  along-wall position so cutouts can't overflow and break wall CSG.
- Plain IFCWALL (Brep/mapped geometry) falls back to default
  height/thickness instead of collapsing to zero-height slivers.
- Columns convert as plain structural shafts (no decorative
  base/capital) sized from the IFC profile.
- Beams + items are skipped for now (no Pascal beam type; items need a
  catalog asset) — counted in the conversion summary.

Large example IFCs are fetched from a public bucket at runtime; the four
small ones are committed. web-ifc.wasm is copied into public/ on
install/dev/build. README flags early-alpha + invites contributions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two converter accuracy refinements:

- Recover plain IFCWALL height/thickness from geometry. These carry
  Brep/mapped geometry that getBodyExtrusionData can't read, so measure
  the mesh in the wall's own axis frame (along/across/vertical) — a
  rotation-invariant projection rather than a world-space AABB (which
  conflated a rotated wall's length and thickness). Gate on the measured
  length matching the known wall length, and free web-ifc geometry
  handles via try/finally on every path.
- Type columns from their IFC swept profile: IfcCircleProfileDef → round
  + radius, IfcRectangleProfileDef → rectangular + width/depth, falling
  back to the width/depth ratio when the profile type is unknown.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wass08 wass08 force-pushed the feat/ifc-converter-app branch from ef255b1 to 7d9c89c Compare May 21, 2026 14:45
@wass08 wass08 merged commit 488e05d into main May 21, 2026
1 of 2 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.

2 participants