Back to the BIM & IFC blog
IFC Tips · 2026-06-03 · 8 min
Read IFC Property Sets in Python with IfcOpenShell
You need to pull property data out of an IFC — quantities, classifications, custom Psets — and into a spreadsheet, a database, or a QA check. IfcOpenShell makes it a few lines of Python. Here's the practical cookbook, including the get_psets shortcut everyone wishes they'd found first.
Read IFC Property Sets in Python with IfcOpenShell — IFC Viewer Online article cover
Sooner or later every BIM-adjacent developer needs to get data out of an IFC: element quantities for a takeoff, classifications for a register, custom property sets for a QA rule. IfcOpenShell is the open-source library that makes this tractable in Python. This is the practical path — the manual way to understand it, and the one-line shortcut for when you just need the data.
Open the File and Find Elements
import ifcopenshell
model = ifcopenshell.open("model.ifc")
# All walls in the file
walls = model.by_type("IfcWall")
print(f"{len(walls)} walls")
# A single element by its GlobalId
el = model.by_guid("3LYa_FRDj3zhLfyYoQv6Jr")
The Manual Way (Understand the Structure)
Property sets aren't stored on the element directly — they hang off it through a relationship. An element's IsDefinedBy holds IfcRelDefinesByProperties relations, each pointing to a property set (the RelatingPropertyDefinition). Inside the set, HasProperties lists the individual properties, most of which are IfcPropertySingleValue with a Name and a NominalValue.
wall = walls[0]
for rel in wall.IsDefinedBy:
if rel.is_a("IfcRelDefinesByProperties"):
pset = rel.RelatingPropertyDefinition
if pset.is_a("IfcPropertySet"):
print(pset.Name) # e.g. "Pset_WallCommon"
for prop in pset.HasProperties:
if prop.is_a("IfcPropertySingleValue") and prop.NominalValue:
print(f" {prop.Name} = {prop.NominalValue.wrappedValue}")
The Shortcut: get_psets()
The manual traversal is worth understanding once, but for real work use the utility: ifcopenshell.util.element.get_psets() returns every property set on an element as a plain dictionary — Pset names as keys, property dicts as values. It's far less error-prone than walking the relationships yourself.
import ifcopenshell.util.element as ue
psets = ue.get_psets(wall)
# {'Pset_WallCommon': {'IsExternal': True, 'FireRating': 'REI 60', 'id': 1234}, ...}
fire_rating = psets.get("Pset_WallCommon", {}).get("FireRating")
# Quantities only (areas, volumes, lengths)
qtos = ue.get_psets(wall, qtos_only=True)
Export Every Element to a Table
import csv
import ifcopenshell.util.element as ue
with open("elements.csv", "w", newline="") as f:
writer = csv.writer(f)
writer.writerow(["GlobalId", "Class", "Name", "Pset", "Property", "Value"])
for el in model.by_type("IfcBuildingElement"):
for pset_name, props in ue.get_psets(el).items():
for key, value in props.items():
if key == "id":
continue
writer.writerow([el.GlobalId, el.is_a(), el.Name, pset_name, key, value])
Where Reading Stops and Viewing Begins
Python is ideal for batch extraction and automated QA in a pipeline. But when you want to eyeball the property sets on a specific element — or hand the file to someone who doesn't write code — a viewer that shows Psets per element on click is the faster path. The two complement each other: script the bulk checks, inspect the edge cases visually.
Inspect Psets visually
Open the duplex and click any element to see its full property sets — the same data get_psets() returns, without writing any code.
IFC2x3 · 2.4 MB
Open the interactive IFC viewer
Read IFC Property Sets in Python with IfcOpenShell