# Calculate Differences of IFC files with Hashing

### Purpose¶

The goal of this tutorial is to learn how to asses whether 2 successively exported IFC building models are different by testing whether entity instances of the latest are present in the original one or entity instances of the original one are present in the latest version.

The data is stored using the Industry Foundation Class (IFC) format, which is the standard format to digitally represent anything related to the construction industry. This format stands as an open-standard, and enables to share building models in form of IFC files between the different actors of a construction project. We can think of IFC as the PDF for the construction industry.

For example, how could you find the difference between those 2 files?

# IfcOpenShell Optimizer tutorial

### Purpose¶

The goal of this tutorial is to reduce the size of an IFC file. Indeed, IFC files can become rather large and processing them can lead to expensive computational costs. Most of the time, this important size is due to duplicate entity instances. In this tutorial, we're going to see how to create a newly optimized file which doesn't contain those instances.

# Understanding placements in IFC using IfcOpenShell and FreeCAD

### IfcOpenShell – Placement

In previous article we used IfcOpenShell’s (IOS) to read an ifc geometry and convert it to a brep. When we read wikilab.ifc everything seemed to be at the right place but was it really ? When you use BIM in your project coordinates is always a subject to correctly discuss. In that matter I recommend...

### IfcOpenShell – Read geom as brep

IfcOpenShell version used : 0.6.0a1

In previous article we used IfcOpenShell’s (IOS) standard settings to read an ifc geometry which was generating a mesh. To generate something else let’s take a look at available settings. If your IDE provide you a good auto-completion you are able to see what options you have but not their ...

### IfcOpenShell – Read geom as mesh

IfcOpenShell is a library used to work with IFC schema. This library is licensed under LGPL 3.0 (libre and open source). Some features included : Parse ifc Create geom from ifc representation Display geom using pythonOCC Ifc importer for Blender Ifc importer for 3ds Max Convert geometry to many formats Some projects using IfcOpenShell...

# Using IfcOpenShell to parse IFC files with Python

IFC is the ISO standard format for storing BIM data. IfcOpenShell is a project that has a Python library that allows you to parse IFC files...

# Using IfcOpenShell and C++ to generate Alignments through the IFC 4x1 schema

IfcOpenShell has an EXPRESS parser and code generator that generates code for the various IFC schemas. As part of the source code repository comes pre-generated code for the two widely used versions IFC2X3 and IFC4. But arbitrary schemas can be fed into the parser to provide support for other schemas at compile time. This post highlights the process of generating code for other schemas and talks about the recent developments within the IFC Alignment project._

# Creating a simple wall with property set and quantity information

The following recipe creates a simple wall from scratch using a templating technique to quickly populate the entity instances for the IFC project structure. Simple extrusion geometries, an IfcPropertySet and an IfcElementQuantity are added using the procedural entity instance creation functions. The script is written for a research project with Dr. Patrick Janssen in National University of Singapore. The script takes reference from the FreeCAD IFC exporter script and HelloWall miniExample.

# Using IfcOpenshell and pythonOCC to generate cross sections directly from an IFC file

Section information can be used for multiple purposes. This example is the first part of a project in which the aim is to be able to directly send information to a large 3D concrete printer. This printer will be able to print concrete buildings on a 1:1 scale on a building site. The goal is to control the printer directly from an IFC model. Since the printer will print one layer at a time, the first step is to derive section information from an IFC file. This is what this tutorial is about. As an example of the information that can be deduced from a section, the area that needs to be printed is calculated.

This example builds upon some of the concepts in "Using IfcOpenShell and pythonOCC to construct new geometry" and uses the same model of a simple house, called IfcOpenHouse.

# Using the parsing functionality of IfcOpenShell interactively

In this recipe we are going to look at an interactive way of working with Python and IfcOpenShell that allows to quickly explore the possibilities offered by the tools. When the python interpreter (python.exe) is executed without arguments it will function as a REPL (a Read Evaluate Print Loop). It enables the user to type a single line of code and immediately see the evaluated result. An example of such a session is provided below. It outlines the procedure of starting with an IfcProject and descending down to the unit for angular measures. In this particular file it seems that angles are specified as degrees, a constant factor of 0.0174533 away from radians.

Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
>>> import ifcopenshell
>>> file = ifcopenshell.open("IfcOpenHouse.ifc")
>>> project = file.by_type("IfcProject")[0]
>>> project
#18=IfcProject('2f0veX5Vj59AhEg6WqGnhO',#5,'IfcOpenHouse',$,$,$,$,(#11),#17)
>>> project.is_a()
'IfcProject'
>>> project.is_a("IfcRoot")
True
>>> project.is_a("IfcWall")
False
>>> project.id()
18
>>> project.attribute_name(0)
'GlobalId'
>>> project.attribute_type(0)
'STRING'
>>> project.GlobalId
'2f0veX5Vj59AhEg6WqGnhO'
>>> project.Bier
Traceback (most recent call last):
File "", line 1, in
File "ifcopenshell\\ifcopenshell.py", line 28, in __getattr__
except: raise AttributeError("entity instance of type '%s' has no attribute '%s'"%(self.wrapped_data.is_a(), name))
AttributeError: entity instance of type 'IfcProject' has no attribute 'Bier'
>>> project.UnitsInContext
#17=IfcUnitAssignment((#13,#16))
>>> units = project.UnitsInContext.Units
>>> angle_unit = filter(lambda u: u.UnitType == "PLANEANGLEUNIT", units)[0]
>>> angle_unit
#16=IfcConversionBasedUnit(#12,.PLANEANGLEUNIT.,'Degrees',#15)
>>> angle_unit.ConversionFactor
#15=IfcMeasureWithUnit(IfcPlaneAngleMeasure(0.0174533),#14)
>>> angle_unit.ConversionFactor.ValueComponent
IfcPlaneAngleMeasure(0.0174533)
>>> angle_unit.ConversionFactor.ValueComponent.is_a()
'IfcPlaneAngleMeasure'
>>> angle_unit.ConversionFactor.ValueComponent.wrappedValue
0.0174533