Arch IFC/it

L'ambiente Arch fornisce un importatore Industry Foundation Classes (IFC). Il formato IFC è un formato sempre più diffuso per scambiare dati tra le applicazioni BIM, utilizzato in architettura e in ingegneria.

L'importatore è ancora in fase di sviluppo e dipende da una parte esterna di software open-source, chiamato IfcOpenShell, che non è incorporato in FreeCAD e che deve essere installato nel proprio sistema. Se IfcOpenShell è installato correttamente, esso viene rilevato da FreeCAD e utilizzato per importare i file IFC. È ancora possibile forzare l'uso del vecchio importatore IFC Python, che non dipende da IfcOpenShell, attivando la relativa opzione nelle impostazioni delle preferenze di Arch. Ma questo importatore è stato abbandonato e importa solo un piccolo sottoinsieme di oggetti IFC.

import IfcOpenShell

If no error message appears, everything is fine, IfcOpenShell is correctly installed. Otherwise, you will need to install it yourself. Read on.

Note: The BIM Setup tool will look for IfcOpenShell too and issue a notification if it is not installed.

Note: The Arch Workbench used to feature in the past a simpler IFC importer that doesn't depend on IfcOpenShell. It is still possible to force the use of that old python IFC importer, by enabling the related option in the Arch preferences settings. But this importer has been discontinued, might not work properly, and will only be able to import a very small subset of IFC objects.

Si consiglia vivamente di usare IfcOpenShell che è molto più veloce e più potente del parser interno. IfcOpenShell supporta tutte le entità IFC2x3 e IFC4 che riportano informazioni geometriche, anche se non tutte possono essere convertite in oggetti Arch, quelle che non possono convertite vengono importate come semplice forme Parte.

Obtaining IfcOpenShell
On the IfcOpenShell website, you will find download links for the various utilities that compose the IfcOpenShell program. What FreeCAD needs is the one called IfcOpenShell-Python. You must take care of choosing the correct architecture for your operating system (32bits or 64bits), and also need the exact same Python version as FreeCAD. The Python version used by FreeCAD is indicated on the first line of the FreeCAD Python Console, found under menu View → Panels. You need a version of IfcOpenShell with the same two first numbers. The third number is not important. For example, if your FreeCAD Python version is 3.7.4, you need an IfcOpenShell version 3.7.

IfcOpenBot
The packages available on the IfcOpenShell website are, however, usually very old and don't support more recent Python versions. We therefore recommend you to use another service provided by the developers of IfcOpenShell, which is called IfcOpenBot. It is an automated system that builds a series of packages from time to time from the IfcOpenShell source code. To download one of these packages, click the "Commits" link on the GitHub repository, and locate commits that have a comment (a small "message" icon). Those comments are where you will find the packeges built by IfcOpenBot.

At the time of writing, the current stable version of IfcOpenShell, which lies in its "master" branch, is v0.5. However, v0.6 is already very stable and contains many improvements such as support for both IFC2x3 and IFC4 at the same time. We recommend you to switch the "branch" button to v0.6 and use one of these instead. Again, make sure you download the correct package for your version of FreeCAD.

Compiling
You can also compile IfcOpenShell yourself, of course. As it has almost the same dependencies as FreeCAD, if you are already compiling FreeCAD yourself, compiling IfcOpenShell will be very straightforward and will normally not require any additional dependency.

Installing IfcOpenShell
The package you downloaded from one of the above locations is a zip file that contains a folder named "ifcopenshell" with several other files and folders inside. To "install" it simply means make this ifcopenshell folder found by Python (so the import ifcopenshell command we used above succeeds). The list of folders where Python looks for modules can be obtained by entering these two lines in the FreeCAD Python Console:

import sys for p in sys.path: print(p)

and press enter twice.

To install IfcOpenShell, just unzip the downloaded package, and place the "ifcopenshell" folder in any of the locations issued by the commands above.

You will notice that some of these locations are system folders (the officially recommended locations are the "site-packages" or "dist-packages" folders), which will make IfcOpenShell installed system-wide and available to other applications such as Blender, but you might prefer to not pollute your system folders with something copied by hand, and place it in one of the folders of FreeCAD itself. Good suggestions are FreeCAD's "bin" folder, or the macros folder (which you can also obtain from menu Macro → Macros)

