feat: IFC → Pascal converter (package + app)

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>
This commit is contained in:
Wassim SAMAD
2026-05-21 10:45:12 -04:00
co-authored by Claude Opus 4.7
parent 8505d6cdfa
commit 0df51219d0
27 changed files with 150847 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import IfcConverter from '@/components/IfcConverter'
export default function HomePage() {
return (
<main className="min-h-screen bg-gradient-to-br from-blue-50 to-gray-100 py-12">
<div className="max-w-3xl mx-auto px-6 pb-12 space-y-4">
<h1 className="text-3xl font-bold text-gray-900">IFC Pascal Converter</h1>
<p className="text-gray-600 leading-relaxed">
Upload an IFC building model or pick one of the bundled examples. The converter reads the
IFC geometry, maps it onto Pascal's parametric node types, and returns a scene-graph JSON
you can load into the editor's <em>Load Build</em> dialog.
</p>
<div className="rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900">
<span className="font-semibold">Early alpha.</span> IFC is a sprawling, loosely-followed
standard and real-world exports vary a lot, so expect rough edges misplaced or missing
elements, default-height walls, skipped items.{' '}
<a
className="font-medium underline decoration-amber-400 underline-offset-2 hover:text-amber-700"
href="https://github.com/pascalorg/editor/apps/ifc-converter"
rel="noopener noreferrer"
target="_blank"
>
Contributions welcome
</a>{' '}
a sample IFC that converts badly, or a PR improving the conversion, both help a lot.
</div>
</div>
<IfcConverter />
</main>
)
}