06b66145b62921280d6676459cfbbd447e176d6e
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
Speckle → IFC 4.3 Exporter (Rhino)
A Speckle Automate function that converts Speckle models (from Rhino and other authoring tools) into IFC 4.3 files.
How It Works
- Receives a Speckle model version via Speckle Automate.
- Traverses the nested Collection tree to find all BIM elements.
- Classifies each element into its IFC type (e.g.
IfcColumn,IfcWall) using theAttributes.typeproperty. - Exports geometry — meshes, instances (block definitions), and curves — into IFC representations.
- Clones properties — attributes, property sets, and quantities — from the Speckle object onto the IFC entity.
- Writes the resulting
.ifcfile.
Supported Property Formats
The exporter handles two property formats:
Nested (ArchiCAD / IFC-native)
Properties are stored as nested dicts under _properties:
_properties:
Attributes:
Name: "MyColumn"
type: "IfcColumn"
Property Sets:
Pset_ColumnCommon:
IsExternal: true
Quantities:
BaseQuantities:
Height: {name: "Height", units: "millimetre", value: 3000}
Flat Dot-Notation (Rhino / Speckle)
Properties are stored as flat key-value pairs with dot-separated paths under properties:
properties:
Attributes.Name: "600S162-43-50"
Attributes.type: "IfcColumn"
Attributes.GlobalId: "yOTS1rnOhBKW4JIfec29TS"
Quantities.BaseQuantities.Gross Weight.value: "15.452"
Quantities.BaseQuantities.Member Length.value: "118.938"
The exporter automatically detects the format and unflattens dot-notation keys into the nested structure before processing.
Function Inputs
| Input | Description |
|---|---|
file_name |
Output IFC filename (timestamp is appended) |
IFC_PROJECT_NAME |
Name for the IfcProject entity |
IFC_SITE_NAME |
Name for the IfcSite entity |
IFC_BUILDING_NAME |
Name for the IfcBuilding entity |
Project Structure
main.py # Automate entry point — traversal, export loop, IFC writing
utils/
traversal.py # Walks the Speckle Collection tree
mapper.py # Maps Speckle objects → IFC entity classes
properties.py # Extracts & writes attributes, property sets, quantities
geometry.py # Mesh → IFC geometry conversion
instances.py # Block instance / definition handling
curves.py # Curve geometry (Polycurve, Line, Arc)
writer.py # IFC scaffold creation, storey management
type_manager.py # IfcTypeObject creation & assignment
materials.py # Material mapping
helpers.py # Shared utilities (_get, unit scales)
receiver.py # Speckle server connection & data retrieval
Getting Started
Prerequisites
- Python 3.11+
- A Speckle account and project
Setup
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
pip install --upgrade pip
pip install .[dev]
Running Locally
Register and run via Speckle Automate, or test locally with Docker:
docker build -f ./Dockerfile -t ifc-exporter-rhino .
docker run --rm ifc-exporter-rhino python -u main.py run '<automation_context_json>' '<function_inputs_json>' <speckle_token>
Testing
pytest
Using with Speckle Automate
- Go to the Automations tab in your project
- Click New Automation
- Select your function from the library
- Configure function inputs and parameters
- Choose a Speckle model to trigger the automation
- Name your automation and click Create
Resources
Description
Languages
Python
99.3%
Dockerfile
0.7%