Once you copied your ifcopenshell folder at one of these locations, test that it works correctly by entering:

import ifcopenshell

in the Python console of FreeCAD. If no error appears, you are good to go.

Importazione
Nel documento di FreeCAD sono importate dai file IFC2x3 o IFC4 tutte le entità basate su IfcProduct. Le impostazioni delle preferenze IFC consentono di impostare il modo di importazione degli oggetti IFC: come oggetti Arch completamente parametrici, come oggetti Arch non parametrici, come forme di Part non parametriche, o come una forme di Part per piano. Ognuno di questi tipi perde alcune informazioni rispetto a quello precedente, ma richiede meno risorse, e questo permette di aprire file più grandi. Un ultimo tipo permette di scartare in blocco l'importazione di oggetti Arch, ed è utile per i modelli analitici strutturali.

Typically, if you try to open a large file and FreeCAD takes too long to import it, try with a lower import mode.

IfcOpenShell supports all IFC2x3 and IFC4 entities (IFC4-add1 and IFC4-add2 are being implemented in v0.6 and might be available by the time you read this) but not all of them can be converted to Arch objects, those that can't will be imported as simple Part shapes. The IFC importer starts by importing all IFC entities derived from IfcProduct, that is, basically, all the objects that compose a building, such as walls or windows or pipes. All other entities needed by one of these objects, such as profiles of extrusion, or components of boolean operations, will be imported as required.

Se si utilizzano oggetti Arch parametrici, per tutti i tipi IFC che hanno un equivalente nel Modulo Arch, viene utilizzato il tipo corrispondente. Per gli altri, viene creata una forma Part generica. Tutti gli oggetti Arch, parametrici e non parametrici, portano la serie completa di IfcProperties abbinata a ciascun oggetto.

Building structures such as Sites, Buildings and Storeys are also faithfully imported and the structure is correctly recreated in FreeCAD. Group structures (using IfcGroups) are also imported and rendered in FreeCAD, and can be combined with building structures, for ex. having groups inside storeys or storeys inside groups.

Sono anche importati gli oggetti IfcAnnotation, così come le entità lineari e curve basate su IfcStructuralItem.

Quantities specified in the IFC file are NOT imported. However, since the geometry is fully recreated in FreeCAD, most of the quantities such as length, area, etc.. are easily obtainable for each object

Attivando mostra i messaggi di debug nelle impostazioni delle preferenze IFC viene stampato un rapporto che indica se l'importazione di un oggetto dal file IFC non è riuscita.

Note: The BIM Workbench features an IFC explorer tool that allows you to open an IFC file in fast, text-only mode, and import only the parts you wish.

Exportazione
Esportando in un file IFC si esportano tutti gli oggetti selezionati e i loro discendenti. Per esportare un edificio completo o un piano intero, basta selezionare l'oggetto edificio o piano. Gli oggetti Arch vengono esportati nel tipo impostato nella loro proprietà "Role". Vengono anche esportate le loro IfcProperties, e se questi oggetti hanno una UID IFC da un'importazione precedente, viene mantenuta la stessa UID nell'esportazione. Gli oggetti che non sono oggetti Arch vengono esportati come IfcBuildingElementPRoxy.

To export a whole site or building or a whole floor or a group containing other objects, it is only needed to select that building or floor or group. Arch objects will be exported with the type set in their "IFC Type" property. Their IfcProperties are exported as well, and if these objects have an IFC UID from a previous import, the same UID will be kept at export. Objects that are not Arch objects are exported as IfcBuildingElementProxy.

I file IFC vengono esportati come IFC2x3 o IFC4, a seconda della versione di IfcOpenShell, che può essere compilato con qualsiasi degli schemi IFC.

Se la forma degli oggetti esportati si basa su una estrusione o una operazione booleana, le operazioni ed i componenti sono esportati correttamente nel IFC. In caso contrario, la forma dell'oggetto viene esportata come IfcFacetedBrep. Se la forma contiene delle curve, esse vengono sfaccettate.

Link
Tutorial Importare/Esportare IFC - compilare IfcOpenShell