debim 0.2.0__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 (44) hide show
  1. debim-0.2.0/LICENSE +21 -0
  2. debim-0.2.0/PKG-INFO +315 -0
  3. debim-0.2.0/README.md +286 -0
  4. debim-0.2.0/pyproject.toml +52 -0
  5. debim-0.2.0/setup.cfg +4 -0
  6. debim-0.2.0/src/debim/__init__.py +5 -0
  7. debim-0.2.0/src/debim/cli.py +884 -0
  8. debim-0.2.0/src/debim/compiler.py +1405 -0
  9. debim-0.2.0/src/debim/compliance.py +342 -0
  10. debim-0.2.0/src/debim/cost.py +962 -0
  11. debim-0.2.0/src/debim/importer.py +1626 -0
  12. debim-0.2.0/src/debim/qto.py +1601 -0
  13. debim-0.2.0/src/debim/resolver.py +3026 -0
  14. debim-0.2.0/src/debim/scaffold.py +175 -0
  15. debim-0.2.0/src/debim/schema.py +1126 -0
  16. debim-0.2.0/src/debim/viewer.py +2508 -0
  17. debim-0.2.0/src/debim.egg-info/PKG-INFO +315 -0
  18. debim-0.2.0/src/debim.egg-info/SOURCES.txt +42 -0
  19. debim-0.2.0/src/debim.egg-info/dependency_links.txt +1 -0
  20. debim-0.2.0/src/debim.egg-info/entry_points.txt +3 -0
  21. debim-0.2.0/src/debim.egg-info/requires.txt +13 -0
  22. debim-0.2.0/src/debim.egg-info/top_level.txt +1 -0
  23. debim-0.2.0/tests/test_asset_baker.py +106 -0
  24. debim-0.2.0/tests/test_cli.py +25 -0
  25. debim-0.2.0/tests/test_compiler.py +192 -0
  26. debim-0.2.0/tests/test_compliance.py +74 -0
  27. debim-0.2.0/tests/test_contemporary_thai_house.py +184 -0
  28. debim-0.2.0/tests/test_cost.py +350 -0
  29. debim-0.2.0/tests/test_diff.py +84 -0
  30. debim-0.2.0/tests/test_door_window_importer.py +247 -0
  31. debim-0.2.0/tests/test_furnishing_importer.py +44 -0
  32. debim-0.2.0/tests/test_importer.py +41 -0
  33. debim-0.2.0/tests/test_mep.py +800 -0
  34. debim-0.2.0/tests/test_mep_importer.py +351 -0
  35. debim-0.2.0/tests/test_precision_importer.py +254 -0
  36. debim-0.2.0/tests/test_qto.py +526 -0
  37. debim-0.2.0/tests/test_resolver.py +197 -0
  38. debim-0.2.0/tests/test_roof.py +377 -0
  39. debim-0.2.0/tests/test_roof_covering_importer.py +145 -0
  40. debim-0.2.0/tests/test_scaffold.py +46 -0
  41. debim-0.2.0/tests/test_schema.py +318 -0
  42. debim-0.2.0/tests/test_spiral_stair.py +274 -0
  43. debim-0.2.0/tests/test_steel_timber_qto.py +221 -0
  44. debim-0.2.0/tests/test_viewer.py +127 -0
