topologicpy.IFC module

Geometry units

IFC.Topologies and IFC.MeshData, their file/path/entity wrappers, and IFC.AnalyticalFaces, IFC.ThermalCellComplex, IFC.AccessGraph, and IFC.AdjacencyGraph convert project-assigned IFC length units to metres by default. SI prefixes and conversion-based units such as feet are supported. Dimensions and placement translations use the same conversion. Source STEP entities, properties, quantities, and round-trip IFC.Export remain in their original IFC units.

Fragments without unit assignments assume metres for compatibility. Invalid, unsupported, or conflicting declared length units fail explicitly instead of silently assuming a unit. Public import methods return None on failure; low-level mesh methods raise ValueError for invalid units or multipliers.

The scale argument is deprecated and defaults to None. An explicit, finite, positive value preserves the legacy raw-coordinate multiplier and overrides automatic unit conversion. For example, scale=0.001 converts raw millimetre coordinates to metres once, while scale=1.0 preserves raw coordinates. New callers should omit scale and rely on the IFC units. Geometric tolerances, proximity thresholds, and thermal enclosure margins use output coordinate units, which are metres with automatic conversion. Semantic quantity values are source values, not converted geometry measurements.

Topology.ByIFCFile and Topology.ByIFCPath use the same defaults and forward scale, topologyType, and circleSides consistently.

Public API

IFCFastTopology remains available for compatibility and internal geometry parsing. Its topology, path-mesh, and summary entry points delegate to IFC; it is excluded from this public listing to avoid repeated method names.

class topologicpy.IFC.IFC

Bases: object

Public IFC model, semantic, and geometry operations.

Geometry import converts project length units to metres by default. scale=None selects declared units; unitless fragments assume metres. Explicit scale is a deprecated compatibility override that applies a finite, positive multiplier to raw IFC coordinates, without also applying unit conversion. Tolerances and geometric thresholds use output units. Source entities and semantic quantities retain their IFC values and units.

Methods

AccessGraph(model[, viaConnectingElements, ...])

Creates an access TGraph from an already parsed IFCModel.

AccessGraphByPath(path[, ...])

Parses an IFC path once and delegates to IFC.AccessGraph.

AdjacencyGraph(model[, nodeTypes, ...])

Creates a general-purpose IFC adjacency TGraph from semantic and spatial relationships.

AdjacencyGraphByPath(path[, nodeTypes, ...])

Parses an IFC path once and delegates to IFC.AdjacencyGraph.

AnalyticalFaces(model[, circleSides, scale, ...])

Returns analytical faces for IFC walls, slabs, and roofs.

BrickClassByIFCClass(ifcClass[, ...])

Returns the closest Brick class for an IFC MEP class.

BrickMappingTable([includeGeneric, ...])

Returns the curated IFC-to-Brick mapping table used by the IFC importer.

DoorSpaceCardinalityReport(file[, ...])

Returns a diagnostic report of door/opening-to-space cardinalities in an IFC file.

ElementTypes(file[, includeCounts, silent])

Returns the IFC element/entity types found in the input IFC file, sorted alphabetically.

Entities(file[, silent])

Returns the parsed IFC STEP entity dictionary from the input IFC source.

EntitiesByPath(path[, silent])

Returns the parsed IFC STEP entity dictionary from the IFC file at the input path.

Export(model, path[, overwrite, ...])

Exports an in-memory IFCModel to an IFC STEP Physical File.

ExportReferenceView(model, path[, schema, ...])

Export a TopologicPy-authored model to an IFC4 Reference View-compatible IFC.

FileByPath(path[, silent])

Returns the parsed IFC STEP entity dictionary found at the input path.

KnowledgeGraphByFile(file[, includeRels, ...])

Returns a KnowledgeGraph built from IFC relationship RDF triples.

MeshData(model[, includeTypes, ...])

Returns aggregated mesh data in metres using IFCModel geometry caches.

MeshDataByPath(path[, includeTypes, ...])

Parses an IFC path once and delegates to IFC.MeshData.

Model(file[, sourcePath, silent])

Returns an in-memory IFCModel from the input IFC source.

ModelByEntities(entities[, sourcePath, ...])

Wraps a parsed IFC entity dictionary in an IFCModel.

ModelByPath(path[, silent])

Parses an IFC STEP file once and returns an in-memory IFCModel.

NavigationModel(model[, eyeHeight, ...])

Extract an editable NavigationModel from a parsed IFC model.

Object(file[, globalId, ifcId, ifcKey, silent])

Returns a dynamic IFCEntity wrapper for one IFC entity.

Objects(file[, includeTypes, excludeTypes, ...])

Returns dynamic IFCEntity wrappers for IFC entities in a file.

ObjectsByType(file, ifcType[, includeEmpty, ...])

Returns dynamic IFCEntity wrappers for entities of one IFC type.

OntologyClassByIFCClass(ifcClass[, defaultValue])

Returns the TopologicPy ontology class for an IFC class.

Properties(file[, includeTypes, ...])

Extracts semantic properties, quantities, classifications, and materials from an IFC file.

