debim 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {debim-0.2.1/src/debim.egg-info → debim-0.2.2}/PKG-INFO +383 -327
  2. debim-0.2.2/README.md +349 -0
  3. {debim-0.2.1 → debim-0.2.2}/pyproject.toml +5 -5
  4. {debim-0.2.1 → debim-0.2.2}/setup.cfg +4 -4
  5. {debim-0.2.1 → debim-0.2.2}/src/debim/version.py +1 -1
  6. {debim-0.2.1 → debim-0.2.2}/src/debim/viewer.py +127 -101
  7. {debim-0.2.1 → debim-0.2.2/src/debim.egg-info}/PKG-INFO +383 -327
  8. {debim-0.2.1 → debim-0.2.2}/src/debim.egg-info/requires.txt +2 -2
  9. {debim-0.2.1 → debim-0.2.2}/tests/test_asset_baker.py +106 -106
  10. {debim-0.2.1 → debim-0.2.2}/tests/test_compiler.py +192 -192
  11. {debim-0.2.1 → debim-0.2.2}/tests/test_contemporary_thai_house.py +184 -184
  12. {debim-0.2.1 → debim-0.2.2}/tests/test_diff.py +84 -84
  13. {debim-0.2.1 → debim-0.2.2}/tests/test_importer.py +41 -41
  14. {debim-0.2.1 → debim-0.2.2}/tests/test_schema.py +318 -318
  15. {debim-0.2.1 → debim-0.2.2}/tests/test_viewer.py +7 -5
  16. debim-0.2.1/README.md +0 -293
  17. {debim-0.2.1 → debim-0.2.2}/LICENSE +0 -0
  18. {debim-0.2.1 → debim-0.2.2}/src/debim/__init__.py +0 -0
  19. {debim-0.2.1 → debim-0.2.2}/src/debim/cli.py +0 -0
  20. {debim-0.2.1 → debim-0.2.2}/src/debim/compiler.py +0 -0
  21. {debim-0.2.1 → debim-0.2.2}/src/debim/compliance.py +0 -0
  22. {debim-0.2.1 → debim-0.2.2}/src/debim/cost.py +0 -0
  23. {debim-0.2.1 → debim-0.2.2}/src/debim/importer.py +0 -0
  24. {debim-0.2.1 → debim-0.2.2}/src/debim/mcp.py +0 -0
  25. {debim-0.2.1 → debim-0.2.2}/src/debim/qto.py +0 -0
  26. {debim-0.2.1 → debim-0.2.2}/src/debim/resolver.py +0 -0
  27. {debim-0.2.1 → debim-0.2.2}/src/debim/scaffold.py +0 -0
  28. {debim-0.2.1 → debim-0.2.2}/src/debim/schema.py +0 -0
  29. {debim-0.2.1 → debim-0.2.2}/src/debim.egg-info/SOURCES.txt +0 -0
  30. {debim-0.2.1 → debim-0.2.2}/src/debim.egg-info/dependency_links.txt +0 -0
  31. {debim-0.2.1 → debim-0.2.2}/src/debim.egg-info/entry_points.txt +0 -0
  32. {debim-0.2.1 → debim-0.2.2}/src/debim.egg-info/top_level.txt +0 -0
  33. {debim-0.2.1 → debim-0.2.2}/tests/test_cli.py +0 -0
  34. {debim-0.2.1 → debim-0.2.2}/tests/test_compliance.py +0 -0
  35. {debim-0.2.1 → debim-0.2.2}/tests/test_cost.py +0 -0
  36. {debim-0.2.1 → debim-0.2.2}/tests/test_door_window_importer.py +0 -0
  37. {debim-0.2.1 → debim-0.2.2}/tests/test_furnishing_importer.py +0 -0
  38. {debim-0.2.1 → debim-0.2.2}/tests/test_mcp.py +0 -0
  39. {debim-0.2.1 → debim-0.2.2}/tests/test_mep.py +0 -0
  40. {debim-0.2.1 → debim-0.2.2}/tests/test_mep_importer.py +0 -0
  41. {debim-0.2.1 → debim-0.2.2}/tests/test_precision_importer.py +0 -0
  42. {debim-0.2.1 → debim-0.2.2}/tests/test_qto.py +0 -0
  43. {debim-0.2.1 → debim-0.2.2}/tests/test_resolver.py +0 -0
  44. {debim-0.2.1 → debim-0.2.2}/tests/test_roof.py +0 -0
  45. {debim-0.2.1 → debim-0.2.2}/tests/test_roof_covering_importer.py +0 -0
  46. {debim-0.2.1 → debim-0.2.2}/tests/test_scaffold.py +0 -0
  47. {debim-0.2.1 → debim-0.2.2}/tests/test_spiral_stair.py +0 -0
  48. {debim-0.2.1 → debim-0.2.2}/tests/test_steel_timber_qto.py +0 -0
  49. {debim-0.2.1 → debim-0.2.2}/tests/test_version_check.py +0 -0