debim-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Prida Takon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
debim-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,315 @@
1
+ Metadata-Version: 2.4
2
+ Name: debim
3
+ Version: 0.2.0
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: ifc
24
+ Requires-Dist: ifcopenshell>=0.7.0; extra == "ifc"
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ <p align="center">
31
+ <img src="docs/assets/logo.svg" alt="debim logo" width="740" />
32
+ </p>
33
+
34
+ <p align="center">
35
+ <strong>A minimal, Git-native, declarative BIM engine (Building-as-Code) designed for AI agents and humans.</strong>
36
+ </p>
37
+
38
+ <p align="center">
39
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
40
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11+-blue.svg" alt="Python: 3.11+" /></a>
41
+ <a href="https://technical.buildingsmart.org/"><img src="https://img.shields.io/badge/BIM-IFC4--Minimal-brightgreen.svg" alt="BIM: IFC4" /></a>
42
+ <a href="tests/"><img src="https://img.shields.io/badge/tests-131%20passed-success.svg" alt="Tests: 131 Passed" /></a>
43
+ <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>
44
+ <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>
45
+ </p>
46
+
47
+ <p align="center">
48
+ <a href="https://prida-takon.github.io/debim/">
49
+ <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" />
50
+ </a>
51
+ </p>
52
+
53
+ ---
54
+
55
+ <p align="center">
56
+ <table width="100%">
57
+ <tr>
58
+ <td width="50%" align="center" valign="top">
59
+ <b>💻 Modern CLI, QTO & Costing Engine</b><br>
60
+ <img src="docs/assets/terminal_preview.png" alt="debim Terminal CLI - Farnsworth House" width="100%" />
61
+ </td>
62
+ <td width="50%" align="center" valign="top">
63
+ <b>🌐 Zero-Install 3D Web Viewer (<a href="https://prida-takon.github.io/debim/">Try Live Demo</a>)</b><br>
64
+ <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>
65
+ </td>
66
+ </tr>
67
+ </table>
68
+ <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>
69
+ </p>
70
+
71
+ > [!TIP]
72
+ > **🤖 Authored 100% by AI Agent (Antigravity powered by Gemini 3.8 Flash):**
73
+ > โมเดลสถาปัตยกรรมระดับโลกชิ้นนี้ **ไม่ได้เขียนด้วยมือมนุษย์ทีละบรรทัด!** แต่เกิดจากการให้ **AI Coding Agent (Antigravity ขับเคลื่อนด้วย Gemini 3.8 Flash)** ทำการสืบค้นข้อมูลแบบแปลน มิติโครงสร้าง และระยะกริดทางประวัติศาสตร์ของ Farnsworth House ด้วยตนเอง แล้วสังเคราะห์โค้ด Declarative YAML (`project.yaml`) ออกมาโดยอัตโนมัติ ก่อนสั่งให้ `debim` ถอดปริมาณงาน (QTO) และคอมไพล์เป็น IFC4 มาตรฐานสากลในเสี้ยววินาที — ยืนยันว่า **คุณไม่จำเป็นต้องพิมพ์โค้ดเองทั้งหมดหากทำงานร่วมกับ AI Agent!**
74
+
75
+ ---
76
+
77
+ ## 🎯 Why debim? (จุดกำเนิดและปรัชญาของ debim)
78
+
79
+ > *"หัวใจของ debim เริ่มจากการอยากให้ AI ทำ BOQ แต่การให้ AI คำนวณตึกทั้งหลังตรงๆ AI ตายแน่ จึงต้องใช้แบบจำลองคณิตศาสตร์ (BIM) ทว่ามาตรฐาน IFC ดั้งเดิมก็ซับซ้อนเกินไป หนักสมอง AI อีก จึงกลั่นออกมาเป็น Declarative YAML — แต่ผลพลอยได้ที่ได้รับกลับยิ่งใหญ่กว่าเป้าหมายแรกเริ่ม"*
80
+
81
+ 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.
82
+
83
+ **debim** ยึดมั่นใน **5 เสาหลักแห่งการออกแบบ (Core Tenets)**:
84
+ 1. **Building-as-Code & Git-Native:** อาคารคือซอฟต์แวร์ แสดงออกเป็นข้อความ YAML ขนาดกะทัดรัด (Kilobytes ไม่ใช่ Gigabytes) เพื่อให้ทำ Version Control, Git diff, และ Branching ตรวจสอบการแก้ไขได้ทีละบรรทัด
85
+ 2. **Deterministic Code Compliance:** กฎหมายอาคารและข้อกำหนดวิศวกรรมถูกแปลงเป็น Unit Test (`pytest`) รันตรวจจับข้อผิดพลาดและระยะร่นใน 0.01 วินาทีก่อนลงมือก่อสร้างจริง
86
+ 3. **Zero-License & Zero-Friction Visualization:** ตรวจสอบความถูกต้องทางเรขาคณิตได้ทันทีผ่าน 3D HTML Viewer น้ำหนักเบา เปิดบนเบราว์เซอร์หรือมือถือได้ทันที ไม่ต้องมีไลเซนส์ซอฟต์แวร์ราคาแพง
87
+ 4. **Universal Bridge & Dual Representation:** ตัวกลางเชื่อมโยง 2D, 3D (SketchUp/Blender), และ IFC โดยผสมผสาน 90% Primitives สำหรับคำนวณโครงสร้างและ BOQ + 10% Baked GLB Asset สำหรับงานสถาปัตย์ประณีต
88
+ 5. **Human & AI Super-Collaboration:** ออกแบบให้มี Explicit Uncertainty (`review_status: needs_review`) ให้มนุษย์และ AI ร่วมมือกันตรวจและเติมเต็มสเปกได้อย่างไร้รอยต่อ
89
+
90
+ ---
91
+
92
+ ## 🤖 AI-Agent Installation (ติดตั้งง่ายที่สุดในโลกด้วย AI ของคุณ)
93
+
94
+ 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!
95
+
96
+ Just copy and send this prompt to your AI:
97
+
98
+ > *"Please read https://github.com/PRIDA-TAKON/debim and `AGENTS.md`, install debim in my environment, and run `debim --help` to verify."*
99
+
100
+ Your agent will inspect the repository, install the dependencies, and verify everything automatically.
101
+
102
+ ---
103
+
104
+ ## 🚀 Manual Quickstart
105
+
106
+ ### 1. Installation
107
+
108
+ ```bash
109
+ # Clone the repository
110
+ git clone https://github.com/PRIDA-TAKON/debim.git
111
+ cd debim
112
+
113
+ # Install in editable mode
114
+ pip install -e .
115
+
116
+ # Or with full dev & IFC compiler tools
117
+ pip install -e ".[ifc,dev]"
118
+ ```
119
+
120
+ ### 2. Basic Commands
121
+
122
+ ```bash
123
+ # Initialize a new project
124
+ debim init my-project
125
+
126
+ # Validate schema syntax & grid references
127
+ debim validate -m examples/farnsworth_house/project.yaml
128
+
129
+ # Run automated building code compliance checks (pytest)
130
+ debim test
131
+
132
+ # Calculate Quantitative Take-Off (Steel weight, stone volume, glass area)
133
+ debim qto -m examples/farnsworth_house/project.yaml
134
+
135
+ # Generate project-scoped price template with international classifications
136
+ debim cost template -m examples/farnsworth_house/project.yaml -o prices.template.yaml
137
+
138
+ # Estimate project budget & export BOQ to CSV
139
+ debim cost -m examples/farnsworth_house/project.yaml -p examples/farnsworth_house/prices.yaml -o dist/boq.csv
140
+
141
+ # Scaffold a new BIM element class boilerplate
142
+ debim scaffold element IfcRailing
143
+
144
+ # Preview 3D model in your browser (Three.js with Hierarchical Layer Explorer)
145
+ debim view -m examples/farnsworth_house/project.yaml
146
+
147
+ # Compile declarative YAML to standard IFC4 building model
148
+ debim compile -m examples/farnsworth_house/project.yaml -o dist/farnsworth_house.ifc
149
+ ```
150
+
151
+ ---
152
+
153
+ ## 🏗️ Example `project.yaml`
154
+
155
+ ```yaml
156
+ schema: IFC4-Minimal
157
+ project:
158
+ id: PRJ-2026-001
159
+ name: "Townhouse-Feasibility"
160
+ units: { length: METER, area: SQUARE_METER, volume: CUBIC_METER }
161
+
162
+ # 1. Spatial Structure
163
+ spatial_structure:
164
+ storeys:
165
+ - id: L1
166
+ name: "Level 1"
167
+ elevation: 0.00
168
+ height: 3.50
169
+ - id: L2
170
+ name: "Level 2"
171
+ elevation: 3.50
172
+ height: 3.20
173
+
174
+ # 2. Reference Grid Axes
175
+ grids:
176
+ axes_x: { A: 0.00, B: 4.00, C: 8.00 }
177
+ axes_y: { 1: 0.00, 2: 5.00, 3: 10.00 }
178
+
179
+ # 3. Materials
180
+ materials:
181
+ - id: CONC_240
182
+ name: "Concrete 240 ksc"
183
+ category: concrete
184
+ unit_cost_ref: "MAT-CONC-01"
185
+ - id: AAC_75
186
+ name: "AAC Block 7.5cm"
187
+ category: masonry
188
+ unit_cost_ref: "MAT-AAC-01"
189
+
190
+ # 4. Elements
191
+ elements:
192
+ # Column placed at grid intersection [A, 1]
193
+ - class: IfcColumn
194
+ tag: C-A1
195
+ material: CONC_240
196
+ profile: { shape: BOX, width: 0.20, depth: 0.20 }
197
+ placement:
198
+ grid: [A, 1]
199
+ base_storey: L1
200
+ top_storey: L2
201
+ reinforcement:
202
+ main: "4-DB16"
203
+ stirrups: "RB6 @ 0.15m"
204
+
205
+ # Beam spanning between [A, 1] and [B, 1]
206
+ - class: IfcBeam
207
+ tag: B-A1_B1
208
+ material: CONC_240
209
+ profile: { shape: BOX, width: 0.20, depth: 0.40 }
210
+ placement:
211
+ from_grid: [A, 1]
212
+ to_grid: [B, 1]
213
+ storey: L2
214
+ reinforcement:
215
+ main_top: "2-DB16"
216
+ main_bottom: "3-DB20"
217
+ stirrups: "RB9 @ 0.15m"
218
+
219
+ # Wall with door host-child relationship
220
+ - class: IfcWall
221
+ tag: W-A1_A2
222
+ material: AAC_75
223
+ thickness: 0.075
224
+ height: 3.10
225
+ placement:
226
+ from_grid: [A, 1]
227
+ to_grid: [A, 2]
228
+ storey: L1
229
+ children:
230
+ - class: IfcDoor
231
+ tag: D1
232
+ dimensions: { width: 0.90, height: 2.00 }
233
+ offset_distance: 1.20
234
+ ```
235
+
236
+ ---
237
+
238
+ ## 🔬 Empirical Research & Benchmark (การทดสอบระดับอุตสาหกรรม)
239
+
240
+ debim ให้ความสำคัญกับความถูกต้องทางวิศวกรรมและการทดสอบแบบเปิดเผย ตรวจสอบซ้ำได้จริง (100% Reproducible Open Science) บน **Kaggle Cloud Multi-Core Benchmark Suite**:
241
+
242
+ ### 1. ⚖️ 3D Visual Regression & Alignment Benchmark (255 อาคารจริงสากล)
243
+
244
+ <p align="center">
245
+ <a href="https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark">
246
+ <img src="https://img.shields.io/badge/Kaggle-Run%20Reproducible%20Benchmark-20BEFF?logo=kaggle&style=for-the-badge" alt="Kaggle Benchmark" />
247
+ </a>
248
+ </p>
249
+
250
+ การทดสอบความแม่นยำด้านเรขาคณิต 3 มิติ (3D Visual Fidelity) แบบปิดตาเทียบกับ IFC ต้นฉบับผ่าน **Geometry Variant Deduplication + Balanced Macro-Averaging** บน 4,695 ชิ้นส่วนตัวแทน:
251
+
252
+ - **🎯 85.50% Median Visual Fidelity:** ทะลุเกณฑ์มาตรฐานสากล ($\ge 85\%$) ครอบคลุมเกินกึ่งหนึ่งของโมเดลทดสอบ
253
+ - **🏗️ 89.07% Structural Match:** งานโครงสร้างรับแรงหลัก (เสา คาน ผนัง ฐานราก) มีความเสถียรระดับเกรด A+
254
+ - **⚡ 82.64% MEP System Match:** งานระบบท่อ ระบบปรับอากาศ และอุปกรณ์ไฟฟ้าอยู่ในตำแหน่งและระนาบที่ถูกต้อง
255
+
256
+ #### 📈 วิวัฒนาการเปรียบเทียบข้าม 3 เจเนอเรชัน (Progression Across Waves):
257
+
258
+ | ตัวชี้วัดสากล (Global Metric) | V1 (Baseline) | V2 (Wave 1-2) | V3 (Wave 4 ล่าสุด) | $\Delta$ พัฒนาขึ้นสะสม |
259
+ |---|:---:|:---:|:---:|:---:|
260
+ | **🎯 Median Visual Match (ค่ามัธยฐาน)** | 80.90% | 84.90% | **85.50%** | 🏆 **+4.60% (ทะลุเป้า 85%)** |
261
+ | **⚖️ Macro Average Visual Match** | 70.57% | 77.60% | **77.71%** | 🟢 **+7.13%** |
262
+ | **📊 Micro Average Visual Match** | 72.24% | 80.35% | **80.46%** | 🟢 **+8.23%** |
263
+ | **ชิ้นส่วนที่ผ่านเกณฑ์ ($\ge 85\%$)** | 2,865 ชิ้น | 3,140 ชิ้น | **3,135 ชิ้น** | 🟢 **+270 ชิ้น** |
264
+ | **หมวดหมู่งานระบบและตกแต่งที่ก้าวกระโดด** | | | | |
265
+ | • *ฝ้าเพดาน (`IfcCovering`)* | 11.4% | 89.0% | **89.0%** | 🟢 **+77.6% (ผ่านเกณฑ์)** |
266
+ | • *วาล์วระบบท่อ (`IfcValve`)* | 0.0% | 82.2% | **82.4%** | 🟢 **+82.4% (พุ่งจากศูนย์)** |
267
+ | • *แผ่นเหล็กโครงสร้าง (`IfcPlate`)* | 10.2% | 88.9% | **87.1%** | 🟢 **+76.9% (ผ่านเกณฑ์)** |
268
+ | • *เหล็กค้ำยันเฉียง (`IfcMember`)* | 91.8% | 91.6% | **92.4%** | 🟢 **+0.8% (3D Vector Pitch)** |
269
+
270
+ 👉 *ต้องการตรวจสอบการทดลองเชิงลึกหรือรันซ้ำด้วยตนเอง? ดูโค้ดและดาต้าเซ็ตได้ที่ [Kaggle Benchmark Notebook](https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark)*
271
+
272
+ ---
273
+
274
+ ### 2. 📦 Roundtrip Retention & Storage Reduction Study (407 อาคารสากล)
275
+
276
+ debim ได้รับการทดสอบอย่างเข้มงวดกับโมเดลอาคารจริงกว่า **407 โครงการ** (สถาปัตยกรรม โครงสร้าง และ MEP โรงพยาบาล):
277
+
278
+ - **100.0% Median Retention Rate:** โมเดลส่วนใหญ่สามารถสกัดและ Re-compile กลับสู่มาตรฐาน IFC4 ได้ครบถ้วนทุกชิ้นงาน
279
+ - **91.6% Average Storage Reduction:** ลดขนาดไฟล์จาก IFC ดิบลงเฉลี่ย 91%
280
+ - **558M+ LLM Tokens Saved:** ประหยัดบริบทของโมเดลภาษาไปได้มากกว่า **558,629,804 โทเคน**
281
+ - **100.0% Modern Schema Crash-Resilience:** ไม่พบ Fatal Crash หรือ Unhandled Exception บนมาตรฐาน IFC2X3 และ IFC4
282
+
283
+ 📖 **อ่านรายงานวิจัยฉบับเต็ม:** [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)
284
+ 📦 **Kaggle Public Benchmark Dataset:** [debim-5000-ifc-benchmark](https://www.kaggle.com/datasets/pridatakon/debim-5000-ifc-benchmark)
285
+ ⚡ **Kaggle Automated Stress Test:** [debim-ifc-stress-test](https://www.kaggle.com/code/pridatakon/debim-ifc-stress-test)
286
+
287
+ ---
288
+
289
+ ## ❓ Frequently Asked Questions (FAQ)
290
+
291
+ <details>
292
+ <summary><b>Why YAML instead of JSON, Python, or Excel?</b></summary>
293
+ <br>
294
+ 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.
295
+ </details>
296
+
297
+ <details>
298
+ <summary><b>How do I place off-grid items (internal partitions, cantilever beams)?</b></summary>
299
+ <br>
300
+ 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.
301
+ </details>
302
+
303
+ <details>
304
+ <summary><b>Does this replace Revit or AutoCAD?</b></summary>
305
+ <br>
306
+ 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.
307
+ </details>
308
+
309
+ ---
310
+
311
+ ## 📄 License & Attribution
312
+
313
+ - **Software Code:** Licensed under the [MIT License](LICENSE) — Copyright (c) 2026 Prida Takon.
314
+ - **Research & Technical Reports:** Licensed under [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
315
+ - **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.
debim-0.2.0/README.md ADDED
@@ -0,0 +1,286 @@
1
+ <p align="center">
2
+ <img src="docs/assets/logo.svg" alt="debim logo" width="740" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>A minimal, Git-native, declarative BIM engine (Building-as-Code) designed for AI agents and humans.</strong>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
11
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11+-blue.svg" alt="Python: 3.11+" /></a>
12
+ <a href="https://technical.buildingsmart.org/"><img src="https://img.shields.io/badge/BIM-IFC4--Minimal-brightgreen.svg" alt="BIM: IFC4" /></a>
13
+ <a href="tests/"><img src="https://img.shields.io/badge/tests-131%20passed-success.svg" alt="Tests: 131 Passed" /></a>
14
+ <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>
15
+ <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>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://prida-takon.github.io/debim/">
20
+ <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" />
21
+ </a>
22
+ </p>
23
+
24
+ ---
25
+
26
+ <p align="center">
27
+ <table width="100%">
28
+ <tr>
29
+ <td width="50%" align="center" valign="top">
30
+ <b>💻 Modern CLI, QTO & Costing Engine</b><br>
31
+ <img src="docs/assets/terminal_preview.png" alt="debim Terminal CLI - Farnsworth House" width="100%" />
32
+ </td>
33
+ <td width="50%" align="center" valign="top">
34
+ <b>🌐 Zero-Install 3D Web Viewer (<a href="https://prida-takon.github.io/debim/">Try Live Demo</a>)</b><br>
35
+ <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>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ <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>
40
+ </p>
41
+
42
+ > [!TIP]
43
+ > **🤖 Authored 100% by AI Agent (Antigravity powered by Gemini 3.8 Flash):**
44
+ > โมเดลสถาปัตยกรรมระดับโลกชิ้นนี้ **ไม่ได้เขียนด้วยมือมนุษย์ทีละบรรทัด!** แต่เกิดจากการให้ **AI Coding Agent (Antigravity ขับเคลื่อนด้วย Gemini 3.8 Flash)** ทำการสืบค้นข้อมูลแบบแปลน มิติโครงสร้าง และระยะกริดทางประวัติศาสตร์ของ Farnsworth House ด้วยตนเอง แล้วสังเคราะห์โค้ด Declarative YAML (`project.yaml`) ออกมาโดยอัตโนมัติ ก่อนสั่งให้ `debim` ถอดปริมาณงาน (QTO) และคอมไพล์เป็น IFC4 มาตรฐานสากลในเสี้ยววินาที — ยืนยันว่า **คุณไม่จำเป็นต้องพิมพ์โค้ดเองทั้งหมดหากทำงานร่วมกับ AI Agent!**
45
+
46
+ ---
47
+
48
+ ## 🎯 Why debim? (จุดกำเนิดและปรัชญาของ debim)
49
+
50
+ > *"หัวใจของ debim เริ่มจากการอยากให้ AI ทำ BOQ แต่การให้ AI คำนวณตึกทั้งหลังตรงๆ AI ตายแน่ จึงต้องใช้แบบจำลองคณิตศาสตร์ (BIM) ทว่ามาตรฐาน IFC ดั้งเดิมก็ซับซ้อนเกินไป หนักสมอง AI อีก จึงกลั่นออกมาเป็น Declarative YAML — แต่ผลพลอยได้ที่ได้รับกลับยิ่งใหญ่กว่าเป้าหมายแรกเริ่ม"*
51
+
52
+ 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.
53
+
54
+ **debim** ยึดมั่นใน **5 เสาหลักแห่งการออกแบบ (Core Tenets)**:
55
+ 1. **Building-as-Code & Git-Native:** อาคารคือซอฟต์แวร์ แสดงออกเป็นข้อความ YAML ขนาดกะทัดรัด (Kilobytes ไม่ใช่ Gigabytes) เพื่อให้ทำ Version Control, Git diff, และ Branching ตรวจสอบการแก้ไขได้ทีละบรรทัด
56
+ 2. **Deterministic Code Compliance:** กฎหมายอาคารและข้อกำหนดวิศวกรรมถูกแปลงเป็น Unit Test (`pytest`) รันตรวจจับข้อผิดพลาดและระยะร่นใน 0.01 วินาทีก่อนลงมือก่อสร้างจริง
57
+ 3. **Zero-License & Zero-Friction Visualization:** ตรวจสอบความถูกต้องทางเรขาคณิตได้ทันทีผ่าน 3D HTML Viewer น้ำหนักเบา เปิดบนเบราว์เซอร์หรือมือถือได้ทันที ไม่ต้องมีไลเซนส์ซอฟต์แวร์ราคาแพง
58
+ 4. **Universal Bridge & Dual Representation:** ตัวกลางเชื่อมโยง 2D, 3D (SketchUp/Blender), และ IFC โดยผสมผสาน 90% Primitives สำหรับคำนวณโครงสร้างและ BOQ + 10% Baked GLB Asset สำหรับงานสถาปัตย์ประณีต
59
+ 5. **Human & AI Super-Collaboration:** ออกแบบให้มี Explicit Uncertainty (`review_status: needs_review`) ให้มนุษย์และ AI ร่วมมือกันตรวจและเติมเต็มสเปกได้อย่างไร้รอยต่อ
60
+
61
+ ---
62
+
63
+ ## 🤖 AI-Agent Installation (ติดตั้งง่ายที่สุดในโลกด้วย AI ของคุณ)
64
+
65
+ 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!
66
+
67
+ Just copy and send this prompt to your AI:
68
+
69
+ > *"Please read https://github.com/PRIDA-TAKON/debim and `AGENTS.md`, install debim in my environment, and run `debim --help` to verify."*
70
+
71
+ Your agent will inspect the repository, install the dependencies, and verify everything automatically.
72
+
73
+ ---
74
+
75
+ ## 🚀 Manual Quickstart
76
+
77
+ ### 1. Installation
78
+
79
+ ```bash
80
+ # Clone the repository
81
+ git clone https://github.com/PRIDA-TAKON/debim.git
82
+ cd debim
83
+
84
+ # Install in editable mode
85
+ pip install -e .
86
+
87
+ # Or with full dev & IFC compiler tools
88
+ pip install -e ".[ifc,dev]"
89
+ ```
90
+
91
+ ### 2. Basic Commands
92
+
93
+ ```bash
94
+ # Initialize a new project
95
+ debim init my-project
96
+
97
+ # Validate schema syntax & grid references
98
+ debim validate -m examples/farnsworth_house/project.yaml
99
+
100
+ # Run automated building code compliance checks (pytest)
101
+ debim test
102
+
103
+ # Calculate Quantitative Take-Off (Steel weight, stone volume, glass area)
104
+ debim qto -m examples/farnsworth_house/project.yaml
105
+
106
+ # Generate project-scoped price template with international classifications
107
+ debim cost template -m examples/farnsworth_house/project.yaml -o prices.template.yaml
108
+
109
+ # Estimate project budget & export BOQ to CSV
110
+ debim cost -m examples/farnsworth_house/project.yaml -p examples/farnsworth_house/prices.yaml -o dist/boq.csv
111
+
112
+ # Scaffold a new BIM element class boilerplate
113
+ debim scaffold element IfcRailing
114
+
115
+ # Preview 3D model in your browser (Three.js with Hierarchical Layer Explorer)
116
+ debim view -m examples/farnsworth_house/project.yaml
117
+
118
+ # Compile declarative YAML to standard IFC4 building model
119
+ debim compile -m examples/farnsworth_house/project.yaml -o dist/farnsworth_house.ifc
120
+ ```
121
+
122
+ ---
123
+
124
+ ## 🏗️ Example `project.yaml`
125
+
126
+ ```yaml
127
+ schema: IFC4-Minimal
128
+ project:
129
+ id: PRJ-2026-001
130
+ name: "Townhouse-Feasibility"
131
+ units: { length: METER, area: SQUARE_METER, volume: CUBIC_METER }
132
+
133
+ # 1. Spatial Structure
134
+ spatial_structure:
135
+ storeys:
136
+ - id: L1
137
+ name: "Level 1"
138
+ elevation: 0.00
139
+ height: 3.50
140
+ - id: L2
141
+ name: "Level 2"
142
+ elevation: 3.50
143
+ height: 3.20
144
+
145
+ # 2. Reference Grid Axes
146
+ grids:
147
+ axes_x: { A: 0.00, B: 4.00, C: 8.00 }
148
+ axes_y: { 1: 0.00, 2: 5.00, 3: 10.00 }
149
+
150
+ # 3. Materials
151
+ materials:
152
+ - id: CONC_240
153
+ name: "Concrete 240 ksc"
154
+ category: concrete
155
+ unit_cost_ref: "MAT-CONC-01"
156
+ - id: AAC_75
157
+ name: "AAC Block 7.5cm"
158
+ category: masonry
159
+ unit_cost_ref: "MAT-AAC-01"
160
+
161
+ # 4. Elements
162
+ elements:
163
+ # Column placed at grid intersection [A, 1]
164
+ - class: IfcColumn
165
+ tag: C-A1
166
+ material: CONC_240
167
+ profile: { shape: BOX, width: 0.20, depth: 0.20 }
168
+ placement:
169
+ grid: [A, 1]
170
+ base_storey: L1
171
+ top_storey: L2
172
+ reinforcement:
173
+ main: "4-DB16"
174
+ stirrups: "RB6 @ 0.15m"
175
+
176
+ # Beam spanning between [A, 1] and [B, 1]
177
+ - class: IfcBeam
178
+ tag: B-A1_B1
179
+ material: CONC_240
180
+ profile: { shape: BOX, width: 0.20, depth: 0.40 }
181
+ placement:
182
+ from_grid: [A, 1]
183
+ to_grid: [B, 1]
184
+ storey: L2
185
+ reinforcement:
186
+ main_top: "2-DB16"
187
+ main_bottom: "3-DB20"
188
+ stirrups: "RB9 @ 0.15m"
189
+
190
+ # Wall with door host-child relationship
191
+ - class: IfcWall
192
+ tag: W-A1_A2
193
+ material: AAC_75
194
+ thickness: 0.075
195
+ height: 3.10
196
+ placement:
197
+ from_grid: [A, 1]
198
+ to_grid: [A, 2]
199
+ storey: L1
200
+ children:
201
+ - class: IfcDoor
202
+ tag: D1
203
+ dimensions: { width: 0.90, height: 2.00 }
204
+ offset_distance: 1.20
205
+ ```
206
+
207
+ ---
208
+
209
+ ## 🔬 Empirical Research & Benchmark (การทดสอบระดับอุตสาหกรรม)
210
+
211
+ debim ให้ความสำคัญกับความถูกต้องทางวิศวกรรมและการทดสอบแบบเปิดเผย ตรวจสอบซ้ำได้จริง (100% Reproducible Open Science) บน **Kaggle Cloud Multi-Core Benchmark Suite**:
212
+
213
+ ### 1. ⚖️ 3D Visual Regression & Alignment Benchmark (255 อาคารจริงสากล)
214
+
215
+ <p align="center">
216
+ <a href="https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark">
217
+ <img src="https://img.shields.io/badge/Kaggle-Run%20Reproducible%20Benchmark-20BEFF?logo=kaggle&style=for-the-badge" alt="Kaggle Benchmark" />
218
+ </a>
219
+ </p>
220
+
221
+ การทดสอบความแม่นยำด้านเรขาคณิต 3 มิติ (3D Visual Fidelity) แบบปิดตาเทียบกับ IFC ต้นฉบับผ่าน **Geometry Variant Deduplication + Balanced Macro-Averaging** บน 4,695 ชิ้นส่วนตัวแทน:
222
+
223
+ - **🎯 85.50% Median Visual Fidelity:** ทะลุเกณฑ์มาตรฐานสากล ($\ge 85\%$) ครอบคลุมเกินกึ่งหนึ่งของโมเดลทดสอบ
224
+ - **🏗️ 89.07% Structural Match:** งานโครงสร้างรับแรงหลัก (เสา คาน ผนัง ฐานราก) มีความเสถียรระดับเกรด A+
225
+ - **⚡ 82.64% MEP System Match:** งานระบบท่อ ระบบปรับอากาศ และอุปกรณ์ไฟฟ้าอยู่ในตำแหน่งและระนาบที่ถูกต้อง
226
+
227
+ #### 📈 วิวัฒนาการเปรียบเทียบข้าม 3 เจเนอเรชัน (Progression Across Waves):
228
+
229
+ | ตัวชี้วัดสากล (Global Metric) | V1 (Baseline) | V2 (Wave 1-2) | V3 (Wave 4 ล่าสุด) | $\Delta$ พัฒนาขึ้นสะสม |
230
+ |---|:---:|:---:|:---:|:---:|
231
+ | **🎯 Median Visual Match (ค่ามัธยฐาน)** | 80.90% | 84.90% | **85.50%** | 🏆 **+4.60% (ทะลุเป้า 85%)** |
232
+ | **⚖️ Macro Average Visual Match** | 70.57% | 77.60% | **77.71%** | 🟢 **+7.13%** |
233
+ | **📊 Micro Average Visual Match** | 72.24% | 80.35% | **80.46%** | 🟢 **+8.23%** |
234
+ | **ชิ้นส่วนที่ผ่านเกณฑ์ ($\ge 85\%$)** | 2,865 ชิ้น | 3,140 ชิ้น | **3,135 ชิ้น** | 🟢 **+270 ชิ้น** |
235
+ | **หมวดหมู่งานระบบและตกแต่งที่ก้าวกระโดด** | | | | |
236
+ | • *ฝ้าเพดาน (`IfcCovering`)* | 11.4% | 89.0% | **89.0%** | 🟢 **+77.6% (ผ่านเกณฑ์)** |
237
+ | • *วาล์วระบบท่อ (`IfcValve`)* | 0.0% | 82.2% | **82.4%** | 🟢 **+82.4% (พุ่งจากศูนย์)** |
238
+ | • *แผ่นเหล็กโครงสร้าง (`IfcPlate`)* | 10.2% | 88.9% | **87.1%** | 🟢 **+76.9% (ผ่านเกณฑ์)** |
239
+ | • *เหล็กค้ำยันเฉียง (`IfcMember`)* | 91.8% | 91.6% | **92.4%** | 🟢 **+0.8% (3D Vector Pitch)** |
240
+
241
+ 👉 *ต้องการตรวจสอบการทดลองเชิงลึกหรือรันซ้ำด้วยตนเอง? ดูโค้ดและดาต้าเซ็ตได้ที่ [Kaggle Benchmark Notebook](https://www.kaggle.com/code/pridatakon/debim-3d-visual-balanced-benchmark)*
242
+
243
+ ---
244
+
245
+ ### 2. 📦 Roundtrip Retention & Storage Reduction Study (407 อาคารสากล)
246
+
247
+ debim ได้รับการทดสอบอย่างเข้มงวดกับโมเดลอาคารจริงกว่า **407 โครงการ** (สถาปัตยกรรม โครงสร้าง และ MEP โรงพยาบาล):
248
+
249
+ - **100.0% Median Retention Rate:** โมเดลส่วนใหญ่สามารถสกัดและ Re-compile กลับสู่มาตรฐาน IFC4 ได้ครบถ้วนทุกชิ้นงาน
250
+ - **91.6% Average Storage Reduction:** ลดขนาดไฟล์จาก IFC ดิบลงเฉลี่ย 91%
251
+ - **558M+ LLM Tokens Saved:** ประหยัดบริบทของโมเดลภาษาไปได้มากกว่า **558,629,804 โทเคน**
252
+ - **100.0% Modern Schema Crash-Resilience:** ไม่พบ Fatal Crash หรือ Unhandled Exception บนมาตรฐาน IFC2X3 และ IFC4
253
+
254
+ 📖 **อ่านรายงานวิจัยฉบับเต็ม:** [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)
255
+ 📦 **Kaggle Public Benchmark Dataset:** [debim-5000-ifc-benchmark](https://www.kaggle.com/datasets/pridatakon/debim-5000-ifc-benchmark)
256
+ ⚡ **Kaggle Automated Stress Test:** [debim-ifc-stress-test](https://www.kaggle.com/code/pridatakon/debim-ifc-stress-test)
257
+
258
+ ---
259
+
260
+ ## ❓ Frequently Asked Questions (FAQ)
261
+
262
+ <details>
263
+ <summary><b>Why YAML instead of JSON, Python, or Excel?</b></summary>
264
+ <br>
265
+ 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.
266
+ </details>
267
+
268
+ <details>
269
+ <summary><b>How do I place off-grid items (internal partitions, cantilever beams)?</b></summary>
270
+ <br>
271
+ 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.
272
+ </details>
273
+
274
+ <details>
275
+ <summary><b>Does this replace Revit or AutoCAD?</b></summary>
276
+ <br>
277
+ 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.
278
+ </details>
279
+
280
+ ---
281
+
282
+ ## 📄 License & Attribution
283
+
284
+ - **Software Code:** Licensed under the [MIT License](LICENSE) — Copyright (c) 2026 Prida Takon.
285
+ - **Research & Technical Reports:** Licensed under [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
286
+ - **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.