IfcOpenShell/es

Descripción
IfcOpenShell es una biblioteca de software de código abierto (LGPL 3) que ayuda a los desarrolladores a trabajar con el formato de archivo industry foundation classes (IFC). El formato de archivo IFC puede utilizarse para describir datos de construcción y edificación. El formato se utiliza habitualmente para building information modelling (BIM), por ejemplo, para el análisis de cargas mecánicas y para los estudios de eficiencia térmica y energética. IfcOpenShell es principalmente una colección de librerías C++, sin embargo, como tiene enlaces Python, puede integrarse con programas como FreeCAD y Blender.

IfcOpenShell utiliza OpenCASCADE internamente para convertir la geometría implícita de los archivos IFC en geometría explícita que otros paquetes CAD pueden entender, por ejemplo, STEP, OBJ, y DAE.

A partir de la v0.19, FreeCAD es capaz de importar archivos IFC siempre que el módulo Python esté disponible en el sistema. Asimismo, los Arquitectura y BIM ambientes de trabajo pueden exportar un modelo de edificio al formato IFC para que pueda ser utilizado en otras aplicaciones.

Para verificar que IfcOpenShell está instalado en su sistema, intente importarlo desde la Consola de Python; la biblioteca está correctamente instalada si no se devuelve ningún mensaje de error.

Instalación
IfcOpenShell puede instalarse de varias maneras, dependiendo de su sistema operativo y del entorno de Python. En el pasado, IfcOpenShell era un poco difícil de instalar, ya que tenía que ser compilado para su sistema específico; sin embargo, a partir de este escrito (2020) es más fácil empezar a usarlo, ya que ahora se incluye junto con FreeCAD en muchas distribuciones de FreeCAD. En general, es aconsejable utilizar una de estas distribuciones precompiladas, y sólo compilarlo tú mismo si eres un usuario avanzado.

Conda
For Windows and MacOS systems, FreeCAD distributions put together with the Conda package manager usually include IfcOpenShell already so no further installation is necessary. Get the appropriate distribution from the Download page.

The AppImage for Linux is also based on Conda, and it also includes IfcOpenShell.

Linux
If it is available, you may install IfcOpenShell using your distribution's package manager.

However, please notice that packages provided by many Linux repositories tend to be old, and may not contain the latest developments in the software. If you want to be sure you are using the newest software, use a Conda-based distribution of FreeCAD, a pre-compiled IfcOpenShell distribution, or compile IfcOpenShell yourself.

Utilizar un paquete IfcOpenShell precompilado
There is a special repository of the IfcOpenShell project that compiles regularly the IfcOpenShell libraries for various systems (Linux, Windows, MacOS), architectures (32-bit and 64-bit), and Python versions (2.7, 3.x). To use these pre-compiled libraries, you must pick the right version that matches your operating system, architecture, and the major and minor numbers for the Python that is used with FreeCAD. This means that the first two numbers must match (Python 3.6 and 3.7 are considered distinct versions) while the third one (micro) does not matter (Python 3.6.5 and 3.6.12 are considered to be the same for compatibility purposes).


 * 1) Head to the build repository IfcOpenBot/IfcOpenShell. This repository is not for development, it only contains a copy of the main repository as well as pre-compiled packages.
 * 2) As of this writing (2020), the master branch of the IfcOpenShell project does not contain the latest code, so we need to select the desired branch, for example,.
 * 3) Click on the commit number, which will take you to the list of commits for the branch, for example,.
 * 4) Go back in the history until you find a commit that has a comment. This will indicate the moment when pre-compiled libraries were released.
 * 5) Click on the commit. You will see a comment by IfcOpenBot showing a table of combinations of operating system, architecture, and Python version. Choose the right link for "Python" to match your version of FreeCAD. The "Blender", "IfcConvert", and "IfcGeomServer" packages are not needed for FreeCAD usage.
 * 6) The downloaded package needs to be extracted, and the extracted directory needs to be placed in the Python search path in order to find the new modules.

the following examples assume a Debian/Ubuntu based system, but the general procedure should work for other operating systems.


 * Unzipping the downloaded package creates an folder.


 * The search path can be found by inspecting the variable in the Python console.


 * If you'd like to install the IfcOpenShell library only for your user, and not affect system directories, you should place the extracted folder in your own user's home directory.


 * If you'd like to install the IfcOpenShell library system-wide, you typically need superuser privileges to write to system directories; this is usually a directory, or a  directory for Debian/Ubuntu distributions.

If the directory is correctly moved, test that the module is accessible from the Python console.

To remove the installed library, just remove the corresponding directory with all modules inside.

Compilación
Compiling IfcOpenShell is recommended only for advanced users. The process is similar to compiling FreeCAD on Linux, so if you have done this already, then you may already have the necessary requisites like the OpenCASCADE's development files. The process uses the CMake configuration tool to produce a custom for use with the Make tool.

The general instructions are outlined in the IfcOpenShell repository, and are as follows:
 * 1) Get the source code of IfcOpenShell from its main repository.
 * 2) Gather all dependencies for compiling, including a C++ compiler, CMake, and Make, and the development files for Boost, libxml2, OpenCASCADE, SWIG, Python, and OpenCOLLADA (optional). Most of these components are strictly optional, however, for use with FreeCAD they should all be installed. OpenCOLLADA is optional as it only provides DAE support for the  binary.
 * 3) Run  to generate a, then start the compilation by running.
 * 4) Install the  Python module in the appropriate  directory so that it is found by FreeCAD.

the following examples assume a Debian/Ubuntu based system, but the general procedure should work for other operating systems. For example, in Debian shared libraries are normally located in while in other distributions this may be  so the paths should be adjusted accordingly.

Prerequisitos
Install the basic compilation tools.

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