RDFTriples(file[, includeRels, excludeRels, ...])

Returns RDF-style triples from IFC relationships.

RelationshipPredicateByIFCClass(ifcClass[, ...])

Returns semantic predicate metadata for an IFC relationship class.

RelationshipTypes(file[, includeCounts, silent])

Returns the IFC relationship entity types found in the input IFC file, sorted alphabetically.

RelationshipTypesByGlobalId(file, globalId)

Returns the IFC relationship entity types associated with the IFC element identified by the input GlobalId.

SemanticRelationshipsByGraph(model, graph[, ...])

Creates missing in-memory IFC semantic relationship entities from an IFC adjacency TGraph.

Summary(model[, silent])

Returns a cached compact summary of an IFCModel.

SummaryByPath(path[, silent])

Parses an IFC path once and delegates to IFC.Summary.

TGraphByPath(path[, importMode, clean, ...])

Creates a TGraph from an IFC path.

ThermalCellComplex(model[, separatorTypes, ...])

Creates a proof-of-concept thermal CellComplex from an IFCModel.

Topologies(model[, includeTypes, ...])

Imports product geometry in metres from an already parsed IFCModel.

TopologiesByEntities(entities[, ...])

Compatibility wrapper for IFC.Topologies using an entity dictionary.

TopologiesByFile(file[, includeTypes, ...])

Imports an IFCModel or other IFC source through IFC.Topologies.

TopologiesByPath(path[, includeTypes, ...])

Parses an IFC path once and delegates to IFC.Topologies.

Triples(file[, includeRels, excludeRels, ...])

Returns IFC relationship triples from the input IFC file.

ValidateBrickMappings([brickTTLPath, ...])

Validates the mapped Brick classes against a Brick TTL/RDF file when supplied.

static AccessGraph(model, viaConnectingElements: bool = False, semanticConnections: bool = True, spatialConnections: bool = False, dictionaryMode: str = 'Full', scale: Optional[float] = None, circleSides: int = 24, tolerance: float = 0.0001, silent: bool = False)

Creates an access TGraph from an already parsed IFCModel.

Only IfcSpace entities become principal graph vertices.

The connecting elements are:

  • unfilled IfcOpeningElement entities;

  • IfcOpeningElement entities filled by IfcDoor or IfcDoorStandardCase;

  • IfcStairFlight entities;

  • IfcStair entities that are not decomposed into IfcStairFlight entities;

  • IfcRampFlight entities;

  • IfcRamp entities that are not decomposed into IfcRampFlight entities; and

  • IfcTransportElement entities identified as elevators or lifts.

Door geometry is never imported. Door access uses the geometry of its IfcOpeningElement. Vertical-circulation elements use their own geometry.

When semanticConnections is True, IfcRelSpaceBoundary relationships are used first. For decomposed stairs and ramps, boundaries associated with the parent assembly are also considered.

When spatialConnections is True, connecting elements with fewer than two semantic space connections are tested geometrically against the IfcSpace cells using only the “overlaps” and “touches” spatial relationships. Completely isolated spaces are then tested directly against the other spaces using the same relationships.

Parameters
modelIFCModel

The parsed in-memory IFC model.

viaConnectingElementsbool , optional

If set to True, connecting elements become intermediate graph vertices. Otherwise, they become direct graph edges between adjacent spaces. Default is False.

semanticConnectionsbool , optional

If set to True, connections are first derived from IFC semantic relationships. Default is True.

spatialConnectionsbool , optional

If set to True, unresolved connecting elements and isolated spaces are tested using spatial relationships. Default is False.

dictionaryModestr , optional

The dictionary import mode. This can be “None”, “Basic”, or “Full”. It is case-insensitive. Default is “Full”.

scalefloat , optional

Deprecated raw-coordinate multiplier. Default is None, which converts IFC length units to metres. An explicit finite, positive value overrides automatic unit conversion and keeps legacy behavior.

circleSidesint , optional

The number of sides used to approximate circular geometry. Default is 24.

tolerancefloat , optional

The desired geometric tolerance. Default is 0.0001.

silentbool , optional

If set to True, error and warning messages are suppressed. Default is False.

Returns
topologicpy.TGraph

The resulting access graph.

static AccessGraphByPath(path: str, viaConnectingElements: bool = False, semanticConnections: bool = True, spatialConnections: bool = False, dictionaryMode: str = 'Full', scale: Optional[float] = None, circleSides: int = 24, tolerance: float = 0.0001, silent: bool = False)

Parses an IFC path once and delegates to IFC.AccessGraph.

static AdjacencyGraph(model, nodeTypes: list = None, connectingElementTypes: list = None, viaConnectingElements: bool = False, semanticConnections: bool = True, spatialConnections: bool = False, spatialRelationshipTypes: list = None, proximityValues: list = None, proximityLabels: list = None, useShortestDistance: bool = False, dictionaryMode: str = 'Full', scale: Optional[float] = None, circleSides: int = 24, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)

Creates a general-purpose IFC adjacency TGraph from semantic and spatial relationships.

