Skip to content

IFC processing

Module: bimora.ifc (loader, units, extract, model).

Opening files safely

load_model(path, max_bytes=256 MB, allow_untested_schema=False) checks, before the parser runs:

  1. the path exists and is a regular file, and is not empty;
  2. the file is not larger than max_bytes (FileTooLargeError);
  3. the content starts with ISO-10303-21; — ZIP archives (IFC-ZIP) and XML (ifcXML) are recognised and refused with UnsupportedFormatError, whatever the file extension;
  4. the header declares FILE_SCHEMA, and the schema is IFC2X3 or IFC4 (UnsupportedSchemaError otherwise, unless allow_untested_schema=True).

Parser failures become ParseError. The parser (IfcOpenShell) is lenient: entities it cannot read are skipped, and the extractor tolerates missing attributes and relationships.

sniff_schema(path) returns the declared schema without parsing the model.

What is extracted (read_model → ModelData)

Information IFC source
Header FILE_NAME, FILE_DESCRIPTION (may contain author / organisation names)
Project IfcProject Name, LongName, Description, Phase
Units IfcProject.UnitsInContext — SI units (with prefix) and conversion-based units; scale to SI, symbol, measurement system (metric, imperial, mixed, undeclared)
Hierarchy IfcProject, IfcSite, IfcBuilding, IfcBuildingStorey (declared Elevation), IfcSpace via IfcRelAggregates
Elements every IfcElement except features (openings are counted separately) and virtual elements
Identifiers GlobalId, STEP id, Tag
Classification IFC class, PredefinedType (USERDEFINED → ObjectType; NOTDEFINED → the type's value), ObjectType, type name
Containment IfcRelContainedInSpatialStructure; doors / windows without containment take their host's container via IfcRelFillsElement → IfcRelVoidsElement (container_source = "via-host"); spaces use their aggregation parent
Properties IfcPropertySet on the occurrence and on its type (occurrence values win): single, enumerated, list, bounded and complex properties
Quantities IfcElementQuantity on the occurrence and on its type (occurrence values win): length, area, volume, count, weight, time; the quantity's own unit or the project unit; SI value; always source = "declared"
Materials IfcRelAssociatesMaterial (occurrence, else type): material, layer set (usage), profile set (usage), constituent set, IFC2X3 material list
Classification references IfcRelAssociatesClassification: system name, identification (Identification in IFC4, ItemReference in IFC2X3), name

Schema support

Verified: IFC2X3 and IFC4, using files generated with IfcOpenShell (see examples). Exports from Revit, Archicad or other authoring tools have not been verified with this release.

Not done

No geometry is processed; quantities are never computed from shapes. IFC-ZIP and ifcXML are not supported.