This is the Python backend service that handles Archicad integration for the ts-ifc-api project. It communicates with Archicad via the Archicad API and with the Node.js backend via WebSocket for real-time progress updates.
✅ Production Ready - 100% Complete
- ✅ Archicad .pln to IFC conversion (bidirectional)
- ✅ IFC to Archicad .pln import
- ✅ WebSocket communication with Node.js backend
- ✅ Real-time conversion progress tracking
- ✅ Plugin status monitoring
- ✅ Job management and tracking
- ✅ Error handling and logging
- Python 3.8+ (3.13+ recommended)
- Archicad 28.4 installed and running
- Archicad API enabled (Options → Work Environment → Add-On Manager)
- Node.js backend running on port 3000
- Archicad Plugin installed and running
- Create a virtual environment:
python -m venv venv-python- Activate the virtual environment:
# Windows
venv-python\Scripts\activate
# Linux/macOS
source venv-python/bin/activate- Install dependencies:
pip install -r requirements.txt- Copy
.env.exampleto.envand configure:
cp .env.example .env- Edit
.envwith your settings:
FLASK_PORT=5000
NODE_WS_URL=ws://localhost:3000/ws/python-bridgepython src/server.pyThe server will:
- Start Flask on port 5000 (default)
- Connect to Node.js WebSocket bridge
- Wait for Archicad to be available
GET /healthReturns the status of the Python server, Archicad connection, and Node.js WebSocket.
POST /convert/archicad-to-ifc
Content-Type: multipart/form-data
file: <.pln file>
jobId: <optional job ID for tracking>Converts an Archicad .pln file to IFC format. Progress updates are sent via WebSocket to the Node.js backend.
POST /trigger-revit-conversion
Content-Type: application/json
{
"ifcPath": "/path/to/file.ifc",
"outputPath": "/path/to/output.rvt",
"jobId": "optional-job-id"
}Triggers an IFC to Revit conversion by sending a command to the Node.js backend, which forwards it to the Revit plugin.
GET /jobs/<job_id>/statusRetrieves the status of a conversion job from the Node.js backend.
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Python │◄───WS───┤ Node.js │◄───WS───┤ Revit │
│ Service │ │ Backend │ │ Plugin │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Archicad │ │ Frontend │
│ API │ │ Clients │
└─────────────┘ └─────────────┘
identify- Service identification on connectionprogress_update- Job progress updatejob_error- Job error notificationtrigger_revit_conversion- Request Revit conversionget_job_status- Request job statuspong- Heartbeat response
connection_ack- Connection acknowledgmenttrigger_archicad_conversion- Request Archicad conversionping- Heartbeat check
Main Flask application with API endpoints:
- Health check endpoint
- Conversion endpoints (PLN ↔ IFC)
- Job status tracking
- Error handling
WebSocket client for communicating with Node.js backend:
- Auto-reconnection with exponential backoff
- Message routing and handling
- Real-time progress updates
- Bidirectional communication
- Heartbeat/ping-pong support
Service for interacting with Archicad Plugin:
- WebSocket connection management
- .pln to IFC export
- IFC to .pln import
- Project operations
- Progress callbacks
- Job lifecycle management
# Set debug mode in .env
FLASK_DEBUG=True
# Run server
python src/server.pyYou can test the WebSocket connection using a WebSocket client:
const ws = new WebSocket("ws://localhost:3000/ws/python-bridge");
ws.onopen = () => {
console.log("Connected to Node.js");
ws.send(
JSON.stringify({
type: "identify",
service: "test-client",
version: "1.0.0",
}),
);
};
ws.onmessage = (event) => {
console.log("Received:", JSON.parse(event.data));
};Problem: Failed to connect to Archicad: Connection refused
Solution:
- Ensure Archicad is running
- Verify Archicad plugin is installed in Add-Ons folder
- Check plugin is loaded: Options → Add-On Manager
- Ensure WebSocket server started (check Archicad console/logs)
- Check that port 8081 is not blocked by firewall
Problem: WebSocket connection error: Connection refused
Solution:
- Ensure Node.js backend is running on port 3000
- Check
NODE_WS_URLin.envis correct - Verify firewall settings
Problem: Conversion takes too long and times out
Solution:
- Large files may take several minutes (this is normal)
- Increase timeout in Node.js service if needed
- Check Archicad is not showing modal dialogs or user prompts
- Monitor progress updates via WebSocket
- Consider splitting very large models (> 100MB)
Typical conversion times:
| Project Size | Elements | Conversion Time |
|---|---|---|
| Small | < 500 | 10-30s |
| Medium | 500-2000 | 30-90s |
| Large | 2000-5000 | 90-180s |
| Very Large | > 5000 | 180s+ |
- Extended unit test coverage
- Batch processing support
- Performance optimizations for large models
- Additional IFC schema versions support
- Job cancellation from Python side
GNU General Public License v3.0 or later
See COPYING for details.
Matheus Piovezan Teixeira
- GitHub: @Shobon03