The entities specified by nodeTypes form the principal graph vertices. The entities specified by connectingElementTypes mediate semantic adjacency and are also included in the spatial relationship graph when spatialConnections is True.

Semantic adjacency is derived from IFC relationship entities, including space boundaries, element connections, and distribution-port connections. Spatial adjacency is delegated entirely to TGraph.BySpatialRelationships and merged with the semantic graph by the persistent IFC_id stored on each topology.

Parameters
modelIFCModel

The parsed in-memory IFC model.

nodeTypeslist , optional

IFC types that constitute graph nodes. Type names are case-insensitive and common singular/plural aliases are accepted. Default is [“IfcSpace”].

connectingElementTypeslist , optional

IFC types that constitute connecting elements. Default is [“IfcWall”, “IfcSlab”].

viaConnectingElementsbool , optional

If True, semantic connections pass through connecting-element vertices. If False, each semantic connecting element creates direct edges among its semantically associated nodes. When spatialConnections is True, selected connecting elements are still retained as graph vertices because they participate directly in the spatial relationship graph. Default is False.

semanticConnectionsbool , optional

If True, IFC relationship entities are used to derive semantic adjacency. Default is True.

spatialConnectionsbool , optional

If True, all geometric node and connecting-element topologies are passed together to TGraph.BySpatialRelationships and the resulting spatial graph is merged with the semantic graph. Default is False.

spatialRelationshipTypeslist , optional

Spatial relationships requested from TGraph.BySpatialRelationships. Supported values are “contains”, “coveredBy”, “covers”, “crosses”, “disjoint”, “equals”, “intersects”, “overlaps”, “touches”, “within”, and “proximity”. This input is required when spatialConnections is True.

proximityValueslist , optional

Three numeric proximity thresholds passed to TGraph.BySpatialRelationships. Required when “proximity” is included in spatialRelationshipTypes.

proximityLabelslist , optional

Three labels corresponding to proximityValues. Required when “proximity” is included in spatialRelationshipTypes.

useShortestDistancebool , optional

If True, TGraph.BySpatialRelationships uses Topology.ShortestDistance for proximity. If False, it uses its faster default distance calculation. Default is False.

dictionaryModestr , optional

The IFC dictionary mode: “None”, “Basic”, or “Full”. Default is “Full”.

scalefloat , optional

Deprecated raw-coordinate multiplier. None converts IFC length units to metres; an explicit finite, positive value overrides conversion.

circleSidesint , optional

The number of sides used to approximate circular geometry. Default is 24.

mantissaint , optional

Coordinate and spatial-result rounding precision. Default is 6.

tolerancefloat , optional

The desired geometric tolerance. Default is 0.0001.

silentbool , optional

If True, error and warning messages are suppressed. Default is False.

Returns
topologicpy.TGraph

The combined semantic and spatial adjacency graph.

static AdjacencyGraphByPath(path: str, nodeTypes: list = None, connectingElementTypes: list = None, viaConnectingElements: bool = False, semanticConnections: bool = True, spatialConnections: bool = False, spatialRelationshipTypes: list = None, proximityValues: list = None, proximityLabels: list = None, useShortestDistance: bool = False, dictionaryMode: str = 'Full', scale: Optional[float] = None, circleSides: int = 24, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)

Parses an IFC path once and delegates to IFC.AdjacencyGraph.

static AnalyticalFaces(model, circleSides: int = 24, scale: Optional[float] = None, angTolerance: float = 5.0, tolerance: float = 0.0001, silent: bool = False) → list

Returns analytical faces for IFC walls, slabs, and roofs.

Exterior constructions are represented by their outer major face. Interior constructions are represented by a medial face halfway between their two major parallel faces.

Classification first uses physical IfcRelSpaceBoundary relationships. If these are absent, common IsExternal property values and limited IFC type/name fallbacks are used. Ambiguous elements are skipped.

Parameters
modelIFCModel

The input in-memory IFC model.

circleSidesint , optional

Number of sides used to approximate circular IFC geometry. Default is 24.

scalefloat , optional

Deprecated raw-coordinate multiplier. None converts IFC length units to metres; an explicit finite, positive value overrides conversion.

angTolerancefloat , optional

Maximum angular deviation, in degrees, when pairing the two major parallel faces. Default is 5.0.

tolerancefloat , optional

The desired geometric tolerance. Default is 0.0001.

silentbool , optional

If True, errors, warnings, and summary information are suppressed. Default is False.

Returns
list

A list of topologic_core.Face objects, or None if no analytical faces can be generated.

Notes

This proof of concept assumes each construction is predominantly a thin extrusion with two dominant approximately parallel faces.

static BrickClassByIFCClass(ifcClass: str, predefinedType: str = None, objectType: str = None, metadata: dict = None, defaultValue: Any = None)

Returns the closest Brick class for an IFC MEP class.

static BrickMappingTable(includeGeneric: bool = True, includeKeywordHints: bool = False)

Returns the curated IFC-to-Brick mapping table used by the IFC importer.

static DoorSpaceCardinalityReport(file, connectorTypes: list = None, includeOpenings: bool = True, includeWindows: bool = False, includeZeroSpaceConnectors: bool = True, highCardinalityThreshold: int = 2, silent: bool = False)