As of this writing (2020), the master branch of the IfcOpenShell project does not contain the latest code, so we need to clone a specific branch.

OpenCASCADE
Install the development files of OpenCASCADE.

Which expands to

You may use the community edition (OCE) of OpenCASCADE as well, however, please notice that this version is old and no longer recommended by FreeCAD as of 2020.

OpenCOLLADA
Install the development files of OpenCOLLADA.

If the files are too old in your distribution, you may also compile the libraries yourself. The procedure is outlined in the main repository, KhronosGroup/OpenCOLLADA, and it's very straight forward as it only requires the and  development files.

Python wrapper
For usage with FreeCAD you need the Python wrapper which uses SWIG to generate the proper interfaces from the C++ classes.

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

Notice that the file that drives CMake is inside the  subdirectory in the source directory.

Depending on your Linux distribution, and the way you installed the dependencies, you may have to define some CMake variables so that the libraries are found properly.

Especificación de las bibliotecas OpenCASCADE
If you manually compiled OpenCASCADE, or if the libraries are not in a standard directory, you may have to set the proper variables.

By default the build system expects the community edition (OCE) of OpenCASCADE, however, please notice that this version is old and no longer recommended by FreeCAD as of 2020. For this reason installing the development files of the main version of OpenCASCADE (OCCT) is recommended.

Sin OpenCOLLADA
If you don't need OpenCOLLADA support (DAE files) you need to turn it off explicitly with the variable.

Con OpenCOLLADA
If you manually compiled OpenCOLLADA, or if the libraries are not in a standard directory, you may have to set the proper variables for OpenCOLLADA and for the library.

Especificación de las bibliotecas libxml2
If the libraries are not found during compilation and linking, or if the libraries are not in a standard directory, you may have to set the proper variables.

Especificando la instalación en el directorio personal del usuario
By default, the Python module will be installed in a system  directory, so it requires superuser privileges. By setting the variable, the installation of the Python module will be done to the user's home directory.

Especificando la versión de Python
If you want to generate a binding for a particular Python version, set the variable to the specific executable. Remember that this version must be the same Python version against which FreeCAD was compiled.

Línea de configuración única
In a typical Debian/Ubuntu system you may use this line to configure the compilation. Adjust it as necessary.

Without OpenCOLLADA:

Compilación actual
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.

Solución de problemas y otras opciones
All configuration options are available in the file located inside the  directory. If there are problems when running CMake or Make, look here for other options that may need to be set.

In all instructions above, instead of, the graphical interface can be used. This will quickly show the available options in the configuration.

Probar la compilación en el directorio de construcción
If the build was successful you should have an subdirectory with the newly compiled  executable. Run this utility from the build directory to generate a sample IFC file.

The sample IFC file should appear in the build directory, and can be used as input to the also newly compiled executable. This utility takes as input an IFC file, and produces as output a different format including OBJ, DAE if OpenCOLLADA support was enabled, STEP, IGS, XML, SVG, or another IFC.

If no output file is specified, by default it will create an OBJ file and its accompanying material table (MTL).

Instalación de las bibliotecas compiladas
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.

The Python module that is required for FreeCAD is not actually present in the build directory; this package is created only when  is run. The resulting package is placed in a directory, or a  directory for Debian/Ubuntu distributions.

If the variable was set during the CMake configuration step,  will be placed in the user's  directory.

Eliminar las bibliotecas compiladas
To remove the installed libraries, just remove the corresponding files that were installed, and the directory with all modules inside.

Or if the variable was set.

Instalación manual
Compilation of the entire IfcOpenShell distribution produces binaries like and, as well as many static libraries  in the build directory. However, for FreeCAD we only need the Python module. This module is not a single file, but a "package", that is, a directory with various files. This package is put together from the Python wrappers built inside, and from the Python modules in the original source directory.


 * Produced by the compilation process:


 * Existing in the source directory:

The module is created by copying the original source directory, and adding the two  files to it.

Now this directory can be moved to the user-specific or system ( for Debian/Ubuntu) to make it available for all Python applications.

Or for system-wide installation:

Now the module should be available to be imported from a Python console.

Aplicación del visor IFC
The IfcOpenShell library actually includes a small graphical viewer for IFC files that uses PyQt5 and PythonOCC.

To launch this viewer from the Python console, the class needs to be instantiated and started:

If the library is already installed, the entire module can also be run from the terminal:

At the time of writing (2020), only the PythonOCC version compiled for the OpenCASCADE community edition (OCE) was supported.

Visor en línea del IFC
The IfcOpenShell project has also developed "IFC Pipeline", a self-hosted IFC processing and visualization program. It also provides a small web application that accepts file uploads, which anybody can use. This means that to visualize IFC data you don't need to have IfcOpenShell, or other viewers, installed locally; you can just load your IFC file into this system to see the result.
 * Online viewer: https://view.ifcopenshell.org/
 * Repository: AECgeeks/ifc-pipeline

Más información

 * Página web: ifcopenshell.org
 * Repositorio de código: IfcOpenShell/IfcOpenShell
 * Academia con ejemplos y artículos: academy.ifcopenshell.org
 * Visor en línea de IfcOpenShell
 * Comunidad OSArch con recursos para la arquitectura de código abierto: wiki.OSArch.org
 * Instalación de IfcOpenShell; discusión principal en el foro.
 * Instalación de IFC; discusión antigua en el foro.
 * IfcPlusPlus compilado en Gentoo - ¿preguntas y alternativas?
 * Compilación de IfcOpenShell para MacOS; una guía antigua que describe el proceso general. Puede que ya no sea necesaria ya que IfcOpenShell se distribuye ahora junto con FreeCAD gracias a Conda.
 * Qué páginas enlazan con esta página.