# Live House Modeling Test Runners π
This directory contains multiple approaches to demonstrate the MCP-FreeCAD house modeling capabilities on a **real FreeCAD instance with GUI**, allowing you to watch the 3D house being built step by step in real-time!
## β οΈ Important: Original Scripts Had Issues
The original `run_live_house_test.py` and `run_live_house_test_mcp.py` scripts had problems trying to import FreeCAD modules directly from outside FreeCAD. I've created **fixed versions** that work properly!
## π οΈ Working Solutions
### **π― Option 1: Simple Macro Approach (RECOMMENDED)**
**File:** `run_house_macro.py` + `house_modeling_macro.FCMacro`
This is the **most reliable method** - it runs FreeCAD with a macro that executes inside FreeCAD's environment where all modules are available.
```bash
# Simple and reliable!
python run_house_macro.py
```
**What happens:**
1. π Starts FreeCAD with GUI automatically
2. π Runs the house modeling macro inside FreeCAD
3. ποΈ Builds the house step-by-step with 2-second delays
4. π Leaves FreeCAD open for inspection
### **π― Option 2: Fixed MCP Connection Approach**
**File:** `run_live_house_test_fixed.py`
This uses the proper MCP-FreeCAD connection architecture without trying to import FreeCAD directly.
```bash
# Fixed MCP approach
python run_live_house_test_fixed.py
```
**What happens:**
1. π Starts FreeCAD as separate process
2. π Establishes MCP connection to FreeCAD
3. π‘ Sends commands to FreeCAD via connection manager
4. ποΈ Builds house using proper MCP workflow
## π What These Tests Build
Both approaches create the same house model:
1. **ποΈ Foundation** - 10m Γ 8m Γ 0.3m concrete slab (brown)
2. **π§± Four Walls** - 3m high, 0.3m thick brick walls (red)
3. **πͺ Two Windows** - 1.2m Γ 1.5m front windows (blue transparent)
4. **πͺ One Door** - 0.9m Γ 2.1m front door (blue transparent)
## π Usage Examples
### Basic Usage:
```bash
# Recommended - simple and reliable
python run_house_macro.py
# Fixed MCP approach (more complex)
python run_live_house_test_fixed.py
```
### Custom Timing:
```bash
# For macro approach - edit STEP_DELAY in house_modeling_macro.FCMacro
# Then run:
python run_house_macro.py
# For MCP approach - use delay parameter
python run_live_house_test_fixed.py --delay 1.0 # Fast (1s steps)
python run_live_house_test_fixed.py --delay 5.0 # Slow (5s steps)
```
### Direct FreeCAD Macro:
```bash
# Run macro directly in FreeCAD
./FreeCAD_1.0.0-conda-Linux-x86_64-py311.AppImage --run-macro house_modeling_macro.FCMacro
```
## π§ Requirements
- **FreeCAD AppImage** must be in project root: `FreeCAD_1.0.0-conda-Linux-x86_64-py311.AppImage`
- **Python environment** with MCP-FreeCAD dependencies (for MCP approach)
- **GUI environment** (X11/Wayland) for visual display
## π¬ What You'll See
When running either test, you'll watch:
1. **π FreeCAD starting** with splash screen
2. **π New document creation**
3. **ποΈ Foundation appearing** (brown rectangular base)
4. **π§± Walls rising** one by one (red brick walls)
5. **πͺ Windows appearing** (blue transparent openings)
6. **πͺ Door being cut** (blue transparent opening)
7. **π¨ Final view adjustment** (isometric view, fit all)
Each step has a delay (default 2 seconds) so you can follow the construction process!
## π Troubleshooting
### Error: "No module named 'FreeCAD'"
- **Solution:** Use `run_house_macro.py` (recommended) or the fixed MCP version
- **Cause:** Original scripts tried to import FreeCAD from outside FreeCAD
### Error: "FreeCAD AppImage not found"
- **Solution:** Ensure `FreeCAD_1.0.0-conda-Linux-x86_64-py311.AppImage` is in project root
- **Check:** `ls -la FreeCAD_*.AppImage`
### Error: Connection issues (MCP approach)
- **Solution:** Try the macro approach instead: `python run_house_macro.py`
- **Alternative:** Check FreeCAD is properly started before connection attempts
### FreeCAD doesn't show GUI
- **Solution:** Ensure you're in a GUI environment (not headless SSH)
- **Check:** Try `echo $DISPLAY` - should show something like `:0`
## π Comparison
| Approach | Reliability | Setup Complexity | MCP Demo Value |
|----------|-------------|------------------|----------------|
| **Macro** | βββββ | βββββ | βββ |
| **Fixed MCP** | ββββ | βββ | βββββ |
**Recommendation:** Start with the **macro approach** for reliability, then try the **MCP approach** to see the full connection architecture in action!
## π― Next Steps
After running the live house test:
1. **π Inspect the model** - Rotate, zoom, explore the 3D house
2. **βοΈ Modify objects** - Try changing dimensions in the tree view
3. **πΎ Export the model** - Save as STL, STEP, or other formats
4. **π§ Modify the code** - Customize house dimensions, add rooms, etc.
5. **π Build your own tests** - Use this as a template for other models!