Returns a diagnostic report of door/opening-to-space cardinalities in an IFC file.

The method inspects IfcRelSpaceBoundary relationships to determine how many IfcSpace entities are associated with each connector element. It also uses IfcRelFillsElement to resolve IfcOpeningElement entities to their filling elements, usually IfcDoor or IfcWindow.

A correctly exported door connecting two rooms is normally expected to have a space_count of 2. Doors with one related space may indicate an external door, incomplete space boundaries, or an export issue. Doors with more than two related spaces are usually suspicious and are flagged as high_cardinality.

Parameters
filedict, str, or ifcopenshell.file-like object

The input IFC source.

connectorTypeslist , optional

IFC connector types to include. If None, defaults to IfcDoor and, optionally, IfcOpeningElement and IfcWindow depending on the other parameters. Default is None.

includeOpeningsbool , optional

If set to True, unresolved IfcOpeningElement entities are included in the report. Default is True.

includeWindowsbool , optional

If set to True, IfcWindow and IfcWindowStandardCase are included. Default is False.

includeZeroSpaceConnectorsbool , optional

If set to True, connector elements found through IfcRelFillsElement are included even if no related IfcSpace was found. Default is True.

highCardinalityThresholdint , optional

Cardinalities above this number are labelled high_cardinality. Default is 2.

silentbool , optional

If set to True, error and warning messages are suppressed. Default is False.

Returns
list

A list of dictionaries. Each dictionary reports one connector element and the IfcSpace entities associated with it.

static ElementTypes(file, includeCounts: bool = False, silent: bool = False)

Returns the IFC element/entity types found in the input IFC file, sorted alphabetically.

static Entities(file, silent: bool = False)

Returns the parsed IFC STEP entity dictionary from the input IFC source.

This method accepts: - an IFCModel, - a previously parsed IFC entity dictionary, - a path to an IFC file, - a STEP text string, - or an ifcopenshell file-like object that can be serialised to STEP text.

Parameters
fileIFCModel, dict, str, or ifcopenshell.file-like object

The input IFC source.

silentbool , optional

If set to True, error and warning messages are suppressed. Default is False.

Returns
dict

A dictionary of parsed IFC entities keyed by STEP id. For IFCModel inputs, the model’s underlying entity dictionary is returned directly. Returns None if parsing fails.

static EntitiesByPath(path: str, silent: bool = False)

Returns the parsed IFC STEP entity dictionary from the IFC file at the input path.

Parameters
pathstr

The input IFC file path.

silentbool , optional

If set to True, error and warning messages are suppressed. Default is False.

Returns
dict

A dictionary of parsed IFC entities keyed by STEP id. Each value is an IFCFastEntity object. Returns None if parsing fails.

static Export(model, path: str, overwrite: bool = False, preserveSourceFormatting: bool = True, validate: bool = True, updateModel: bool = True, silent: bool = False) → str

Exports an in-memory IFCModel to an IFC STEP Physical File.

The method is intended for round-trip export of models created with IFC.ModelByPath and subsequently modified in memory. Unchanged STEP entity statements are preserved verbatim from the source file whenever possible. New or modified IFCFastEntity objects are serialized from their in-memory values.

Parameters
modelIFCModel

The input in-memory IFC model.

pathstr

The output IFC file path. The .ifc extension is added when the input path has no extension.

overwritebool , optional

If set to True, an existing output file may be replaced atomically. Default is False.

preserveSourceFormattingbool , optional

If set to True and the model has a readable sourcePath, unchanged source entity statements are copied verbatim. This is the preferred round-trip mode because the current lightweight parser represents both quoted STEP strings and enumeration values as Python strings. Default is True.

validatebool , optional

If set to True, validates entity ids and references before writing, reparses the temporary exported file, and verifies that its parsed entities match the in-memory model before replacing the destination. Default is True.

updateModelbool , optional

If set to True after a successful export, updates model.sourcePath and its preserved header and marks the model as clean. The model revision is not changed because export does not alter its entities. Default is True.

silentbool , optional

If set to True, suppresses errors, warnings, and information messages. Default is False.

Returns
str

The absolute exported IFC path, or None if the operation fails.

Notes

The exporter writes the existing parsed IFC model; it does not rebuild product geometry. It therefore preserves semantic relationships added by IFC.SemanticRelationshipsByGraph together with the original IFC entities and references.

For source-backed models, unchanged entity statements are preserved exactly. For a model created only from a raw entity dictionary, generic serialization is used. The four relationship classes currently created by IFC.SemanticRelationshipsByGraph are serialized explicitly and do not depend on string/enumeration heuristics.

static ExportReferenceView(model: Any, path: str, schema: str = 'IFC4', mvd: str = 'RV1.2', project_name: str = 'TopologicPy Project', site_name: str = 'Default Site', building_name: str = 'Default Building', storey_name: str = 'Level 0', length_unit: str = 'METRE', angle_unit: str = 'RADIAN', area_unit: str = 'SQUARE_METRE', volume_unit: str = 'CUBIC_METRE', use_sweeps: bool = True, use_tessellation_fallback: bool = True, transfer_dictionaries: bool = True, validate: bool = True, silent: bool = False) → str