@@ -1,327 +1,383 @@
1
- Metadata-Version: 2.4
2
- Name: debim
3
- Version: 0.2.1
4
- Summary: A minimal, Git-native, declarative BIM engine (Building-as-Code) designed for AI agents and humans.
5
- Author: PRIDA-TAKON
6
- License-Expression: MIT
7
- Keywords: bim,building-as-code,openbim,ifc,declarative,cad,ai-agents
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Topic :: Scientific/Engineering
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Requires-Python: >=3.11
15
- Description-Content-Type: text/markdown
16
- License-File: LICENSE
17
- Requires-Dist: typer>=0.12.0
18
- Requires-Dist: rich>=13.0.0
19
- Requires-Dist: pydantic>=2.7.0
20
- Requires-Dist: pyyaml>=6.0.1
21
- Requires-Dist: trimesh>=4.0.0
22
- Requires-Dist: numpy>=1.24.0
23
- Provides-Extra: mcp
24
- Requires-Dist: mcp>=1.0.0; extra == "mcp"
25
- Provides-Extra: ifc
26
- Requires-Dist: ifcopenshell>=0.7.0; extra == "ifc"
27
- Provides-Extra: dev
28
- Requires-Dist: pytest>=8.0.0; extra == "dev"
29
- Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
30
- Provides-Extra: all
31
- Requires-Dist: ifcopenshell>=0.7.0; extra == "all"
32
- Requires-Dist: mcp>=1.0.0; extra == "all"
33
- Dynamic: license-file
34
-
35
- <p align="center">
36
- <img src="docs/assets/logo.svg" alt="debim logo" width="740" />
37
- </p>
38
-
39
- <p align="center">
40
- <strong>A minimal, Git-native, declarative BIM engine (Building-as-Code) designed for AI agents and humans.</strong>
41
- </p>
42
-
43
- <p align="center">
44
- <a href="https://pypi.org/project/debim/"><img src="https://img.shields.io/pypi/v/debim.svg?color=blue" alt="PyPI Version" /></a>
45
- <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
46
- <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11+-blue.svg" alt="Python: 3.11+" /></a>
47
- <a href="https://technical.buildingsmart.org/"><img src="https://img.shields.io/badge/BIM-IFC4--Minimal-brightgreen.svg" alt="BIM: IFC4" /></a>
48
- <a href="tests/"><img src="https://img.shields.io/badge/tests-149%20passed-success.svg" alt="Tests: 149 Passed" /></a>
49
- <a href="https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark"><img src="https://img.shields.io/badge/visual%20fidelity-85.5%25%20median-brightgreen.svg" alt="Visual Fidelity: 85.5% Median" /></a>
50
- <a href="https://prida-takon.github.io/debim/"><img src="https://img.shields.io/badge/Live%203D%20Demo-Interactive%20Viewer-2ea44f.svg?logo=three.js" alt="Live 3D Demo" /></a>
51
- </p>
52
-
53
- <p align="center">
54
- <a href="https://prida-takon.github.io/debim/">
55
- <img src="https://img.shields.io/badge/🔴%20Click%20Here-Open%20Live%203D%20Viewer%20(No%20Install)-2ea44f?style=for-the-badge&logo=three.js" alt="Open Live 3D Demo" />
56
- </a>
57
- </p>
58
-
59
- ---
60
-
61
- <p align="center">
62
- <table width="100%">
63
- <tr>
64
- <td width="50%" align="center" valign="top">
65
- <b>💻 Modern CLI, QTO & Costing Engine</b><br>
66
- <img src="docs/assets/terminal_preview.png" alt="debim Terminal CLI - Farnsworth House" width="100%" />
67
- </td>
68
- <td width="50%" align="center" valign="top">
69
- <b>🌐 Zero-Install 3D Web Viewer (<a href="https://prida-takon.github.io/debim/">Try Live Demo</a>)</b><br>
70
- <a href="https://prida-takon.github.io/debim/"><img src="docs/assets/viewer_preview.png" alt="debim 3D HTML Viewer - Farnsworth House (1951)" width="100%" /></a>
71
- </td>
72
- </tr>
73
- </table>
74
- <sub>🏛️ <i>Showcase: Ludwig Mies van der Rohe's iconic <b>Farnsworth House (1951)</b> — compiled from declarative YAML (<a href="examples/farnsworth_house/project.yaml">examples/farnsworth_house/project.yaml</a>) into standard IFC4 and rendered in real-time in a lightweight 3D web viewer.</i></sub>
75
- </p>
76
-
77
- > [!TIP]
78
- > **🤖 Authored 100% by AI Agent (Antigravity powered by Gemini 3.8 Flash):**
79
- > โมเดลสถาปัตยกรรมระดับโลกชิ้นนี้ **ไม่ได้เขียนด้วยมือมนุษย์ทีละบรรทัด!** แต่เกิดจากการให้ **AI Coding Agent (Antigravity ขับเคลื่อนด้วย Gemini 3.8 Flash)** ทำการสืบค้นข้อมูลแบบแปลน มิติโครงสร้าง และระยะกริดทางประวัติศาสตร์ของ Farnsworth House ด้วยตนเอง แล้วสังเคราะห์โค้ด Declarative YAML (`project.yaml`) ออกมาโดยอัตโนมัติ ก่อนสั่งให้ `debim` ถอดปริมาณงาน (QTO) และคอมไพล์เป็น IFC4 มาตรฐานสากลในเสี้ยววินาที — ยืนยันว่า **คุณไม่จำเป็นต้องพิมพ์โค้ดเองทั้งหมดหากทำงานร่วมกับ AI Agent!**
80
-
81
- ---
82
-
83
- ## 🎯 Why debim? (จุดกำเนิดและปรัชญาของ debim)
84
-
85
- > *"หัวใจของ debim เริ่มจากการอยากให้ AI ทำ BOQ แต่การให้ AI คำนวณตึกทั้งหลังตรงๆ AI ตายแน่ จึงต้องใช้แบบจำลองคณิตศาสตร์ (BIM) ทว่ามาตรฐาน IFC ดั้งเดิมก็ซับซ้อนเกินไป หนักสมอง AI อีก จึงกลั่นออกมาเป็น Declarative YAML — แต่ผลพลอยได้ที่ได้รับกลับยิ่งใหญ่กว่าเป้าหมายแรกเริ่ม"*
86
-
87
- Traditional BIM tools (like Revit or Archicad) were built over 25 years ago for humans clicking with computer mice. They lock architectural data in heavy, proprietary gigabyte files (`.rvt`), charge thousands of dollars in annual licenses, and remain completely opaque to modern automation and AI agents.
88
-
89
- **debim** ยึดมั่นใน **5 เสาหลักแห่งการออกแบบ (Core Tenets)**:
90
- 1. **Building-as-Code & Git-Native:** อาคารคือซอฟต์แวร์ แสดงออกเป็นข้อความ YAML ขนาดกะทัดรัด (Kilobytes ไม่ใช่ Gigabytes) เพื่อให้ทำ Version Control, Git diff, และ Branching ตรวจสอบการแก้ไขได้ทีละบรรทัด
91
- 2. **Deterministic Code Compliance:** กฎหมายอาคารและข้อกำหนดวิศวกรรมถูกแปลงเป็น Unit Test (`pytest`) รันตรวจจับข้อผิดพลาดและระยะร่นใน 0.01 วินาทีก่อนลงมือก่อสร้างจริง
92
- 3. **Zero-License & Zero-Friction Visualization:** ตรวจสอบความถูกต้องทางเรขาคณิตได้ทันทีผ่าน 3D HTML Viewer น้ำหนักเบา เปิดบนเบราว์เซอร์หรือมือถือได้ทันที ไม่ต้องมีไลเซนส์ซอฟต์แวร์ราคาแพง
93
- 4. **Universal Bridge & Dual Representation:** ตัวกลางเชื่อมโยง 2D, 3D (SketchUp/Blender), และ IFC โดยผสมผสาน 90% Primitives สำหรับคำนวณโครงสร้างและ BOQ + 10% Baked GLB Asset สำหรับงานสถาปัตย์ประณีต
94
- 5. **Human & AI Super-Collaboration:** ออกแบบให้มี Explicit Uncertainty (`review_status: needs_review`) ให้มนุษย์และ AI ร่วมมือกันตรวจและเติมเต็มสเปกได้อย่างไร้รอยต่อ
95
-
96
- ---
97
-
98
- ## 🤖 AI-Agent Installation (ติดตั้งง่ายที่สุดในโลกด้วย AI ของคุณ)
99
-
100
- If you use an AI coding assistant (like **Antigravity, Cursor, Claude Code, Jules, or ChatGPT/Copilot**), you don't even need to install it manually!
101
-
102
- Just copy and send this prompt to your AI:
103
-
104
- > *"Please read https://github.com/PRIDA-TAKON/debim and `AGENTS.md`, install debim in my environment, and run `debim --help` to verify."*
105
-
106
- Your agent will inspect the repository, install the dependencies, and verify everything automatically.
107
-
108
- ---
109
-
110
- ## 🚀 Quickstart
111
-
112
- ### 1. Installation
113
-
114
- Install directly from **[PyPI](https://pypi.org/project/debim/)**:
115
-
116
- ```bash
117
- # Standard installation
118
- pip install debim
119
-
120
- # Or with full IFC compiler support
121
- pip install "debim[ifc]"
122
- ```
123
-
124
- Or install in editable mode from source:
125
-
126
- ```bash
127
- git clone https://github.com/PRIDA-TAKON/debim.git
128
- cd debim
129
- pip install -e ".[ifc,dev]"
130
- ```
131
-
132
- ### 2. Basic Commands
133
-
134
- ```bash
135
- # Initialize a new project
136
- debim init my-project
137
-
138
- # Validate schema syntax & grid references
139
- debim validate -m examples/farnsworth_house/project.yaml
140
-
141
- # Run automated building code compliance checks (pytest)
142
- debim test
143
-
144
- # Calculate Quantitative Take-Off (Steel weight, stone volume, glass area)
145
- debim qto -m examples/farnsworth_house/project.yaml
146
-
147
- # Generate project-scoped price template with international classifications
148
- debim cost template -m examples/farnsworth_house/project.yaml -o prices.template.yaml
149
-
150
- # Estimate project budget & export BOQ to CSV
151
- debim cost -m examples/farnsworth_house/project.yaml -p examples/farnsworth_house/prices.yaml -o dist/boq.csv
152
-
153
- # Scaffold a new BIM element class boilerplate
154
- debim scaffold element IfcRailing
155
-
156
- # Preview 3D model in your browser (Three.js with Hierarchical Layer Explorer)
157
- debim view -m examples/farnsworth_house/project.yaml
158
-
159
- # Compile declarative YAML to standard IFC4 building model
160
- debim compile -m examples/farnsworth_house/project.yaml -o dist/farnsworth_house.ifc
161
- ```
162
-
163
- ---
164
-
165
- ## 🏗️ Example `project.yaml`
166
-
167
- ```yaml
168
- schema: IFC4-Minimal
169
- project:
170
- id: PRJ-2026-001
171
- name: "Townhouse-Feasibility"
172
- units: { length: METER, area: SQUARE_METER, volume: CUBIC_METER }
173
-
174
- # 1. Spatial Structure
175
- spatial_structure:
176
- storeys:
177
- - id: L1
178
- name: "Level 1"
179
- elevation: 0.00
180
- height: 3.50
181
- - id: L2
182
- name: "Level 2"
183
- elevation: 3.50
184
- height: 3.20
185
-
186
- # 2. Reference Grid Axes
187
- grids:
188
- axes_x: { A: 0.00, B: 4.00, C: 8.00 }
189
- axes_y: { 1: 0.00, 2: 5.00, 3: 10.00 }
190
-
191
- # 3. Materials
192
- materials:
193
- - id: CONC_240
194
- name: "Concrete 240 ksc"
195
- category: concrete
196
- unit_cost_ref: "MAT-CONC-01"
197
- - id: AAC_75
198
- name: "AAC Block 7.5cm"
199
- category: masonry
200
- unit_cost_ref: "MAT-AAC-01"
201
-
202
- # 4. Elements
203
- elements:
204
- # Column placed at grid intersection [A, 1]
205
- - class: IfcColumn
206
- tag: C-A1
207
- material: CONC_240
208
- profile: { shape: BOX, width: 0.20, depth: 0.20 }
209
- placement:
210
- grid: [A, 1]
211
- base_storey: L1
212
- top_storey: L2
213
- reinforcement:
214
- main: "4-DB16"
215
- stirrups: "RB6 @ 0.15m"
216
-
217
- # Beam spanning between [A, 1] and [B, 1]
218
- - class: IfcBeam
219
- tag: B-A1_B1
220
- material: CONC_240
221
- profile: { shape: BOX, width: 0.20, depth: 0.40 }
222
- placement:
223
- from_grid: [A, 1]
224
- to_grid: [B, 1]
225
- storey: L2
226
- reinforcement:
227
- main_top: "2-DB16"
228
- main_bottom: "3-DB20"
229
- stirrups: "RB9 @ 0.15m"
230
-
231
- # Wall with door host-child relationship
232
- - class: IfcWall
233
- tag: W-A1_A2
234
- material: AAC_75
235
- thickness: 0.075
236
- height: 3.10
237
- placement:
238
- from_grid: [A, 1]
239
- to_grid: [A, 2]
240
- storey: L1
241
- children:
242
- - class: IfcDoor
243
- tag: D1
244
- dimensions: { width: 0.90, height: 2.00 }
245
- offset_distance: 1.20
246
- ```
247
-
248
- ---
249
-
250
- ## 🔬 Empirical Research & Benchmark (การทดสอบระดับอุตสาหกรรม)
251
-
252
- debim ให้ความสำคัญกับความถูกต้องทางวิศวกรรมและการทดสอบแบบเปิดเผย ตรวจสอบซ้ำได้จริง (100% Reproducible Open Science) บน **Kaggle Cloud Multi-Core Benchmark Suite**:
253
-
254
- ### 1. ⚖️ 3D Visual Regression & Alignment Benchmark (255 อาคารจริงสากล)
255
-
256
- <p align="center">
257
- <a href="https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark">
258
- <img src="https://img.shields.io/badge/Kaggle-Run%20Reproducible%20Benchmark-20BEFF?logo=kaggle&style=for-the-badge" alt="Kaggle Benchmark" />
259
- </a>
260
- </p>
261
-
262
- การทดสอบความแม่นยำด้านเรขาคณิต 3 มิติ (3D Visual Fidelity) แบบปิดตาเทียบกับ IFC ต้นฉบับผ่าน **Geometry Variant Deduplication + Balanced Macro-Averaging** บน 4,695 ชิ้นส่วนตัวแทน:
263
-
264
- - **🎯 85.50% Median Visual Fidelity:** ทะลุเกณฑ์มาตรฐานสากล ($\ge 85\%$) ครอบคลุมเกินกึ่งหนึ่งของโมเดลทดสอบ
265
- - **🏗️ 89.07% Structural Match:** งานโครงสร้างรับแรงหลัก (เสา คาน ผนัง ฐานราก) มีความเสถียรระดับเกรด A+
266
- - **⚡ 82.64% MEP System Match:** งานระบบท่อ ระบบปรับอากาศ และอุปกรณ์ไฟฟ้าอยู่ในตำแหน่งและระนาบที่ถูกต้อง
267
-
268
- #### 📈 วิวัฒนาการเปรียบเทียบข้าม 3 เจเนอเรชัน (Progression Across Waves):
269
-
270
- | ตัวชี้วัดสากล (Global Metric) | V1 (Baseline) | V2 (Wave 1-2) | V3 (Wave 4 ล่าสุด) | $\Delta$ พัฒนาขึ้นสะสม |
271
- |---|:---:|:---:|:---:|:---:|
272
- | **🎯 Median Visual Match (ค่ามัธยฐาน)** | 80.90% | 84.90% | **85.50%** | 🏆 **+4.60% (ทะลุเป้า 85%)** |
273
- | **⚖️ Macro Average Visual Match** | 70.57% | 77.60% | **77.71%** | 🟢 **+7.13%** |
274
- | **📊 Micro Average Visual Match** | 72.24% | 80.35% | **80.46%** | 🟢 **+8.23%** |
275
- | **ชิ้นส่วนที่ผ่านเกณฑ์ ($\ge 85\%$)** | 2,865 ชิ้น | 3,140 ชิ้น | **3,135 ชิ้น** | 🟢 **+270 ชิ้น** |
276
- | **หมวดหมู่งานระบบและตกแต่งที่ก้าวกระโดด** | | | | |
277
- | • *ฝ้าเพดาน (`IfcCovering`)* | 11.4% | 89.0% | **89.0%** | 🟢 **+77.6% (ผ่านเกณฑ์)** |
278
- | • *วาล์วระบบท่อ (`IfcValve`)* | 0.0% | 82.2% | **82.4%** | 🟢 **+82.4% (พุ่งจากศูนย์)** |
279
- | • *แผ่นเหล็กโครงสร้าง (`IfcPlate`)* | 10.2% | 88.9% | **87.1%** | 🟢 **+76.9% (ผ่านเกณฑ์)** |
280
- | • *เหล็กค้ำยันเฉียง (`IfcMember`)* | 91.8% | 91.6% | **92.4%** | 🟢 **+0.8% (3D Vector Pitch)** |
281
-
282
- 👉 *ต้องการตรวจสอบการทดลองเชิงลึกหรือรันซ้ำด้วยตนเอง? ดูโค้ดและดาต้าเซ็ตได้ที่ [Kaggle Benchmark Notebook](https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark)*
283
-
284
- ---
285
-
286
- ### 2. 📦 Roundtrip Retention & Storage Reduction Study (407 อาคารสากล)
287
-
288
- debim ได้รับการทดสอบอย่างเข้มงวดกับโมเดลอาคารจริงกว่า **407 โครงการ** (สถาปัตยกรรม โครงสร้าง และ MEP โรงพยาบาล):
289
-
290
- - **100.0% Median Retention Rate:** โมเดลส่วนใหญ่สามารถสกัดและ Re-compile กลับสู่มาตรฐาน IFC4 ได้ครบถ้วนทุกชิ้นงาน
291
- - **91.6% Average Storage Reduction:** ลดขนาดไฟล์จาก IFC ดิบลงเฉลี่ย 91%
292
- - **558M+ LLM Tokens Saved:** ประหยัดบริบทของโมเดลภาษาไปได้มากกว่า **558,629,804 โทเคน**
293
- - **100.0% Modern Schema Crash-Resilience:** ไม่พบ Fatal Crash หรือ Unhandled Exception บนมาตรฐาน IFC2X3 และ IFC4
294
-
295
- 📖 **อ่านรายงานวิจัยฉบับเต็ม:** [debim: An Empirical Study of Declarative Building-as-Code on 407 Heterogeneous Real-World OpenBIM Models](docs/research/2026_empirical_study_407_ifc_models.md)
296
- 📦 **Kaggle Public Benchmark Dataset:** [debim-5000-ifc-benchmark](https://www.kaggle.com/datasets/pridatakon/debim-5000-ifc-benchmark)
297
- ⚡ **Kaggle Automated Stress Test:** [debim-ifc-stress-test](https://www.kaggle.com/code/pridatakon/debim-ifc-stress-test)
298
-
299
- ---
300
-
301
- ## ❓ Frequently Asked Questions (FAQ)
302
-
303
- <details>
304
- <summary><b>Why YAML instead of JSON, Python, or Excel?</b></summary>
305
- <br>
306
- YAML is clean, concise, supports nested hierarchies, and allows comments (essential for architectural notes). Unlike JSON, it has no noisy braces. Unlike Excel, it is 100% Git-friendly, diffable, and conflict-resolvable. It serves as a pure declarative DSL (Domain-Specific Language)—just like Kubernetes, Docker Compose, and GitHub Actions.
307
- </details>
308
-
309
- <details>
310
- <summary><b>How do I place off-grid items (internal partitions, cantilever beams)?</b></summary>
311
- <br>
312
- Use relative offsets: `placement: { grid: [A, 1], offset: [1.20, 0.50] }`. Just like pulling a tape measure on site from the nearest grid line.
313
- </details>
314
-
315
- <details>
316
- <summary><b>Does this replace Revit or AutoCAD?</b></summary>
317
- <br>
318
- No, it complements them. debim handles the early-stage upstream workload: rapid feasibility, parametric sizing, AI generation, instant QTO/costing, and automated building law validation. Once validated, run <code>debim compile</code> to export standard IFC4 and load it directly into BlenderBIM, FreeCAD, or Revit for 2D drafting and detail annotations.
319
- </details>
320
-
321
- ---
322
-
323
- ## 📄 License & Attribution
324
-
325
- - **Software Code:** Licensed under the [MIT License](LICENSE) — Copyright (c) 2026 Prida Takon.
326
- - **Research & Technical Reports:** Licensed under [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
327
- - **Benchmark Datasets & Sample Models:** Test fixtures in `tests/fixtures/` originate from [buildingSMART International](https://github.com/buildingSMART) and the Open IFC Model Repository under CC BY 4.0 / CC-BY-3.0.
1
+ Metadata-Version: 2.4
2
+ Name: debim
3
+ Version: 0.2.2
4
+ Summary: A minimal, Git-native, declarative BIM engine & Model Context Protocol (MCP) Server for AI agents and humans.
5
+ Author: PRIDA-TAKON
6
+ License-Expression: MIT
7
+ Keywords: bim,building-as-code,openbim,ifc,declarative,cad,ai-agents,mcp,model-context-protocol,fastmcp
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Topic :: Scientific/Engineering
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: typer>=0.12.0
18
+ Requires-Dist: rich>=13.0.0
19
+ Requires-Dist: pydantic>=2.7.0
20
+ Requires-Dist: pyyaml>=6.0.1
21
+ Requires-Dist: trimesh>=4.0.0
22
+ Requires-Dist: numpy>=1.24.0
23
+ Provides-Extra: mcp
24
+ Requires-Dist: mcp<2,>=1.0.0; extra == "mcp"
25
+ Provides-Extra: ifc
26
+ Requires-Dist: ifcopenshell>=0.7.0; extra == "ifc"
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
30
+ Provides-Extra: all
31
+ Requires-Dist: ifcopenshell>=0.7.0; extra == "all"
32
+ Requires-Dist: mcp<2,>=1.0.0; extra == "all"
33
+ Dynamic: license-file
34
+
35
+ <p align="center">
36
+ <img src="docs/assets/logo.svg" alt="debim logo" width="740" />
37
+ </p>
38
+
39
+ <p align="center">
40
+ <strong>A minimal, Git-native, declarative BIM engine & Model Context Protocol (MCP) Server for AI agents and humans.</strong>
41
+ </p>
42
+
43
+ <p align="center">
44
+ <a href="https://pypi.org/project/debim/"><img src="https://img.shields.io/pypi/v/debim.svg?color=blue" alt="PyPI Version" /></a>
45
+ <a href="#-model-context-protocol-mcp-server"><img src="https://img.shields.io/badge/MCP-FastMCP%20Server-purple.svg?logo=anthropic" alt="MCP Server" /></a>
46
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
47
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11+-blue.svg" alt="Python: 3.11+" /></a>
48
+ <a href="https://technical.buildingsmart.org/"><img src="https://img.shields.io/badge/BIM-IFC4--Minimal-brightgreen.svg" alt="BIM: IFC4" /></a>
49
+ <a href="tests/"><img src="https://img.shields.io/badge/tests-149%20passed-success.svg" alt="Tests: 149 Passed" /></a>
50
+ <a href="https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark"><img src="https://img.shields.io/badge/visual%20fidelity-85.5%25%20median-brightgreen.svg" alt="Visual Fidelity: 85.5% Median" /></a>
51
+ <a href="https://prida-takon.github.io/debim/"><img src="https://img.shields.io/badge/Live%203D%20Demo-Interactive%20Viewer-2ea44f.svg?logo=three.js" alt="Live 3D Demo" /></a>
52
+ </p>
53
+
54
+ <p align="center">
55
+ <a href="https://prida-takon.github.io/debim/">
56
+ <img src="https://img.shields.io/badge/🔴%20Click%20Here-Open%20Live%203D%20Viewer%20(No%20Install)-2ea44f?style=for-the-badge&logo=three.js" alt="Open Live 3D Demo" />
57
+ </a>
58
+ </p>
59
+
60
+ ---
61
+
62
+ <p align="center">
63
+ <table width="100%">
64
+ <tr>
65
+ <td width="50%" align="center" valign="top">
66
+ <b>💻 Modern CLI, QTO & Costing Engine</b><br>
67
+ <img src="docs/assets/terminal_preview.png" alt="debim Terminal CLI - Farnsworth House" width="100%" />
68
+ </td>
69
+ <td width="50%" align="center" valign="top">
70
+ <b>🌐 Zero-Install 3D Web Viewer (<a href="https://prida-takon.github.io/debim/">Try Live Demo</a>)</b><br>
71
+ <a href="https://prida-takon.github.io/debim/"><img src="docs/assets/viewer_preview.png" alt="debim 3D HTML Viewer - Farnsworth House (1951)" width="100%" /></a>
72
+ </td>
73
+ </tr>
74
+ </table>
75
+ <sub>🏛️ <i>Showcase: Ludwig Mies van der Rohe's iconic <b>Farnsworth House (1951)</b> — compiled from declarative YAML (<a href="examples/farnsworth_house/project.yaml">examples/farnsworth_house/project.yaml</a>) into standard IFC4 and rendered in real-time in a lightweight 3D web viewer.</i></sub>
76
+ </p>
77
+
78
+ > [!TIP]
79
+ > **🤖 Authored 100% by AI Agent (Antigravity powered by Gemini 3.8 Flash):**
80
+ > This iconic architectural masterpiece was **not coded by hand line-by-line!** Instead, an **autonomous AI Coding Agent (Google Antigravity powered by Gemini 3.8 Flash)** researched historical blueprints, structural grids, and architectural dimensions of the Farnsworth House, synthesized the declarative YAML specification (`project.yaml`), computed material quantities (QTO), and compiled standard IFC4 building models in seconds — proving that **humans don't need to manually code YAML when assisted by AI agents!**
81
+
82
+ ---
83
+
84
+ ## 🎯 Why debim?
85
+
86
+ > *"debim originated from a simple desire: to make AI calculate accurate Bills of Quantities (BOQ). Asking an LLM to guess building dimensions directly in text leads to fatal hallucinations. An exact mathematical model (BIM) is essential, yet traditional IFC files are bloated and overwhelm AI context windows. The solution is Declarative YAML — but the resulting Building-as-Code engine proved far more transformative than our initial goal."*
87
+
88
+ Traditional BIM tools (like Revit or Archicad) were conceived over 25 years ago for humans clicking with computer mice. They lock architectural data inside heavy, proprietary gigabyte files (`.rvt`), charge thousands of dollars in annual licenses, and remain completely opaque to modern automation and AI agents.
89
+
90
+ **debim** is built on **5 Core Architectural Tenets**:
91
+ 1. **Building-as-Code & Git-Native:** Buildings are software. Expressed as compact YAML (Kilobytes, not Gigabytes) for transparent Version Control, line-by-line Git diffs, and branching.
92
+ 2. **Deterministic Code Compliance:** Building codes and engineering regulations are treated as automated Unit Tests (`pytest`), catching setback violations and structural errors in 0.01 seconds before ground is broken.
93
+ 3. **Zero-License & Zero-Friction Visualization:** Instant geometric verification through lightweight 3D HTML viewers that load in any browser or mobile device in 2 seconds without expensive licenses.
94
+ 4. **Universal Bridge & Dual Representation:** Seamlessly connects 2D drafts, 3D DCC tools (Blender/SketchUp), and open IFC standards using a dual approach: 90% geometric primitives for engineering/BOQ + 10% baked GLB assets for architectural refinement.
95
+ 5. **Human & AI Super-Collaboration:** Designed with explicit uncertainty flags (`review_status: needs_review`), enabling humans and autonomous AI agents to co-author and verify building models without friction.
96
+
97
+ ---
98
+
99
+ ## 🤖 Autonomous AI-Agent Setup
100
+
101
+ If you use an AI coding assistant (like **Antigravity, Cursor, Claude Code, Jules, or ChatGPT/Copilot**), you don't even need to install it manually!
102
+
103
+ Just copy and send this prompt to your AI:
104
+
105
+ > *"Please read https://github.com/PRIDA-TAKON/debim and `AGENTS.md`, install debim in my environment, and run `debim --help` to verify."*
106
+
107
+ Your agent will inspect the repository, install the dependencies, and verify everything automatically.
108
+
109
+ ---
110
+
111
+ ## 🔌 Model Context Protocol (MCP) Server
112
+
113
+ `debim` natively implements the official **[Model Context Protocol (MCP)](https://modelcontextprotocol.io/)** via `FastMCP` (Python SDK). It provides LLMs and AI Agents (such as Claude Desktop, Cursor, Cline, Windsurf, Devin, and Antigravity) with deterministic tools to model, inspect, calculate, compile, and visualize buildings directly via function calling.
114
+
115
+ ### Connecting to Claude Desktop / Cursor / Cline
116
+
117
+ Add `debim` to your MCP configuration (`claude_desktop_config.json` or `.cursor/mcp.json`):
118
+
119
+ ```json
120
+ {
121
+ "mcpServers": {
122
+ "debim": {
123
+ "command": "debim",
124
+ "args": ["mcp"]
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ Or run via Docker:
131
+
132
+ ```json
133
+ {
134
+ "mcpServers": {
135
+ "debim": {
136
+ "command": "docker",
137
+ "args": ["run", "-i", "--rm", "ghcr.io/prida-takon/debim:latest"]
138
+ }
139
+ }
140
+ }
141
+ ```
142
+
143
+ ### Exposed MCP Tools
144
+
145
+ | MCP Tool | Description | Input Parameters |
146
+ |---|---|---|
147
+ | `debim_validate` | Validates YAML manifest syntax, structural grid alignments, storey heights, and material references. | `manifest_yaml: str` |
148
+ | `debim_qto` | Computes deterministic Quantitative Take-Off (concrete vol, formwork area, rebar kg, structural steel, timber, masonry). | `manifest_yaml: str` |
149
+ | `debim_cost_template` | Extracts materials used by the building model and generates a minimal project-scoped price catalog template. | `manifest_yaml: str` |
150
+ | `debim_cost` | Maps QTO quantities against unit prices, calculates total project cost, and optionally exports BOQ to CSV. | `manifest_yaml: str`, `prices_yaml?: str`, `export_csv_path?: str` |
151
+ | `debim_compile_ifc` | Compiles declarative YAML into an open, standardized buildingSMART IFC4 model (`.ifc`). | `manifest_yaml: str`, `output_ifc_path: str` |
152
+ | `debim_generate_viewer` | Generates a standalone, zero-dependency interactive 3D WebGL HTML viewer with section cut and layer tree. | `manifest_yaml: str`, `output_html_path: str` |
153
+
154
+ ### Running the MCP Server Locally
155
+
156
+ ```bash
157
+ # Start MCP server over stdio
158
+ debim mcp
159
+ ```
160
+
161
+ ---
162
+
163
+ ## 🚀 Quickstart
164
+
165
+ ### 1. Installation
166
+
167
+ Install directly from **[PyPI](https://pypi.org/project/debim/)**:
168
+
169
+ ```bash
170
+ # Standard installation
171
+ pip install debim
172
+
173
+ # Or with full IFC compiler support
174
+ pip install "debim[ifc]"
175
+ ```
176
+
177
+ Or install in editable mode from source:
178
+
179
+ ```bash
180
+ git clone https://github.com/PRIDA-TAKON/debim.git
181
+ cd debim
182
+ pip install -e ".[ifc,dev]"
183
+ ```
184
+
185
+ ### 2. Basic Commands
186
+
187
+ ```bash
188
+ # Initialize a new project
189
+ debim init my-project
190
+
191
+ # Validate schema syntax & grid references
192
+ debim validate -m examples/farnsworth_house/project.yaml
193
+
194
+ # Run automated building code compliance checks (pytest)
195
+ debim test
196
+
197
+ # Calculate Quantitative Take-Off (Steel weight, stone volume, glass area)
198
+ debim qto -m examples/farnsworth_house/project.yaml
199
+
200
+ # Generate project-scoped price template with international classifications
201
+ debim cost template -m examples/farnsworth_house/project.yaml -o prices.template.yaml
202
+
203
+ # Estimate project budget & export BOQ to CSV
204
+ debim cost -m examples/farnsworth_house/project.yaml -p examples/farnsworth_house/prices.yaml -o dist/boq.csv
205
+
206
+ # Scaffold a new BIM element class boilerplate
207
+ debim scaffold element IfcRailing
208
+
209
+ # Preview 3D model in your browser (Three.js with Hierarchical Layer Explorer)
210
+ debim view -m examples/farnsworth_house/project.yaml
211
+
212
+ # Compile declarative YAML to standard IFC4 building model
213
+ debim compile -m examples/farnsworth_house/project.yaml -o dist/farnsworth_house.ifc
214
+
215
+ # Launch Model Context Protocol (MCP) server over stdio
216
+ debim mcp
217
+ ```
218
+
219
+ ---
220
+
221
+ ## 🏗️ Example `project.yaml`
222
+
223
+ ```yaml
224
+ schema: IFC4-Minimal
225
+ project:
226
+ id: PRJ-2026-001
227
+ name: "Townhouse-Feasibility"
228
+ units: { length: METER, area: SQUARE_METER, volume: CUBIC_METER }
229
+
230
+ # 1. Spatial Structure
231
+ spatial_structure:
232
+ storeys:
233
+ - id: L1
234
+ name: "Level 1"
235
+ elevation: 0.00
236
+ height: 3.50
237
+ - id: L2
238
+ name: "Level 2"
239
+ elevation: 3.50
240
+ height: 3.20
241
+
242
+ # 2. Reference Grid Axes
243
+ grids:
244
+ axes_x: { A: 0.00, B: 4.00, C: 8.00 }
245
+ axes_y: { 1: 0.00, 2: 5.00, 3: 10.00 }
246
+
247
+ # 3. Materials
248
+ materials:
249
+ - id: CONC_240
250
+ name: "Concrete 240 ksc"
251
+ category: concrete
252
+ unit_cost_ref: "MAT-CONC-01"
253
+ - id: AAC_75
254
+ name: "AAC Block 7.5cm"
255
+ category: masonry
256
+ unit_cost_ref: "MAT-AAC-01"
257
+
258
+ # 4. Elements
259
+ elements:
260
+ # Column placed at grid intersection [A, 1]
261
+ - class: IfcColumn
262
+ tag: C-A1
263
+ material: CONC_240
264
+ profile: { shape: BOX, width: 0.20, depth: 0.20 }
265
+ placement:
266
+ grid: [A, 1]
267
+ base_storey: L1
268
+ top_storey: L2
269
+ reinforcement:
270
+ main: "4-DB16"
271
+ stirrups: "RB6 @ 0.15m"
272
+
273
+ # Beam spanning between [A, 1] and [B, 1]
274
+ - class: IfcBeam
275
+ tag: B-A1_B1
276
+ material: CONC_240
277
+ profile: { shape: BOX, width: 0.20, depth: 0.40 }
278
+ placement:
279
+ from_grid: [A, 1]
280
+ to_grid: [B, 1]
281
+ storey: L2
282
+ reinforcement:
283
+ main_top: "2-DB16"
284
+ main_bottom: "3-DB20"
285
+ stirrups: "RB9 @ 0.15m"
286
+
287
+ # Wall with door host-child relationship
288
+ - class: IfcWall
289
+ tag: W-A1_A2
290
+ material: AAC_75
291
+ thickness: 0.075
292
+ height: 3.10
293
+ placement:
294
+ from_grid: [A, 1]
295
+ to_grid: [A, 2]
296
+ storey: L1
297
+ children:
298
+ - class: IfcDoor
299
+ tag: D1
300
+ dimensions: { width: 0.90, height: 2.00 }
301
+ offset_distance: 1.20
302
+ ```
303
+
304
+ ---
305
+
306
+ ## 🔬 Empirical Research & Benchmark
307
+
308
+ debim prioritizes engineering precision and reproducible open science on our **Kaggle Cloud Multi-Core Benchmark Suite**:
309
+
310
+ ### 1. ⚖️ 3D Visual Regression & Alignment Benchmark (255 Real-World Buildings)
311
+
312
+ <p align="center">
313
+ <a href="https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark">
314
+ <img src="https://img.shields.io/badge/Kaggle-Run%20Reproducible%20Benchmark-20BEFF?logo=kaggle&style=for-the-badge" alt="Kaggle Benchmark" />
315
+ </a>
316
+ </p>
317
+
318
+ Evaluating blind 3D geometric fidelity against ground-truth IFC models using **Geometry Variant Deduplication + Balanced Macro-Averaging** across 4,695 representative building elements:
319
+
320
+ - **🎯 85.50% Median Visual Fidelity:** Surpassing the international standard benchmark ($\ge 85\%$) across the majority of test suites.
321
+ - **🏗️ 89.07% Structural Match:** Primary load-bearing elements (columns, beams, slabs, foundations) maintain Grade-A+ geometric alignment.
322
+ - **⚡ 82.64% MEP System Match:** Ductwork, drainage, piping, and electrical fixtures align accurately in 3D coordinate planes.
323
+
324
+ #### 📈 Progression Across Waves:
325
+
326
+ | Global Metric | V1 (Baseline) | V2 (Wave 1-2) | V3 (Latest Wave 4) | Cumulative Improvement |
327
+ |---|:---:|:---:|:---:|:---:|
328
+ | **🎯 Median Visual Match** | 80.90% | 84.90% | **85.50%** | 🏆 **+4.60% (Exceeded 85%)** |
329
+ | **⚖️ Macro Average Visual Match** | 70.57% | 77.60% | **77.71%** | 🟢 **+7.13%** |
330
+ | **📊 Micro Average Visual Match** | 72.24% | 80.35% | **80.46%** | 🟢 **+8.23%** |
331
+ | **Passing Elements ($\ge 85\%$)** | 2,865 | 3,140 | **3,135** | 🟢 **+270 elements** |
332
+ | **Top Performing Disciplines** | | | | |
333
+ | • *Ceilings (`IfcCovering`)* | 11.4% | 89.0% | **89.0%** | 🟢 **+77.6% (Passing)** |
334
+ | • *Valves & Piping (`IfcValve`)* | 0.0% | 82.2% | **82.4%** | 🟢 **+82.4% (Zero-shot lift)** |
335
+ | • *Structural Plates (`IfcPlate`)* | 10.2% | 88.9% | **87.1%** | 🟢 **+76.9% (Passing)** |
336
+ | • *Bracing Members (`IfcMember`)* | 91.8% | 91.6% | **92.4%** | 🟢 **+0.8% (3D Vector Pitch)** |
337
+
338
+ 👉 *Want to inspect raw visual data or reproduce tests yourself? Explore the full dataset and code on the [Kaggle Benchmark Notebook](https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark).*
339
+
340
+ ---
341
+
342
+ ### 2. 📦 Roundtrip Retention & Storage Reduction Study (407 Real-World OpenBIM Models)
343
+
344
+ Rigorously benchmarked against **407 real-world projects** across architectural, structural, and complex hospital MEP domains:
345
+
346
+ - **100.0% Median Retention Rate:** Extract and re-compile back to standard IFC4 without element loss.
347
+ - **91.6% Average Storage Reduction:** Compresses raw IFC files by an average of 91%.
348
+ - **558M+ LLM Tokens Saved:** Prevented **558,629,804 tokens** from cluttering agent context windows.
349
+ - **100.0% Modern Schema Crash-Resilience:** Zero fatal crashes or unhandled exceptions across standard IFC2X3 and IFC4 datasets.
350
+
351
+ 📖 **Read Full Research Paper:** [debim: An Empirical Study of Declarative Building-as-Code on 407 Heterogeneous Real-World OpenBIM Models](docs/research/2026_empirical_study_407_ifc_models.md)
352
+ 📦 **Kaggle Public Benchmark Dataset:** [debim-5000-ifc-benchmark](https://www.kaggle.com/datasets/pridatakon/debim-5000-ifc-benchmark)
353
+ ⚡ **Kaggle Automated Stress Test:** [debim-ifc-stress-test](https://www.kaggle.com/code/pridatakon/debim-ifc-stress-test)
354
+
355
+ ---
356
+
357
+ ## ❓ Frequently Asked Questions (FAQ)
358
+
359
+ <details>
360
+ <summary><b>Why YAML instead of JSON, Python, or Excel?</b></summary>
361
+ <br>
362
+ YAML is clean, concise, supports nested hierarchies, and allows comments (essential for architectural notes). Unlike JSON, it has no noisy braces. Unlike Excel, it is 100% Git-friendly, diffable, and conflict-resolvable. It serves as a pure declarative DSL (Domain-Specific Language)—just like Kubernetes, Docker Compose, and GitHub Actions.
363
+ </details>
364
+
365
+ <details>
366
+ <summary><b>How do I place off-grid items (internal partitions, cantilever beams)?</b></summary>
367
+ <br>
368
+ Use relative offsets: `placement: { grid: [A, 1], offset: [1.20, 0.50] }`. Just like pulling a tape measure on site from the nearest grid line.
369
+ </details>
370
+
371
+ <details>
372
+ <summary><b>Does this replace Revit or AutoCAD?</b></summary>
373
+ <br>
374
+ No, it complements them. debim handles the early-stage upstream workload: rapid feasibility, parametric sizing, AI generation, instant QTO/costing, and automated building law validation. Once validated, run <code>debim compile</code> to export standard IFC4 and load it directly into BlenderBIM, FreeCAD, or Revit for 2D drafting and detail annotations.
375
+ </details>
376
+
377
+ ---
378
+
379
+ ## 📄 License & Attribution
380
+
381
+ - **Software Code:** Licensed under the [MIT License](LICENSE) — Copyright (c) 2026 Prida Takon.
382
+ - **Research & Technical Reports:** Licensed under [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
383
+ - **Benchmark Datasets & Sample Models:** Test fixtures in `tests/fixtures/` originate from [buildingSMART International](https://github.com/buildingSMART) and the Open IFC Model Repository under CC BY 4.0 / CC-BY-3.0.