Files
2nd/10_Wiki/Topics/DevOps_and_Security/IFCjs (Fragment).md
T
2026-05-10 22:08:15 +09:00

161 lines
5.3 KiB
Markdown

---
id: wiki-2026-0508-ifcjs-fragment
title: IFCjs (Fragment)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [IFC.js, ThatOpen Fragment, web-ifc, BIM web viewer]
duplicate_of: none
source_trust_level: A
confidence_score: 0.85
verification_status: applied
tags: [bim, ifc, threejs, web, fragment]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: TypeScript
framework: Three.js, web-ifc, ThatOpen Components
---
# IFCjs (Fragment)
## 매 한 줄
> **"매 IFC BIM model 의 web-native streaming 형식"**. 매 2021 IFC.js (Antonio Gonzalez Viegas) → 매 2024 ThatOpen Components 로 rebrand 된 toolchain. 매 Fragment format 매 IFC 의 매 GPU-friendly binary representation — 매 1GB IFC 가 매 50MB Fragment 로 압축, 매 browser 의 매 instant load.
## 매 핵심
### 매 IFC 의 limitation
- 매 STEP-based ASCII format — 매 100MB+ project 매 routine.
- 매 spatial hierarchy + property + geometry 매 모두 nested — 매 partial load 의 X.
- 매 Three.js 의 직접 render 의 X — 매 tessellation needed.
### 매 Fragment 의 solution
- 매 web-ifc (WASM) 가 매 IFC parse + tessellate.
- 매 결과를 매 Fragment binary (FlatBuffers-based) 로 serialize.
- 매 InstancedMesh 단위 grouping → 매 draw call 격감.
- 매 property data 매 별도 SQLite-WASM file → 매 lazy query.
### 매 응용
1. 건축 설계 review web tool.
2. Construction 현장 mobile BIM viewer.
3. Facility management dashboard.
4. Clash detection web service.
## 💻 패턴
### 1. ThatOpen Components 초기화 (2026)
```ts
import * as OBC from "@thatopen/components";
import * as OBCF from "@thatopen/components-front";
const components = new OBC.Components();
const worlds = components.get(OBC.Worlds);
const world = worlds.create<
OBC.SimpleScene, OBC.SimpleCamera, OBCF.PostproductionRenderer
>();
world.scene = new OBC.SimpleScene(components);
world.renderer = new OBCF.PostproductionRenderer(components, container);
world.camera = new OBC.SimpleCamera(components);
components.init();
```
### 2. IFC → Fragment 변환
```ts
const ifcLoader = components.get(OBC.IfcLoader);
await ifcLoader.setup();
const file = await fetch("model.ifc");
const buffer = new Uint8Array(await file.arrayBuffer());
const model = await ifcLoader.load(buffer);
world.scene.three.add(model);
```
### 3. 미리 만든 Fragment load (instant)
```ts
const fragments = components.get(OBC.FragmentsManager);
const data = await fetch("model.frag").then(r => r.arrayBuffer());
const group = fragments.load(new Uint8Array(data));
world.scene.three.add(group);
```
### 4. Property query (lazy)
```ts
const indexer = components.get(OBC.IfcRelationsIndexer);
await indexer.process(model);
// Get all walls
const walls = await indexer.getEntitiesByType(model, "IFCWALL");
for (const expressID of walls) {
const props = await model.getProperties(expressID);
console.log(props.Name.value);
}
```
### 5. Highlight on click
```ts
const highlighter = components.get(OBCF.Highlighter);
highlighter.setup({ world });
highlighter.events.select.onHighlight.add((selection) => {
console.log("Selected fragments:", selection);
});
```
### 6. Section plane (clipper)
```ts
const clipper = components.get(OBC.Clipper);
clipper.enabled = true;
container.addEventListener("dblclick", () => clipper.create(world));
```
### 7. Streaming (large model)
```ts
const streamer = components.get(OBCF.IfcStreamer);
streamer.url = "https://cdn.example.com/fragments/";
streamer.world = world;
await streamer.load(
await fetch("model-streamed.json").then(r => r.json()),
true // coordinate to origin
);
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Small model (< 50MB IFC) | 직접 IfcLoader.load() |
| Medium (50-500MB) | 사전 변환된 .frag file |
| Large (500MB+) | IfcStreamer (tile-based LOD) |
| Property-heavy query | IfcRelationsIndexer + cached |
| Mobile viewer | Fragment + simplified geometry |
**기본값**: ThatOpen Components 2026 + Fragment 사전 변환 + property cache.
## 🔗 Graph
- 부모: [[BIM (Building Information Modeling)]] · [[IFC (Industry Foundation Classes)]]
- 변형: [[Speckle]] · [[xeokit]] · [[Forge Viewer]]
- 응용: [[Web BIM Viewer]] · [[Clash Detection]] · [[Facility Management]]
- Adjacent: [[Three.js]] · [[WASM]] · [[FlatBuffers]]
## 🤖 LLM 활용
**언제**: 매 web-based BIM viewer 매 build. 매 IFC model 매 browser 의 instant load 가 필요. 매 open-source 매 prefer (Forge 의 X).
**언제 X**: 매 desktop-only workflow (Revit/Navisworks 매 충분). 매 < 10MB model (overkill). 매 photorealistic render (use Unreal/Unity).
## ❌ 안티패턴
- **IFC 매 매번 parse**: 매 100MB IFC 매 user 마다 30초 wait. 매 backend 사전 변환 필수.
- **Property 매 eager load**: 매 모든 property 매 memory load → OOM. 매 lazy + query-on-demand.
- **InstancedMesh 무시**: 매 IFC 의 매 1000+ identical column 매 매 separate Mesh → 매 draw call 폭발.
- **GlobalId 의 X**: 매 Fragment internal ID 매 IFC GlobalId 와 매 different — 매 cross-system mapping 매 GlobalId 사용.
## 🧪 검증 / 중복
- Verified (ThatOpen/engine_components GitHub 2026-05, web-ifc 0.0.66+).
- 신뢰도 A (rapidly-evolving project — 매 minor API drift 가능).
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — ThatOpen Components 2026 API + Fragment streaming |