Export a TopologicPy-authored model to an IFC4 Reference View-compatible IFC.

static FileByPath(path: str, silent: bool = False)

Returns the parsed IFC STEP entity dictionary found at the input path.

static KnowledgeGraphByFile(file, includeRels: list = None, excludeRels: list = None, subjectKey: str = 'global_id', objectKey: str = 'global_id', includeInverse: bool = False, namespacePrefix: str = 'inst', useRDFLib: bool = True, silent: bool = False)

Returns a KnowledgeGraph built from IFC relationship RDF triples.

static MeshData(model, includeTypes: list = [], excludeTypes: list = [], dictionaryMode: str = 'basic', circleSides: int = 24, scale: Optional[float] = None, ontology: bool = True, silent: bool = False) → dict

Returns aggregated mesh data in metres using IFCModel geometry caches.

Omit the deprecated scale argument to use project length units. Explicit scale overrides conversion with a positive raw-coordinate multiplier. Invalid declared units or scale values return None.

static MeshDataByPath(path: str, includeTypes: list = [], excludeTypes: list = [], dictionaryMode: str = 'basic', circleSides: int = 24, scale: Optional[float] = None, ontology: bool = True, silent: bool = False) → dict

Parses an IFC path once and delegates to IFC.MeshData.

static Model(file, sourcePath: str = None, silent: bool = False)

Returns an in-memory IFCModel from the input IFC source.

This convenience method accepts an existing IFCModel, a parsed entity dictionary, a path, STEP text, or a serialisable IFC file-like object. Existing IFCModel inputs are returned unchanged.

Parameters
fileIFCModel, dict, str, or file-like object

The input IFC source.

sourcePathstr , optional

Source path associated with a raw entity dictionary or STEP text. Default is None.

silentbool , optional

If True, suppresses errors and warnings. Default is False.

Returns
IFCModel

The resulting in-memory model, or None if the input cannot be read.

static ModelByEntities(entities, sourcePath: str = None, schema: str = None, header: str = None, silent: bool = False)

Wraps a parsed IFC entity dictionary in an IFCModel.

The entity dictionary is retained by reference and is not copied.

Parameters
entitiesdict

Parsed IFC entities keyed by STEP id.

sourcePathstr , optional

Original IFC source path. Default is None.

schemastr , optional

IFC schema identifier. Default is None.

headerstr , optional

Preserved STEP HEADER section. Default is None.

silentbool , optional

If True, suppresses errors and warnings. Default is False.

Returns
IFCModel

The wrapped in-memory IFC model, or None if entities is invalid.

static ModelByPath(path: str, silent: bool = False)

Parses an IFC STEP file once and returns an in-memory IFCModel.

Parameters
pathstr

Path to the IFC STEP file.

silentbool , optional

If True, suppresses errors and warnings. Default is False.

Returns
IFCModel

The parsed in-memory IFC model, or None if parsing fails.

static NavigationModel(model, eyeHeight: float = 1.6, maxSlope: float = 45.0, obstacleTypes=None, excludeTypes=None)

Extract an editable NavigationModel from a parsed IFC model.

Coordinates are world metres. Roofs are excluded, containment determines storeys before elevation fallback, and openings cut host obstacles. maxSlope is the maximum slab walking slope in degrees. Stairs, ramps, landings and lifts remain separate connector descriptors. This method does not reparse the input model. See topologicpy.Navigation.

static Object(file, globalId: str = None, ifcId: int = None, ifcKey: str = None, silent: bool = False)

Returns a dynamic IFCEntity wrapper for one IFC entity.

Parameters
filedict, str, or ifcopenshell.file-like object

The input IFC source.

globalIdstr , optional

The GlobalId of the IFC entity to retrieve.

ifcIdint , optional

The STEP id of the IFC entity to retrieve.

ifcKeystr , optional

The STEP key of the IFC entity to retrieve, e.g. “#123”.

silentbool , optional

If True, suppresses error and warning messages. Default is False.

Returns
IFCEntity

A dynamic IFC entity wrapper. Returns None if the entity is not found.

static Objects(file, includeTypes: list = None, excludeTypes: list = None, includeEmpty: bool = True, silent: bool = False)

Returns dynamic IFCEntity wrappers for IFC entities in a file.

Parameters
filedict, str, or ifcopenshell.file-like object

The input IFC source.

includeTypeslist , optional

IFC entity types to include. Default is None.

excludeTypeslist , optional

IFC entity types to exclude. Default is None.

includeEmptybool , optional

If True, include entities with no extracted property payload. Default is True.

silentbool , optional

If True, suppresses error and warning messages. Default is False.

Returns
list

A list of IFCEntity objects.

static ObjectsByType(file, ifcType: str, includeEmpty: bool = True, silent: bool = False)

Returns dynamic IFCEntity wrappers for entities of one IFC type.

static OntologyClassByIFCClass(ifcClass: str, defaultValue: Any = 'top:Element')

