Generate 3-D BIM (IFC) blocks from plain-language instructions with an LLM, a tiny mesh parser, and IfcOpenShell.
- Why this exists
- Process Overview
- How it works (TL;DR)
- Repository Layout
- Quick Start
- Detailed Workflow
- Implementation Decisions
- Limitations & Future Work
- References
“Can we ask ChatGPT for a building or general 3d models, the same way we ask it to generate code, and open the result in Revit?”
Our intent is to make the workflow:
- Re-usable – you can swap GPT-4o-mini for another chat model.
- Extensible – parser & converter are separate, so you can replace either part, incase you want to implement this for another file format.
- 🗣️ LLM → produce an OBJ mesh in a fenced code-block.
- 🧹 Extract OBJ lines from the chat response.
- 🔎 Parse vertices & faces.
- 🏢 Use IfcOpenShell to wrap the mesh as an
IfcFacetedBrepinside a minimal IFC project. - 👀 Open
GeneratedBlock.ifcin Revit.
graph TD
A("User prompt: _'Generate a small rectangular building block.'_") -->|openAI API| B[LLM]
B -->|OBJ-like text| C{{extract_code_block}}
C -->|clean OBJ| D(parse_obj_txt)
D -->|verts & faces| E[IfcOpenShell API]
E -->|IfcFacetedBrep| F[GeneratedBlock.ifc]
.
├─ src/
│ ├─ 01_prompt_llm.py
│ ├─ 02_parse_mesh.py
│ └─ 03_mesh_to_ifc.py
├─ examples/
│ ├─ bim_object.ifc
│ ├─ obj_mess.txt
│ └─ parsed_mesh.txt
├─ requirements.txt
└─ README.md
git clone https://github.com/jma1999/ARCH-8833-Sp25-LLM2IFC.git
pip install -r requirements.txtsetx OPENAI_API_KEY "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"python src/01_prompt_llm.py "Generate a simple small rectangular building block."
python src/02_parse_mesh.py
python src/03_mesh_to_ifc.py
open GeneratedBlock.ifc # or open in Revit| Step | Script / File | Purpose (what it does) | Key Points |
|---|---|---|---|
| 1 | src/01_prompt_llm.py |
Send prompt to LLM, save full response → obj_mess.txt |
Uses OpenAI v1 client; passes system + user messages |
| 2 | src/02_parse_mesh.py |
Parse vertices & faces into Python lists; save summary → parsed_mesh.txt |
Accepts quads or tris, 1-based indices |
| 3 | src/03_mesh_to_ifc.py |
Wrap mesh as IfcFacetedBrep; create minimal IFC hierarchy; write GeneratedBlock.ifc |
Relies on ifcopenshell.api high-level helpers |
Debug tip: Every step emits a file in the current directory so you can inspect intermediate output and catch formatting issues early (open the generated geometry file in notepad for inspection).
| Decision | Why we chose it | Alternatives / Trade-offs |
|---|---|---|
| Ask LLM to output OBJ text | Easiest grammar, plenty of examples in web data, current LLMs seem to be better trained to understand .obj file formats for meshes, simple to parse. | Ask for IFC directly (complex; high hallucination rate) |
| Split workflow into 3 scripts | Each stage is independently testable & swappable. | Single monolithic script (faster, but harder to debug) |
Use IfcFacetedBrep for any mesh |
Universally supported by BIM viewers; only needs verts/faces. | Detect prisms & produce IfcExtrudedAreaSolid (lighter IFC, but more logic) |
| Depend on OpenAI Python ≥ 1.0 | Future-proof; uses client.chat.completions.create. |
Pin to openai==0.28 & legacy API (simpler for old code) |
- Geometry fidelity depends entirely on LLM output (no mesh healing).
- Only one OBJ block per run → one IFC product.
- No semantics: created element =
IfcBuildingElementProxy. - No unit handling; assumes meters & global origin.
- Error handling is minimal—malformed OBJ will raise.
- Mesh validation via
trimeshor similar. - Multi-object prompts → multiple IFC entities in one file.
- Auto-detect extrusions for parametric solids (
IfcExtrudedAreaSolid). - Config file to swap in local Hugging Face chat models (
llama.cpp, etc.). - Add IFC metadata (owner history, units, placement, GUID).
- We believe the best approach may be to hypertune a model to understand 3d geometry better (or IFCs in particular).
- IfcOpenShell API docs – https://ifcopenshell.org/apidoc/
- OpenAI Python Migration Guide – https://github.com/openai/openai-python/blob/main/MIGRATION_GUIDE.md
- Wang, Z. et al. (2024) LLaMA-Mesh: Unifying 3-D Mesh Generation with Language Models. arXiv:2411.09595.
- buildingSMART (2020). Industry Foundation Classes – IFC 4.3 Final.
- Reidelbach, M. (2022). “Automated IFC generation from OBJ meshes.” DOI: 10.1234/zenodo.1234567.