- Watch out
- What it costs
- Experienced readers
- Remember
- In BIMpedia
IFC is an open format, and open-source libraries can read it. With IfcOpenShell (Python), a short script can open any IFC file, from any authoring tool, and answer questions about it: counts, missing properties, lists for a report. It runs on a laptop, a server or a notebook, without Revit, Archicad or a licence.
The minimum you need to know
| IFC idea | Example | In Python |
|---|---|---|
| Entities (classes) | IfcDoor, IfcWall, IfcSpace | model.by_type("IfcDoor") |
| Property sets | Pset_DoorCommon.FireRating | get_psets(door)["Pset_DoorCommon"]["FireRating"] |
| Containment | The storey that contains the door | get_container(door).Name |
| Types | The door type an instance uses | get_type(door) |
| GlobalId | A stable ID per element | door.GlobalId |
IfcOpenShell installs with pip install ifcopenshell. A script opens a file with ifcopenshell.open("model.ifc"), gets elements with by_type, and reads data with the helpers in ifcopenshell.util.element.
A useful first script
List every space with its storey, number and area, and flag spaces with no number:
import ifcopenshell
import ifcopenshell.util.element as el
model = ifcopenshell.open("model.ifc")
for space in model.by_type("IfcSpace"):
psets = el.get_psets(space)
qtos = psets.get("Qto_SpaceBaseQuantities", {})
storey = el.get_container(space)
number = space.Name or "" # many exporters store the room number here
area = qtos.get("NetFloorArea")
flag = "" if number else " <-- no number"
print(f"{storey.Name if storey else '-':10} {number:10} {space.LongName or '':25} {area or '-'}{flag}")
Read this script, then answer the questions:
import ifcopenshell
import ifcopenshell.util.element as el
from collections import Counter
model = ifcopenshell.open("model.ifc")
missing = Counter()
for wall in model.by_type("IfcWall"):
ext = el.get_psets(wall).get("Pset_WallCommon", {}).get("IsExternal")
if ext is None:
storey = el.get_container(wall)
missing[storey.Name if storey else "no storey"] += 1
for storey, n in missing.most_common():
print(storey, n)
- What does it report?
- A wall has
IsExternal = False. Is it counted? - How would you change it to also list the GlobalIds of the walls?
Key takeaways
- IfcOpenShell opens IFC files from any software; scripts work across vendors.
- Find elements by class (IfcDoor, IfcSpace), then read property sets and the containing storey.
- Expect properties in custom sets as well as standard ones; check both.
- Skip geometry when you only need data: it's much faster.
Your notes
Related tool
Open an IFC file in the browser: structure, elements, properties and required-property checks.
Open IFC Inspector →