Python client for the Ifc2Data API
Project description
Ifc2Data Python Client
A Python client for the Ifc2Data API https://www.ifc2data.com/
Ifc2Data allows you to upload IFC files and export structured datasets in multiple formats such as XLSX, CSV, SQL, JSON, and more.
This package provides both:
- A synchronous client (
Client) - An asynchronous client (
AsyncClient)
for seamless integration into Python applications, automation workflows, and backend services.
Features
- Synchronous and asynchronous support
- Multiple output formats supported
- Built-in parameter validation
- Automatic retry mechanism for network reliability
- Lightweight and easy to integrate
Installation
pip install ifc2data
Prerequisites
Before using this package :
- Create an account on Ifc2Data : https://www.ifc2data.com/signup/
- Request an API key : yohann.schatz@hesge.ch
Quick Start
Synchronous Client
from ifc2data import Client
api_key = "YOUR_API_KEY"
file_path = r"C:\path\to\your\file\File.ifc"
output_format = "xlsx"
parameters = {
"elements": ["IfcWall"],
"properties": ["IsExternal", "LoadBearing"],
"quantities": []
}
client = Client(api_key)
result = client.run(
file_path=file_path,
output_format=output_format,
parameters=parameters
)
if result.done:
output_path = client.download(
result,
r"C:\path\to\your\file"
)
print("Saved to:", output_path)
Asynchronous Client
import asyncio
from ifc2data import AsyncClient
api_key = "YOUR_API_KEY"
file_path = r"C:\path\to\your\file\File.ifc"
output_format = "xlsx"
parameters = {
"elements": ["IfcWall"],
"properties": ["IsExternal", "LoadBearing"],
"quantities": []
}
async def main():
client = AsyncClient(api_key)
result = await client.run(
file_path=file_path,
output_format=output_format,
parameters=parameters
)
if result.done:
output_path = await client.download(
result,
r"C:\path\to\your\file"
)
print("Saved to:", output_path)
asyncio.run(main())
How it works
- Upload an IFC model
- Configure extraction parameters
- Execute the processing pipeline
- Receive a structured API response
- Download the generated output file
Response
Response Object
The run() method returns a PipelineResponse object.
print(result.status)
print(result.message)
if result.data:
print(result.data.id)
print(result.data.file_name)
Response Structure
| Attribute | Type | Description |
|---|---|---|
status |
str |
Pipeline execution status |
message |
str |
Human-readable API message |
data |
PipelineData |
Processed file information |
done |
bool |
Returns True if processing succeeded |
Output Formats
| Format | Key |
|---|---|
| BSON (MongoDB) | bson |
| CSV | csv |
| JSON | json |
| RDF | rdf |
| SQL | sql |
| SQL (3NF) | sql_3nf |
| SQLite | sqlite |
| SQLite (3NF) | sqlite_3nf |
| Excel (XLSX) | xlsx |
Parameters
The parameters dictionary controls how IFC data is filtered and exported.
Available Parameters
| Key | Required | Type | Empty Allowed | Description |
|---|---|---|---|---|
elements |
Yes | List[str] |
No | IFC classes to extract |
classifications |
No | List[str] |
Yes | Classification filters |
documents |
No | List[str] |
Yes | Document filters |
materials |
No | List[str] |
Yes | Material filters |
properties |
No | List[str] |
Yes | Property filters |
quantities |
No | List[str] |
Yes | Quantity filters |
Parameter Examples
Minimal Example
parameters = {
"elements": ["IfcWall"]
}
Multiple IFC Elements
parameters = {
"elements": [
"IfcWall",
"IfcDoor",
"IfcWindow"
]
}
Property Filtering
parameters = {
"elements": ["IfcWall"],
"properties": [
"FireRating",
"LoadBearing",
"IsExternal"
]
}
Material Filtering
parameters = {
"elements": ["IfcSlab"],
"materials": [
"Concrete",
"Steel"
]
}
Quantity Extraction
parameters = {
"elements": ["IfcBeam"],
"quantities": [
"Length",
"Area",
"Volume"
]
}
No Filter Example
parameters = {
"elements": ["IfcWall"],
"properties": []
}
Validation Rules
The SDK validates parameters before sending requests to the API.
Validation includes:
- Required parameter checks
- Output format validation
- IFC class validation
- Parameter type validation
- Unknown parameter detection
Invalid configurations raise a ValueError.
Error Handling
try:
result = client.run(
file_path,
output_format,
parameters
)
except ValueError as e:
print("Validation error:", e)
except Exception as e:
print("Request failed:", e)
Verbose Mode
Enable verbose mode to inspect API requests and responses.
result = client.run(
file_path=file_path,
output_format="xlsx",
parameters=parameters,
verbose=True
)
Verbose mode displays:
- Request URL
- Output format
- Parameters
- HTTP response status
- API response payload
Notes
- IFC files must be valid and readable
- Network retries are automatically handled internally
- Empty filter lists are normalized automatically
- Downloaded files are streamed to disk to reduce memory usage
License
This project is licensed under the MIT License.
Author
Yohann Schatz
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ifc2data-1.1.0.tar.gz.
File metadata
- Download URL: ifc2data-1.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49b67118e60d43d2d0604a7d8fb5bf89f659656e3d0f20747c566f9202609597
|
|
| MD5 |
b222b656d7eda0fa172851b9cc7fac66
|
|
| BLAKE2b-256 |
9e9f1dfe144d2cba59117af8f1658fd7212fa776d1f7a9546c8f05e76cd72a33
|
File details
Details for the file ifc2data-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ifc2data-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86e394cf6a9d22572e3e2accb149feda4bcf37ac0cd745b25ecdd1cf2ee7ec83
|
|
| MD5 |
5e7c77448b6b1c5f33971b853531196c
|
|
| BLAKE2b-256 |
b1af905fbaa514843ba1596e6a77ffa70a8102e30900a11610dfb73f2d6d9ee2
|