Prerequisites
Before installing AI-BIM App, ensure your development environment meets these requirements:Required Software
Node.js (Required)
Node.js (Required)
Minimum version: Node.js 16.x or higherRecommended: Node.js 18.x LTS or Node.js 20.x LTSCheck your version:Install Node.js:
- Download from nodejs.org
- Or use a version manager like nvm
OpenAI API Key (Required for AI Features)
OpenAI API Key (Required for AI Features)
An OpenAI API key is required for the AI querying functionality.Get your API key:
- Sign up at platform.openai.com
- Navigate to API Keys section
- Create a new secret key
- Copy and save it securely
Modern Web Browser
Modern Web Browser
Required browser support:
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
Installation Steps
Install dependencies
Configure environment variables
Create a Add your OpenAI API key:Verify the
.env file in the project root:.env
The
VITE_ prefix is required for Vite to expose environment variables to the browser..env file is gitignored:Dependencies Explained
Thepackage.json defines all project dependencies:
Core Dependencies
package.json
ThatOpen Components (~2.4.x)
ThatOpen Components (~2.4.x)
Purpose: BIM-specific component framework built on Three.jsPackages:
@thatopen/components- Core components (FragmentsManager, IfcLoader, Worlds, Classifier)@thatopen/components-front- Frontend rendering (PostproductionRenderer, Highlighter, IfcStreamer)@thatopen/fragments- Fragment-based geometry system for efficient BIM loading@thatopen/ui- Base UI component system@thatopen/ui-obc- BIM-specific UI components
- Fragment-based IFC loading (faster than traditional methods)
- Built-in IFC relationship indexing
- Spatial structure navigation
- Post-processing effects (AO, custom lines)
Three.js 0.160.1
Three.js 0.160.1
Purpose: WebGL-based 3D graphics libraryUsed for:
- 3D scene rendering
- Camera controls (OrthoPerspectiveCamera)
- Materials and shaders
- Geometry management
web-ifc ~0.0.66
web-ifc ~0.0.66
Purpose: High-performance IFC parser compiled to WebAssemblyFeatures:
- Parses IFC files directly in the browser
- Extracts geometry and properties
- Provides IFC entity type constants (IFCWALL, IFCSLAB, etc.)
OpenAI ^4.89.0
OpenAI ^4.89.0
Purpose: Official OpenAI API clientUsage in app:Model used: GPT-3.5-turbo (cost-effective for IFC queries)
Chart.js ^4.4.8
Chart.js ^4.4.8
Purpose: Data visualization libraryUsed for:
- Bar charts (element counts by type)
- Pie charts (distribution by building storey)
- Interactive data exploration
JSZip 3.10.1
JSZip 3.10.1
Purpose: ZIP file handling for fragment filesUse case: Loading pre-converted fragment files which are packaged as ZIP:
Development Dependencies
- Hot module replacement (HMR)
- Optimized production builds
- Native ES modules support
Build Process
Development Mode
- Vite starts development server on port 5173
- TypeScript files are transpiled on-the-fly
- Hot Module Replacement (HMR) enables instant updates
- Source maps are generated for debugging
vite.config.ts
Production Build
- TypeScript compilation (
tsc) - Vite optimization and bundling
- Output to
dist/directory
TypeScript Configuration
tsconfig.json
Environment Setup
OpenAI API Configuration
The API key is accessed in the ChatGpt component:src/bim-components/ChatGpt/index.ts
Environment Variables
Available variables:| Variable | Required | Description |
|---|---|---|
VITE_OPENAI_API_KEY | Yes | OpenAI API key for GPT queries |
VITE_ to be exposed to the client:
.env
Troubleshooting Common Issues
Error: 'VITE_OPENAI_API_KEY' is undefined
Error: 'VITE_OPENAI_API_KEY' is undefined
Cause: Missing or incorrectly named environment variableSolution:
- Verify
.envfile exists in project root - Check variable is named exactly
VITE_OPENAI_API_KEY - Restart the dev server after creating/modifying
.env
WebGL errors or blank viewport
WebGL errors or blank viewport
Cause: Browser doesn’t support WebGL 2.0 or GPU acceleration is disabledCheck WebGL support:
Visit webglreport.comEnable GPU acceleration:
- Chrome:
chrome://settings→ Advanced → System → Enable hardware acceleration - Firefox:
about:config→webgl.force-enabled= true
IFC file fails to load
IFC file fails to load
Possible causes:1. File too large
- Files >50MB may cause browser memory issues
- Solution: Use the Tiles streaming option for large models
- Check IFC schema version (should be IFC2x3, IFC4, or IFC4.3)
- Open file in text editor and check header:
FILE_SCHEMA(('IFC4'));
- Validate IFC file using tools like IFC Viewer
- Open DevTools (F12) and check Console for specific error messages
AI queries return errors
AI queries return errors
OpenAI API 401 Unauthorized:
- Invalid API key → Check
.envconfiguration - Expired API key → Generate new key from OpenAI platform
- Too many requests → Wait before retrying
- Upgrade OpenAI plan for higher rate limits
- Remember to use “Load to” tab to load IFC as text
- Check browser console:
console.log(chatGpt.fileData)
npm install fails
npm install fails
ERESOLVE dependency conflicts:Node version incompatibility:Network/registry issues:
TypeScript errors during build
TypeScript errors during build
Strict mode errors:
The project uses
"strict": true in tsconfig.jsonCommon fixes:Performance Optimization
For Large IFC Files
Browser Performance
- Use Chrome or Edge for best WebGL performance
- Close unused tabs to free GPU memory
- Monitor DevTools Performance tab during interaction
Next Steps
Quickstart Guide
Load your first IFC model and make AI queries
Configuration
Advanced configuration options
Need Help?
GitHub Issues
Report bugs or request features
ThatOpen Docs
Learn more about ThatOpen Components at docs.thatopen.com