Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions apps/ifc-converter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# IFC → Pascal Converter

A web app that converts IFC building models into Pascal scene-graph JSON and
previews the result in the real `@pascal-app/viewer`. Drop in an `.ifc` file
(or pick a bundled example), inspect what was extracted, and download the
JSON to load into the Pascal editor.

> ## ⚠️ Early alpha
>
> This converter is in **early alpha**. IFC is a sprawling, loosely-followed
> standard and real-world exports vary wildly — so expect rough edges:
> misplaced or missing elements, walls that default to a fixed height when
> their geometry can't be read, items skipped entirely, and element types
> that aren't mapped yet. The output is meant for previewing and iterating,
> not production.
>
> **Contributions very welcome** — if you hit a file that converts badly,
> a sample IFC + a note on what's wrong is hugely helpful, and PRs improving
> the conversion (better geometry extraction, more element types, edge-case
> handling) are exactly what this needs. Jump in. 🙏

## How it works

- **`@pascal-app/ifc-converter`** (`packages/ifc-converter`) — the pure
conversion logic. Parses IFC via [web-ifc](https://github.com/ThatOpen/engine_web-ifc),
maps elements onto Pascal node schemas from `@pascal-app/core`. No DOM, no
React.
- **This app** — the UI: drop zone, example picker, element search/filters,
the 3D preview, and JSON download.

## Develop

```bash
bun dev # from this directory, or `turbo run dev` at the repo root
```

The `web-ifc.wasm` binary is copied into `public/` automatically on
install/dev/build (`scripts/copy-web-ifc-wasm.mjs`). Large example IFCs are
fetched from a public bucket at runtime; the small ones are committed under
`public/test-ifc-files/`. Override the bucket with
`NEXT_PUBLIC_IFC_EXAMPLES_BASE_URL`.

## Known limitations (help wanted)

- Plain `IFCWALL` (Brep/mapped geometry) falls back to a default height — exact
per-wall heights need geometry-AABB extraction.
- Items (furniture, etc.) are skipped — Pascal items require a catalog asset.
- Beams have no Pascal node type yet and are skipped.
- Doors/windows are matched to walls by proximity when the IFC omits fill
relationships; matching isn't perfect.
- Stairs/roofs are placeholders (bounding box / flat polygon in metadata).
11 changes: 11 additions & 0 deletions apps/ifc-converter/app/client-bootstrap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use client'

// Side-effect import: loads every built-in node kind into the registry
// on the client so the first `<Viewer>` has renderers to dispatch to.
// Mounted from `app/layout.tsx` so every route is covered.
import '../lib/bootstrap'
import type { ReactNode } from 'react'

export function ClientBootstrap({ children }: { children: ReactNode }) {
return children
}
6 changes: 6 additions & 0 deletions apps/ifc-converter/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import 'tailwindcss';

html,
body {
height: 100%;
}
18 changes: 18 additions & 0 deletions apps/ifc-converter/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { ReactNode } from 'react'
import { ClientBootstrap } from './client-bootstrap'
import './globals.css'

export const metadata = {
title: 'IFC → Pascal Converter',
description: 'Convert IFC building models into Pascal scene-graph JSON.',
}

export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
<ClientBootstrap>{children}</ClientBootstrap>
</body>
</html>
)
}
31 changes: 31 additions & 0 deletions apps/ifc-converter/app/page.tsx
Original file line number Diff line number Diff line change
@@ -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>
)
}
Loading
Loading