IfcPlusPlus
Description
IFC++ ou IfcPlusPlus est une bibliothèque C++ open source (licence MIT) du projet IfcQuery pour la lecture, l'écriture et la visualisation de fichiers IFC .
La bibliothèque IFC++ peut être utilisée à des fins générales et comprend également un exemple d'application de visualisation IFC. Cette visionneuse est basée sur Qt 5 et OpenSceneGraph (OSG) et peut charger de gros fichiers IFC très rapidement. Elle peut donc être utilisée pour comparer les performances d'autres visionneuses IFC, comme Blender et FreeCAD, qui utilisent en interne la bibliothèque IfcOpenShell.
L'exemple de visionneuse IFC inclus dans la distribution source des bibliothèques IfcQuery/IFC ++.
Remarque: dans l'usage courant, les noms "IfcQuery", "IFC++" et "IfcPlusPlus" peuvent être utilisés de manière interchangeable pour désigner la même chose, la bibliothèque C++, ou plus spécifiquement le visualiseur IFC gratuit.
Installation
La distribution IFC++ est fournie sous forme de code source, donc pour utiliser la bibliothèque et le visualiseur, le code doit être compilé.
IFC ++ est développé principalement sur une plate-forme Windows aussi il inclut des fichiers solution (.snl
) et projet (.vcxproj
) pour compiler la bibliothèque dynamique IfcPlusPlus.dll
à l'aide de Visual Studio. Une bibliothèque statique libIfcPlusPlus.a
peut également être produite pour Linux en utilisant CMake.
Remarque: il existe un visualiseur plus complet qui utilise des bibliothèques IFC++ précompilées destinées à Windows. Cette visionneuse est gratuite mais n'est pas open source. Il est disponible en téléchargeant le package SimpleViewerExampleQt.zip
depuis http://www.ifcquery.com/
et en exécutant SimpleViewerExampleQt.exe
. Ce visualiseur est autonome, tout ce dont il a besoin pour s'exécuter est inclus dans l'archive .zip
.
Compilation sous Windows
Suivez les instructions du dépôt officiel ifcplusplus.
Compilation sous Linux
Les instructions générales sont les suivantes:
- Récupérez le code source d'IFC ++ depuis son dépôt principal.
- Rassemblez toutes les dépendances pour la compilation, y compris un compilateur C++, CMake et Make, et les fichiers de développement pour Boost, Qt 5, ainsi que la bibliothèque OpenSceneGraph (OSG) pour la visualisation.
- Exécutez
cmake
pour générer unMakefile
, puis démarrez la compilation en exécutantmake
. - Installez les bibliothèques
libIfcPlusPlus.a
etlibcarve.so
dans le chemin de bibliothèque approprié afin qu'elles soient trouvées par le visualiseur d'exemples IFC++.
Prérequis
Dans une distribution basée sur Debian/Ubuntu, obtenir les fichiers de développement requis est généralement simple.
sudo apt install git cmake gcc g++ libboost-all-dev
sudo apt install qt5-qmake qtbase5-dev qttools5-dev libqt5widgets5 libqt5opengl5-dev
Obtenez le code source du projet et placez-le dans un répertoire personnalisé auquel vous avez un accès en écriture complet.
git clone https://github.com/ifcquery/ifcplusplus ifcplusplus-source
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.
sudo apt install libopenscenegraph-3.4-dev
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.
git clone https://github.com/openscenegraph/OpenSceneGraph OpenSceneGraph-source
mkdir -p OpenSceneGraph-build
cd OpenSceneGraph-build
cmake ../OpenSceneGraph-source
make -j 3
sudo make install
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, libIfcPlusPlus.a
, 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++, libcarve.so
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.
mkdir -p ifcplusplus-build
cd ifcplusplus-build
cmake ../ifcplusplus-source/
By default the type of build is Release
but it can also be set to Debug
.
cmake -DCMAKE_BUILD_TYPE=Debug ../ifcplusplus-source/
Actual compilation
If there were no error messages during configuration with CMake, a Makefile
should have been created in the build directory, so you can proceed to compile the libraries by running make
.
make -j N
N
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 Release/
subdirectory with the newly compiled libraries.
Release/libcarve.so
Release/libIfcPlusPlus.a
Release/SimpleViewerExample
You can launch the SimpleViewerExample
executable with an IFC file as input.
Release/SimpleViewerExample IfcOpenHouse.ifc
If the build type was set to Debug
, then the compiled libraries will appear in the Debug/
subdirectory instead.
Installation of the compiled libraries
If the compilation doesn't report any errors, you may run make install
to copy the headers, compiled libraries, and binaries to their corresponding installation directories.
sudo make install
By default, the CMAKE_INSTALL_PREFIX
is /usr/local/
, so all compiled files will be placed under this directory, which normally requires elevated privileges.
/usr/local/bin/SimpleViewerExample
/usr/local/lib/libcarve.so
/usr/local/lib/libIfcPlusPlus.a
/usr/local/include/carve/*.{h, hpp}
/usr/local/include/ifcpp/geometry/*.h
/usr/local/include/ifcpp/geometry/Carve/*.h
/usr/local/include/ifcpp/geometry/OCC/*.h
/usr/local/include/ifcpp/IFC4/*.h
/usr/local/include/ifcpp/IFC4/include/*.h
/usr/local/include/ifcpp/model/*.h
/usr/local/include/ifcpp/reader/*.h
/usr/local/include/ifcpp/writer/*.h
/usr/local/share/IFCPP/cmake/*.cmake
Library path
Once SimpleViewerExample
is placed in /usr/local/bin
, the executable will be available in the entire system. However, in certain platforms libcarve.so
may not be found if it is installed in the default /usr/local/lib
directory.
SimpleViewerExample: error while loading shared libraries: libcarve.so: cannot open shared object file: No such file or directory
If this is the case, it may be enough to update the cache of the ld.so
library loader by calling ldconfig
:
sudo ldconfig
Or you may have to move the library to the correct directory first:
sudo mkdir -p /usr/local/lib/x86_64-linux-gnu/
sudo mv /usr/local/lib/libcarve.so /usr/local/lib/x86_64-linux-gnu/libcarve.so
sudo ldconfig
Alternatively, you may set the LD_LIBRARY_PATH
variable to the directory containing libcarve.so
, before launching the executable:
LD_LIBRARY_PATH=/usr/local/lib SimpleViewerExample
To make this effect persistent, this environmental variable can be set in the shell resource file, for example, .bashrc
, so that it is propagated to all terminal instances on startup:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Removing the compiled libraries
To remove the installed libraries, just remove the corresponding files that were installed.
sudo rm -rf /usr/local/bin/SimpleViewerExample
sudo rm -rf /usr/local/lib/libcarve.so
sudo rm -rf /usr/local/lib/libIfcPlusPlus.a
sudo rm -rf /usr/local/include/carve
sudo rm -rf /usr/local/include/ifcpp
sudo rm -rf /usr/local/share/IFCPP/cmake/
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.
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 SimpleViewerExample
, there are two buttons in the main interface which are invisible if the custom style sheet is not found.
QIODevice::read (QFile, ":styles.css"): device not open
The style must be included in the CMake configuration in the section devoted to the Qt libraries:
# ifcplusplus-source/examples/SimpleViewerExampleQt/CMakeLists.txt
...
ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS})
SET(viewer_dir ${IFCPP_SOURCE_DIR}/examples/SimpleViewerExampleQt)
SET(RESOURCES ${viewer_dir}/Resources/ifcplusplus.qrc)
QT5_ADD_RESOURCES(SimpleViewerExample_RESOURCES_RCC ${RESOURCES})
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
- Éléments : Mur, Structure, Mur-rideau, Fenêtre, Toiture, Espace, Escalier, Équipement, Ossature, Clôture, Treillis, Profilé, Conduite, Raccord
- Renforcements : Armature droite, Armature en U, Armature en L, Armature en étrier, Armature cintrée, Armature hélicoïdale, Rebar Armature en colonne, Rebar Poutre, Rebar Renfort de dalle, Rebar Renfort de semelle, Armature personnalisée
- Panneaux : Panneau, Découpe de panneau, Feuille de panneaux, Calepinage
- Matériaux : Matériau, Matériaux multiples
- Organisations : Partie de bâtiment, Projet, Site, Bâtiment, Étage, Référence externe, Plan de coupe, Nomenclature
- Axes : Axes, Système d'axes, Grille
- Modifications : Couper suivant un Plan, Ajouter un composant, Enlever un composant, Prendre des cotes
- Utilitaires : Composant, Cloner un composant, Diviser un maillage, Maillage vers une forme, Sélection de maillages non-manifold, Supprimer la forme, Fermer les trous, Fusionner des murs, Vérification, Bascule marqueur Brep IFC, Explorateur IFC, 3 vues depuis un maillage, Tableur IFC, Bascule des sous composants
- Additionnels : Préférences, Préférences Import-Export (IFC, DAE, OBJ, JSON, 3DS, SHP), IfcOpenShell, IfcPlusPlus, Arch API
- Matériaux : Solide, Fluide, Mécanique non linéaire, Renforcé (type béton) ; Éditeur de matériaux
- Géométrie de l'élement : Poutre (1D), Rotation de poutre (1D), Coque (2D), Section fluide (1D)
Contraintes
- Électromagnétique : Potentiel électrostatique, Densité de courant, Magnétisation
- Géometrique : Rotation plane, Empreinte de section, Transformation
- Mécanique : Immobilisation, Déplacement, Contact, Liaison, Ressort, Force, Pression, Centrifuge, Poids propre
- Thermique : Température initiale, Flux de chaleur, Température, Source thermique
- Remplacer les Constantes : Permittivité du vide
- Maillage : Maillage Netgen, Maillage GMSH, Couche limite de maillage, Région de maillage, Groupe de maillage, Ensemble de nœuds, Maillage à maillage
- Solveur : CalculiX Standard, Elmer, Mystran, Z88 ; Équations : Déformation, Élasticité, Électrostatique, Force électrique, Magnétodynamique, Magnétodynamique 2D, Écoulement, Flux, Chaleur ; Solveur : Réglage du solveur, Calcul du solveur
- Résultats : Purger, Afficher ; Postprocessing : Appliquer les modifications, Pipeline du résultat, Filtre des déformations, Filtre d'écrêtage scalaire, Filtre de fonction de découpe, Filtre d'écrêtage selon une région, Filtre par contours, Filtre d'écrêtage selon une ligne, Graphique de linéarisation des critères, Données du filtre d'écrêtage du point, Filtre fonction plan, Filtre fonction sphère, Filtre fonction cylindre, Filtre fonction boîte
- Utilitaires : Plan de coupe, Supprimer les plans de coupe, Exemples ; Supprimer le maillage, Affichage des informations du maillage
- Additionnel : Préférences ; Installation, FEM Maillage, Solveur, CalculiX, FEM Béton ; FEM Types d'élements
- Démarrer avec FreeCAD
- Installation : Téléchargements, Windows, Linux, Mac, Logiciels supplémentaires, Docker, AppImage, Ubuntu Snap
- Bases : À propos de FreeCAD, Interface, Navigation par la souris, Méthodes de sélection, Objet name, Préférences, Ateliers, Structure du document, Propriétés, Contribuer à FreeCAD, Faire un don
- Aide : Tutoriels, Tutoriels vidéo
- Ateliers : Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test