IfcPlusPlus

Description
IFC++ or IfcPlusPlus is a C++ open source (MIT license) library from the IfcQuery project for reading, writing, and viewing IFC files.

The IFC++ library can be used for general purpose, and it also includes a sample IFC visualization application. This viewer is based on Qt 5 and OpenSceneGraph (OSG), and can load big IFC files very fast, and thus can be used to compare the performance of other IFC viewers, like Blender and FreeCAD, which internally use the IfcOpenShell library.



in common usage, the names "IfcQuery", "IFC++", and "IfcPlusPlus" are used interchangeably to refer to the same thing, the C++ library, and the free IFC viewer in particular.

Installing
The IFC++ distribution is provided as source code, so to use the library and the viewer, the code must be compiled.

IFC++ is developed mostly on a Windows platform, so it includes solution and project  files to compile the  dynamic library using Visual Studio. A static library can also be produced for Linux using CMake.

there is a more complete viewer that uses pre-compiled IFC++ libraries intended for Windows. This viewer is free for use but is not open source. It is available by downloading the package from http://www.ifcquery.com/, and running. This viewer is self-contained, everything that it requires to run is included in the archive.

Compiling in Windows
Follow the instructions in the official ifcplusplus repository.

Compiling in Linux
The general instructions are as follows:
 * 1) Get the source code of IFC++ from its main repository.
 * 2) Gather all dependencies for compiling, including a C++ compiler, CMake, and Make, and the development files for Boost, Qt 5, as well as the OpenSceneGraph (OSG) library for visualization.
 * 3) Run  to generate a, then start the compilation by running.
 * 4) Install the  and  libraries to the appropriate library path so that they are found by the IFC++ sample viewer.

Prerequisites
In a Debian/Ubuntu based distribution, getting the required development files is usually simple.

Get the source code of the project and place it in a custom directory to which you have full write access.

OpenSceneGraph
OpenSceneGraph (OSG) is a collection of C++ libraries that uses OpenGL for 3D visualization; it can be used in games, virtual reality, scientific visualization and modelling.

If the files are too old in your distribution, you may also compile the libraries yourself. The procedure is outlined in the main repository, openscenegraph/OpenSceneGraph. Compiling is straight forward, although you may need various dependencies like Qt 5, Freetype, Inventor, OpenEXR, COLLADA, ZLIB, GDAL, FFmpeg, Gstreamer, SDL, Cairo, and Poppler.

Carve
Carve is a constructive solid geometry (CSG) C++ library designed to perform boolean operations between two arbitrary polygonal meshes. Together with the IFC++ library,, Carve is used by the IFC++ sample viewer to open and display IFC files.


 * Original repository: carve, GPL2, from 2009 to 2011.
 * New repository: folded/carve, from 2011 onwards; the project changed to the MIT License starting on October, 2015.

As the project is now MIT licensed, copies of the Carve source files are now included in the IFC++ repository. This means that when compiling IFC++, will be compiled as well. This library must be available in the system for the IFC++ sample viewer to work properly.

CMake configuration
It is recommended to perform the configuration and compilation in a specific build directory separate from the source directory.

By default the type of build is but it can also be set to.

Actual compilation
If there were no error messages during configuration with CMake, a should have been created in the build directory, so you can proceed to compile the libraries by running.

is the number of processors that you assign to the compilation process; choose at least one fewer than the total number of CPU cores that you have.

Testing the compilation in the build directory
If the build was successful you should have a subdirectory with the newly compiled libraries.

You can launch the executable with an IFC file as input.

If the build type was set to, then the compiled libraries will appear in the subdirectory instead.

Installation of the compiled libraries
If the compilation doesn't report any errors, you may run to copy the headers, compiled libraries, and binaries to their corresponding installation directories.

By default, the is, so all compiled files will be placed under this directory, which normally requires elevated privileges.

Library path
Once is placed in, the executable will be available in the entire system. However, in certain platforms may not be found if it is installed in the default  directory.

If this is the case, it may be enough to update the cache of the library loader by calling :

Or you may have to move the library to the correct directory first:

Alternatively, you may set the variable to the directory containing, before launching the executable:

To make this effect persistent, this environmental variable can be set in the shell resource file, for example,, so that it is propagated to all terminal instances on startup:

Removing the compiled libraries
To remove the installed libraries, just remove the corresponding files that were installed.

Fixes for Linux
The IFC++ library is developed by its author on a Windows system. This means that even if the code depends on multiplatform libraries like Boost, Qt, and OpenSceneGraph, the code is mostly tested to compile and run on Windows. Nevertheless, over the years other developers have provided fixes to the project so that IFC++ can be compiled and run on Linux distributions.

In particular, a fork of the main project is maintained with small fixes to compile and run better in Debian.
 * berndhahnebach/ifcplusplus

If the code of the official repository does not work or seems to have issues in Linux, try following the same compilation instructions but using the sources from this alternative repository. This repository is often some commits behind the main distribution, but it aims to remain up to date, and at the same time provide some Linux specific fixes. These improvements are normally submitted back to the main repository in order to make the official branch compile on Linux without issues.

The main developer of IFC++ does not support Linux directly, so Linux developers should be prepared to troubleshoot problems, fix them, and submit patches when using IFC++ in Linux.

Invisible icons
For the, there are two buttons in the main interface which are invisible if the custom style sheet is not found.

The style must be included in the CMake configuration in the section devoted to the Qt libraries:

More information

 * IFC++ project page
 * ifcquery/ifcplusplus repository
 * Alternative repository, especially for Debian: berndhahnebach/ifcplusplus
 * Forum thread: IFC Viewer ifcplusplus (2013 to 2020)
 * IfcPlusPlus compiled on Gentoo - questions and alternatives?
 * German thread: IfcQuery / IfcPlusPlus selber kompilieren