Returns the TopologicPy ontology class for an IFC class.

static Properties(file, includeTypes: list = None, excludeTypes: list = None, keyMode: str = 'global_id', includeEmpty: bool = False, silent: bool = False)

Extracts semantic properties, quantities, classifications, and materials from an IFC file.

Parameters
filedict, str, or ifcopenshell.file-like object

The input IFC source.

includeTypeslist , optional

IFC entity types to include. If None, all product-like entities are included. Default is None.

excludeTypeslist , optional

IFC entity types to exclude. Default is None.

keyModestr , optional

Entity key mode. Options are “global_id”, “id”, or “key”. Default is “global_id”.

includeEmptybool , optional

If True, entities with no extracted semantic payload are included. Default is False.

silentbool , optional

If True, suppresses error and warning messages. Default is False.

Returns
dict

A dictionary with two main keys:

{
“entities”: {
“<entity_key>”: {

“ifc_id”: int, “ifc_key”: “#123”, “ifc_type”: “IfcWall”, “global_id”: “…”, “name”: “…”, “properties”: {…}, “type_properties”: {…}, “quantities”: {…}, “classifications”: […], “materials”: […], “type”: {…}

}

}, “summary”: {…}

}

static RDFTriples(file, includeRels: list = None, excludeRels: list = None, subjectKey: str = 'global_id', objectKey: str = 'global_id', includeInverse: bool = False, namespacePrefix: str = 'inst', silent: bool = False) → Optional[List[Tuple[str, str, str]]]

Returns RDF-style triples from IFC relationships.

Unlike IFC.Triples(), which returns metadata-rich relationship records, this method returns compact triples suitable for KnowledgeGraph.ByTriples and Reasoner.RDFGraphByTriples.

static RelationshipPredicateByIFCClass(ifcClass: str, defaultValue: Any = None)

Returns semantic predicate metadata for an IFC relationship class.

Returns
dict

A dictionary containing ontology_predicate and, when known, inverse_predicate plus a normalized relationship label.

static RelationshipTypes(file, includeCounts: bool = False, silent: bool = False)

Returns the IFC relationship entity types found in the input IFC file, sorted alphabetically.

static RelationshipTypesByGlobalId(file, globalId: str, includeCounts: bool = False, includeRelationshipIds: bool = False, silent: bool = False)

Returns the IFC relationship entity types associated with the IFC element identified by the input GlobalId.

static SemanticRelationshipsByGraph(model, graph, annotateGraph: bool = True, silent: bool = False) → dict

Creates missing in-memory IFC semantic relationship entities from an IFC adjacency TGraph.

The input graph and IFCModel must refer to the same in-memory model. Each participating graph vertex must contain an IFC_id referring to an entity in that model. Existing IFC relationships are detected and are not duplicated.

The method uses the following conservative mapping:

  • IfcSpace to non-space element -> IfcRelSpaceBoundary

  • IfcDistributionPort to IfcDistributionPort -> IfcRelConnectsPorts

  • IfcDistributionPort to element -> IfcRelConnectsPortToElement

  • element to element -> IfcRelConnectsElements

Direct space-to-space relationships are not guessed. When a collapsed graph edge contains connecting_element_id, connector_id, or opening_id, the method instead creates a space-to-connecting-element relationship for each endpoint.

This method modifies only the returned in-memory entity dictionary. It does not write an IFC STEP file. IFC export support can subsequently serialise the returned entities dictionary.

Parameters
modelIFCModel

The mutable in-memory IFC model that owns the graph entities.

graphtopologicpy.TGraph

The input IFC adjacency TGraph. Its vertex dictionaries must contain valid IFC_id values.

annotateGraphbool , optional

If set to True, graph-edge dictionaries are annotated with the IFC relationship ids, GlobalIds, and classes that were created or matched. The graph dictionary is also updated with a summary. Default is True.

silentbool , optional

If set to True, error and warning messages are suppressed. Default is False.

Returns
dict

A dictionary containing:

  • graph: the optionally annotated input graph;

  • entities: the parsed IFC entities plus inferred relationships;

  • relationshipEntities: newly created IFCFastEntity objects;

  • addedRelationships: readable records for created relationships;

  • existingRelationships: graph candidates already represented in IFC;

  • skippedEdges: graph edges that could not safely map to IFC;

  • summary: counts by result and IFC relationship class.

static Summary(model, silent: bool = False) → dict

Returns a cached compact summary of an IFCModel.

static SummaryByPath(path: str, silent: bool = False) → dict

Parses an IFC path once and delegates to IFC.Summary.

static TGraphByPath(path: str, importMode: str = 'topology', clean: bool = False, storeBREP: bool = False, useInternalVertex: bool = False, includeTypes: list = None, strictIncludeTypes: bool = True, excludeTypes: list = None, includeRels: list = None, excludeRels: list = None, dictionaryMode: str = 'basic', xMin: float = -0.5, yMin: float = -0.5, zMin: float = -0.5, xMax: float = 0.5, yMax: float = 0.5, zMax: float = 0.5, vertexColorKey: str = 'color', edgeColorKey: str = 'color', colorScale: str = 'viridis', epsilon: float = 0.01, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = False)

