Building IfcBlender: Installation and Dependency Guide IfcBlender is a powerful open-source extension that allows Blender to import and work with Industry Foundation Classes (IFC) files, which are standard in Building Information Modeling (BIM). While pre-built binaries exist, building IfcBlender from source ensures you have the latest features, custom optimizations, and compatibility with specific development environments.
This technical guide walks you through the prerequisites, dependency compilation, and final build process for IfcBlender. 1. Prerequisites and System Setup
Before compiling, you need to set up a robust development environment. The core requirements vary slightly by operating system, but the fundamental toolchain remains the same. Required Build Tools Git: For cloning the repositories and managing submodules.
CMake (Version 3.18 or higher): To generate the build configuration files. C++ Compiler:
Windows: Visual Studio 2019 or 2022 (with “Desktop development with C++” workload). Linux: GCC (version 9+) or Clang. macOS: Xcode Command Line Tools. Target Software Environments
Blender Installation: You need a local installation of Blender to map the Python environment. Note down your Blender version (e.g., Blender 3.6 or 4.x), as IfcBlender must match Blender’s internal Python version exactly.
Python: The exact version used by your target Blender release (typically Python 3.10 or 3.11). 2. Understanding and Compiling Dependencies
IfcBlender relies heavily on IfcOpenShell, an open-source IFC software library. Building IfcBlender essentially means building the IfcOpenShell codebase with the Blender integration enabled. The build pipeline requires several heavy dependencies:
Open CASCADE Technology (OCCT): The geometry kernel used to interpret and render 3D architectural shapes from IFC data.
SWIG (Simplified Wrapper and Interface Generator): Used to connect the C++ core of IfcOpenShell to Python.
Boost C++ Libraries: Used for parsing, multithreading, and structural data types.
HDF5 and Graphviz (Optional): Used for advanced data serialization and structural visualization. Step-by-Step Dependency Installation On Linux (Ubuntu/Debian)
You can install most dependencies directly via the package manager, saving significant compilation time:
sudo apt-get update sudo apt-get install -y git cmake build-essential libboost-all-devlibocct-modeling-algorithms-dev libocct-modeling-data-dev libocct-data-exchange-dev libocct-visualization-dev swig python3-dev Use code with caution. On Windows and macOS
For Windows and macOS, it is highly recommended to use the automated dependency builder provided in the IfcOpenShell repository, as manual compilation of OCCT and Boost can be error-prone. 3. Cloning the Source Code
Clone the IfcOpenShell repository recursively to ensure all submodules and internal repositories are pulled properly. git clone –recursive https://github.com cd IfcOpenShell Use code with caution.
If you forgot the –recursive flag, initialize the submodules manually: git submodule update –init –recursive Use code with caution. 4. Configuring and Building with CMake
Create a separate build directory to keep the source tree clean. You will use CMake to point to your dependencies and specify that you are building the Blender module. Creating the Build Directory mkdir build cd build Use code with caution. Configuring CMake
You must pass specific flags to CMake to enable the Blender wrapper (BUILD_IFCBLENDER) and point to the correct Python executable used by Blender.
cmake ../cmake -DCOLLADA_SUPPORT=OFF -DBUILD_EXAMPLES=OFF -DBUILD_GEOMSERVER=OFF -DBUILD_IFCBLENDER=ON -DPYTHON_EXECUTABLE=/path/to/blender/python/executable -DGLM_INCLUDE_DIR=/path/to/glm Use code with caution.
Note for Windows users: If using the graphical user interface (CMake-GUI), set the source code path to IfcOpenShell/cmake and the build path to IfcOpenShell/build. Manually check the box for BUILD_IFCBLENDER. Executing the Build
Once configuration finishes without errors, compile the project.
# Using CMake to initiate the build cmake –build . –config Release –target IfcBlender Use code with caution.
To speed up compilation on multi-core processors, append flags like -j8 (for Linux/macOS) or – /m (for Windows MSBuild). 5. Installing the Module into Blender
Once compilation finishes, the build system outputs a zipped Python module or a set of compiled binaries (including .pyd or .so files depending on your OS) inside the output directory.
Locate the generated io_import_scene_ifc directory in your build output.
Compress this directory into a .zip archive if it isn’t already. Open Blender. Navigate to Edit > Preferences > Add-ons.
Click Install… at the top right, select your compiled .zip file, and click Install Add-on.
Check the box next to Import-Export: IfcBlender to activate it. Troubleshooting Common Build Issues
Python Version Mismatch: If Blender crashes immediately upon enabling the add-on, your compiled IfcBlender was likely linked against a different Python version than the one embedded inside Blender. Re-configure CMake and verify PYTHON_EXECUTABLE points directly to Blender’s internal Python binary.
Missing OCCT Binaries: If CMake fails to find Open CASCADE, explicitly define -DOPEN_CASCADE_INCLUDE_DIR and -DOPEN_CASCADE_LIBRARY_DIR pointing to your installation.
SWIG Errors: Ensure SWIG is added to your system’s environment variables (PATH) so CMake can call it automatically during wrapper generation.