Creates a TGraph from an IFC path.

This method is the IFC-owned wrapper around the previous TGraph.ByIFCPath workflow. It keeps graph construction available from IFC.py while allowing TGraph.py to remain focused on graph operations.

static ThermalCellComplex(model, separatorTypes: list = None, margin: float = 0.5, circleSides: int = 24, scale: Optional[float] = None, tolerance: float = 0.0001, silent: bool = False)

Creates a proof-of-concept thermal CellComplex from an IFCModel.

Construction elements are reduced to oversized zero-thickness analytical planes. The planes sequentially slice one enclosing cell. IfcSpace geometry is used only to provide interior seed vertices that select and label the resulting construction-derived cells.

This proof of concept is intended for predominantly planar walls, slabs, roofs, curtain walls, and virtual elements. Each construction element is represented by a plane through its centroid, parallel to its largest face. The plane is enlarged sufficiently to cross the complete model enclosure.

Parameters
modelIFCModel

The input in-memory IFC model.

separatorTypeslist , optional

IFC types used as construction separators. Default is [“IfcWall”, “IfcSlab”, “IfcRoof”, “IfcCurtainWall”, “IfcVirtualElement”].

marginfloat , optional

Padding added to the enclosing cell in output coordinate units (metres with automatic conversion). Default is 0.5.

circleSidesint , optional

Number of sides used for circular IFC geometry. Default is 24.

scalefloat , optional

Deprecated raw-coordinate multiplier. None converts IFC length units to metres; an explicit finite, positive value overrides conversion.

tolerancefloat , optional

The desired geometric tolerance. Default is 0.0001.

silentbool , optional

If True, suppresses errors, warnings, and progress information. Default is False.

Returns
topologic_core.CellComplex

The construction-derived thermal CellComplex, or None on failure.

Notes

This method deliberately extends each separator across the entire model. It can therefore over-partition non-convex or highly articulated buildings. Unwanted regions are discarded by selecting only cells containing an IfcSpace interior seed vertex.

static Topologies(model, includeTypes: list = [], excludeTypes: list = [], dictionaryMode: str = 'basic', clean: bool = False, epsilon: float = 0.01, angTolerance: float = 0.1, tolerance: float = 0.0001, circleSides: int = 24, topologyType: str = None, scale: Optional[float] = None, source: str = None, ontology: bool = True, silent: bool = False)

Imports product geometry in metres from an already parsed IFCModel.

Omit the deprecated scale argument to use project length units. Explicit scale overrides conversion with a positive raw-coordinate multiplier. Invalid declared units or scale values return None.

static TopologiesByEntities(entities, includeTypes: list = [], excludeTypes: list = [], dictionaryMode: str = 'basic', clean: bool = False, epsilon: float = 0.01, angTolerance: float = 0.1, tolerance: float = 0.0001, circleSides: int = 24, topologyType: str = None, scale: Optional[float] = None, source: str = None, ontology: bool = True, silent: bool = False)

Compatibility wrapper for IFC.Topologies using an entity dictionary.

static TopologiesByFile(file, includeTypes: list = [], excludeTypes: list = [], dictionaryMode: str = 'basic', clean: bool = False, ontology: bool = True, epsilon: float = 0.01, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = False, scale: Optional[float] = None, topologyType: str = None, circleSides: int = 24) → list[Any]

Imports an IFCModel or other IFC source through IFC.Topologies.

Geometry defaults to metres. scale is a deprecated raw-coordinate override; topologyType and circleSides are passed through. Existing positional argument order is preserved.

static TopologiesByPath(path: str, includeTypes: list = [], excludeTypes: list = [], dictionaryMode: str = 'basic', circleSides: int = 24, clean: bool = False, ontology: bool = True, epsilon: float = 0.0001, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = False, scale: Optional[float] = None, topologyType: str = None) → list[Any]

Parses an IFC path once and delegates to IFC.Topologies.

Geometry defaults to metres. scale is a deprecated raw-coordinate override; topologyType and circleSides are passed through. Existing positional argument order is preserved.

static Triples(file, includeRels: list = None, excludeRels: list = None, subjectKey: str = 'global_id', objectKey: str = 'global_id', includeMetadata: bool = True, silent: bool = False)

Returns IFC relationship triples from the input IFC file.

Each IfcRel* entity is converted into one or more explicit triples in the form:

{

“subject”: …, “predicate”: …, “object”: …

}

If includeMetadata is True, each triple also includes IFC ids, STEP keys, entity types, entity names, and relationship metadata.

Parameters
filedict, str, or ifcopenshell.file-like object

The input IFC source.

includeRelslist , optional

A list of IFC relationship types to include. If None, all supported relationship types are included. Default is None.

excludeRelslist , optional

A list of IFC relationship types to exclude. Default is None.

subjectKeystr , optional

Identifier to use for the subject. Options are “global_id”, “id”, or “key”. Default is “global_id”.

objectKeystr , optional

Identifier to use for the object. Options are “global_id”, “id”, or “key”. Default is “global_id”.

includeMetadatabool , optional

If set to True, additional metadata is included in each triple. Default is True.

silentbool , optional

If set to True, error and warning messages are suppressed. Default is False.

Returns
list

A list of dictionaries representing IFC relationship triples.

static ValidateBrickMappings(brickTTLPath: str = None, includeGeneric: bool = True, silent: bool = False)

Validates the mapped Brick classes against a Brick TTL/RDF file when supplied.

If brickTTLPath is omitted or RDFLib is unavailable, this method still returns the unique mapped Brick terms but marks ontology validation as not run.

class topologicpy.IFC.IFCEntity(entity, entities=None, properties=None)

Bases: object

Lightweight dynamic wrapper around an IFCFastEntity.

This class exposes IFC root attributes, extracted properties, quantities, classifications, materials, and type information through Python attribute access.

Attributes
Classifications
Entity

Returns the wrapped IFCFastEntity.

IFCId
IFCKey
IFCType
Materials
Properties
Quantities
Type
TypeProperties
TypeQuantities

Methods

Attribute(name[, default])

Returns an attribute/property safely.

ToDict()

Returns a serializable dictionary representation.

is_a

Attribute(name, default=None)

Returns an attribute/property safely.

property Classifications
property Entity

Returns the wrapped IFCFastEntity.

property IFCId
property IFCKey
property IFCType
property Materials
property Properties
property Quantities
ToDict()

Returns a serializable dictionary representation.

property Type
property TypeProperties
property TypeQuantities
is_a(name=None)
class topologicpy.IFC.IFCFastEntity(id: 'int', type: 'str', args: 'list')

Bases: object

Methods

is_a

args: list
id: int
is_a(name: Optional[str] = None)
type: str
class topologicpy.IFC.IFCModel(entities: ~typing.Dict[int, ~topologicpy.IFC.IFCFastEntity], sourcePath: ~typing.Optional[str] = None, schema: ~typing.Optional[str] = None, header: ~typing.Optional[str] = None, modelId: str = <factory>, revision: int = 0, dirty: bool = False, metadataCache: ~typing.Dict[~typing.Any, ~typing.Any] = <factory>, placementCache: ~typing.Dict[~typing.Any, ~typing.Any] = <factory>, meshCache: ~typing.Dict[~typing.Any, ~typing.Any] = <factory>, topologyCache: ~typing.Dict[~typing.Any, ~typing.Any] = <factory>, propertyCache: ~typing.Dict[~typing.Any, ~typing.Any] = <factory>, tripleCache: ~typing.Dict[~typing.Any, ~typing.Any] = <factory>, summaryCache: ~typing.Dict[~typing.Any, ~typing.Any] = <factory>, indexes: ~typing.Dict[str, ~typing.Any] = <factory>)

Bases: object

Stores one parsed IFC document in memory.

The model owns the parsed IFCFastEntity dictionary together with source metadata and caches that can be reused by subsequent IFC operations. The input entity dictionary is retained by reference rather than copied so that future semantic and exporter operations can modify one shared in-memory model.

Parameters
entitiesdict

Parsed IFC entities keyed by STEP id.

sourcePathstr , optional

Original IFC path, when known. Default is None.

schemastr , optional

IFC schema identifier, such as IFC2X3 or IFC4. Default is None.

headerstr , optional

Preserved STEP HEADER section. Default is None.

modelIdstr , optional

Unique identifier for this in-memory model. A UUID is generated by default.

revisionint , optional

In-memory model revision. Default is 0.

dirtybool , optional

Indicates whether the model differs from its source. Default is False.

Notes

nextEntityId is initialized to one greater than the largest existing STEP id. The cache dictionaries are intentionally empty at creation and will be populated lazily by later stages of the IFC API refactor.

Attributes
header
schema
sourcePath

Methods

get(entityId[, default])

Returns the entity at the input STEP id.

invalidateCaches([geometry])

Invalidates cached data after an in-memory model modification.

items()

Returns the model entity items view.

keys()

Returns the model entity keys view.

touch([geometry])

Marks the model as modified and invalidates affected caches.

values()

Returns the model entity values view.

dirty: bool = False
entities: Dict[int, IFCFastEntity]
get(entityId, default=None)

Returns the entity at the input STEP id.

header: Optional[str] = None
indexes: Dict[str, Any]
invalidateCaches(geometry: bool = False)

Invalidates cached data after an in-memory model modification.

items()

Returns the model entity items view.

keys()

Returns the model entity keys view.

meshCache: Dict[Any, Any]
metadataCache: Dict[Any, Any]
modelId: str
nextEntityId: int
placementCache: Dict[Any, Any]
propertyCache: Dict[Any, Any]
revision: int = 0
schema: Optional[str] = None
sourcePath: Optional[str] = None
summaryCache: Dict[Any, Any]
topologyCache: Dict[Any, Any]
touch(geometry: bool = False)

Marks the model as modified and invalidates affected caches.

tripleCache: Dict[Any, Any]
values()

Returns the model entity values view.