Table of Contents

Class IfcModel

Namespace
IfcIO
Assembly
IfcIO.dll

Top-level in-memory IFC BIM model. Manages spatial hierarchy (Project, Site, Building, Storeys), geometry meshes, materials, property sets, and serialization to ISO 10303-21 STEP physical files (.ifc, .ifczip), binary glTF 2.0 (.glb), and Wavefront OBJ (.obj).

public sealed class IfcModel

Inheritance

Inherited Members

Constructors

IfcModel()

public IfcModel()

Properties

AllElements

public IEnumerable<IfcElement> AllElements { get; }

Property Value

IEnumerable<IfcElement>

AllOpenings

public IEnumerable<IfcOpeningElement> AllOpenings { get; }

Property Value

IEnumerable<IfcOpeningElement>

AllPorts

public IEnumerable<IfcDistributionPort> AllPorts { get; }

Property Value

IEnumerable<IfcDistributionPort>

AllSpaces

public IEnumerable<IfcSpace> AllSpaces { get; }

Property Value

IEnumerable<IfcSpace>

AngleUnit

public IfcPlaneAngleUnit AngleUnit { get; set; }

Property Value

IfcPlaneAngleUnit

Application

public string Application { get; set; }

Property Value

string

Author

public string Author { get; set; }

Property Value

string

BuildingName

public string BuildingName { get; set; }

Property Value

string

CostSchedules

public List<IfcCostSchedule> CostSchedules { get; }

Property Value

List<IfcCostSchedule>

GridSystem

Spatial grid system (axes and levels) associated with the IFC model.

public IfcGridSystem? GridSystem { get; set; }

Property Value

IfcGridSystem?

Groups

public List<IfcGroup> Groups { get; }

Property Value

List<IfcGroup>

LengthUnit

public IfcLengthUnit LengthUnit { get; set; }

Property Value

IfcLengthUnit

MaterialLayerSets

public List<IfcMaterialLayerSet> MaterialLayerSets { get; }

Property Value

List<IfcMaterialLayerSet>

MaterialProfileSets

public List<IfcMaterialProfileSet> MaterialProfileSets { get; }

Property Value

List<IfcMaterialProfileSet>

Materials

public List<IfcMaterial> Materials { get; }

Property Value

List<IfcMaterial>

Organization

public string Organization { get; set; }

Property Value

string

ProjectName

public string ProjectName { get; set; }

Property Value

string

Schema

public IfcSchema Schema { get; set; }

Property Value

IfcSchema

Storeys

public List<IfcBuildingStorey> Storeys { get; }

Property Value

List<IfcBuildingStorey>

Systems

public List<IfcSystem> Systems { get; }

Property Value

List<IfcSystem>

TypeProducts

public List<IfcTypeProduct> TypeProducts { get; }

Property Value

List<IfcTypeProduct>

UseTessellationInIfc4

Whether to use modern IfcTriangulatedFaceSet for IFC4 exports (60% smaller files, faster).

public bool UseTessellationInIfc4 { get; set; }

Property Value

bool

WorkSchedules

public List<IfcWorkSchedule> WorkSchedules { get; }

Property Value

List<IfcWorkSchedule>

Zones

public List<IfcZone> Zones { get; }

Property Value

List<IfcZone>

Methods

AddClippedSolid(string, IfcExtrudedAreaSolid, IfcPlane, bool, IfcMaterial?, IfcBuildingStorey?, string)

Adds an element defined by a 3D solid clipped by an infinite plane (Constructive Solid Geometry / Boolean clipping). Conforms to buildingSMART IFCBOOLEANCLIPPINGRESULT.

public IfcElement AddClippedSolid(string name, IfcExtrudedAreaSolid solid, IfcPlane plane, bool agreementFlag = true, IfcMaterial? material = null, IfcBuildingStorey? storey = null, string ifcType = "IfcBuildingElementProxy")

Parameters

name string
solid IfcExtrudedAreaSolid
plane IfcPlane
agreementFlag bool
material IfcMaterial?
storey IfcBuildingStorey?
ifcType string

Returns

IfcElement

AddCostSchedule(string, string, IfcCostScheduleType)

Creates and registers a 5D cost schedule / budget plan. Conforms to buildingSMART standard IFCCOSTSCHEDULE.

public IfcCostSchedule AddCostSchedule(string name, string currency = "USD", IfcCostScheduleType type = IfcCostScheduleType.CostPlan)

Parameters

name string
currency string
type IfcCostScheduleType

Returns

IfcCostSchedule

AddDistributionPort(IfcElement, string, IfcFlowDirection, IfcVector3?, IfcVector3?, string?)

Adds an MEP distribution port (terminal) to an element for flow network connectivity. Conforms to buildingSMART IFCDISTRIBUTIONPORT and IFCRELCONNECTSPORTTOELEMENT.

public static IfcDistributionPort AddDistributionPort(IfcElement hostElement, string name, IfcFlowDirection flowDirection = IfcFlowDirection.SourceAndSink, IfcVector3? position = null, IfcVector3? direction = null, string? systemType = null)

Parameters

hostElement IfcElement
name string
flowDirection IfcFlowDirection
position IfcVector3?
direction IfcVector3?
systemType string?

Returns

IfcDistributionPort

AddElement(IfcElement, IfcBuildingStorey?)

Adds an element to the specified storey (or the first storey by default).

public void AddElement(IfcElement element, IfcBuildingStorey? storey = null)

Parameters

element IfcElement
storey IfcBuildingStorey?

AddExtrudedCircle(string, double, double, IfcVector3?, IfcVector3?, IfcMaterial?, IfcBuildingStorey?, string?)

Creates and adds an element with a parametric circular extruded swept solid.

public IfcElement AddExtrudedCircle(string name, double radius, double depth, IfcVector3? position = null, IfcVector3? direction = null, IfcMaterial? material = null, IfcBuildingStorey? storey = null, string? ifcType = null)

Parameters

name string
radius double
depth double
position IfcVector3?
direction IfcVector3?
material IfcMaterial?
storey IfcBuildingStorey?
ifcType string?

Returns

IfcElement

AddExtrudedRectangle(string, double, double, double, IfcVector3?, IfcVector3?, IfcMaterial?, IfcBuildingStorey?, string?)

Creates and adds an element with a parametric rectangular extruded swept solid.

public IfcElement AddExtrudedRectangle(string name, double xDim, double yDim, double depth, IfcVector3? position = null, IfcVector3? direction = null, IfcMaterial? material = null, IfcBuildingStorey? storey = null, string? ifcType = null)

Parameters

name string
xDim double
yDim double
depth double
position IfcVector3?
direction IfcVector3?
material IfcMaterial?
storey IfcBuildingStorey?
ifcType string?

Returns

IfcElement

AddGroup(string, string?, IEnumerable<IfcElement>?)

Creates and registers a logical grouping of building elements.

public IfcGroup AddGroup(string name, string? description = null, IEnumerable<IfcElement>? elements = null)

Parameters

name string
description string?
elements IEnumerable<IfcElement>?

Returns

IfcGroup

AddMaterialLayerSet(string, IEnumerable<IfcMaterialLayer>?)

Creates and registers a multi-layer material set (composite construction) in the model. Conforms to buildingSMART IFCMATERIALLAYERSET.

public IfcMaterialLayerSet AddMaterialLayerSet(string name, IEnumerable<IfcMaterialLayer>? layers = null)

Parameters

name string
layers IEnumerable<IfcMaterialLayer>?

Returns

IfcMaterialLayerSet

AddMaterialProfileSet(string, IEnumerable<IfcMaterialProfile>?)

Creates and registers a structural material profile set in the model. Conforms to buildingSMART IFCMATERIALPROFILESET.

public IfcMaterialProfileSet AddMaterialProfileSet(string name, IEnumerable<IfcMaterialProfile>? profiles = null)

Parameters

name string
profiles IEnumerable<IfcMaterialProfile>?

Returns

IfcMaterialProfileSet

AddMesh(string, IReadOnlyList<IfcVector3>, IReadOnlyList<int>, IfcMaterial?, IfcBuildingStorey?, string?)

Creates and adds an element with a 3D mesh geometry to the model.

public IfcElement AddMesh(string name, IReadOnlyList<IfcVector3> vertices, IReadOnlyList<int> indices, IfcMaterial? material = null, IfcBuildingStorey? storey = null, string? ifcType = null)

Parameters

name string
vertices IReadOnlyList<IfcVector3>
indices IReadOnlyList<int>
material IfcMaterial?
storey IfcBuildingStorey?
ifcType string?

Returns

IfcElement

AddOpening(IfcElement, string, IfcExtrudedAreaSolid?, IfcMesh?, IfcElement?)

Adds an opening / void element to a host building element (e.g. wall cutout for window/door).

public IfcOpeningElement AddOpening(IfcElement hostElement, string name, IfcExtrudedAreaSolid? solid = null, IfcMesh? mesh = null, IfcElement? filling = null)

Parameters

hostElement IfcElement
name string
solid IfcExtrudedAreaSolid?
mesh IfcMesh?
filling IfcElement?

Returns

IfcOpeningElement

AddRevolvedSolid(string, IfcProfileDef, double, IfcVector3?, IfcAxis1Placement?, IfcMaterial?, IfcBuildingStorey?, string?)

Creates and adds an element with a parametric revolved swept solid.

public IfcElement AddRevolvedSolid(string name, IfcProfileDef profile, double angle = 6.283185307179586, IfcVector3? position = null, IfcAxis1Placement? axis = null, IfcMaterial? material = null, IfcBuildingStorey? storey = null, string? ifcType = null)

Parameters

name string
profile IfcProfileDef
angle double
position IfcVector3?
axis IfcAxis1Placement?
material IfcMaterial?
storey IfcBuildingStorey?
ifcType string?

Returns

IfcElement

AddSpace(string, string?, string?, double, double, IfcBuildingStorey?, IfcMesh?)

Adds an architectural space, room, or zone to the specified storey.

public IfcSpace AddSpace(string name, string? spaceNumber = null, string? longName = null, double grossFloorArea = 0, double height = 3, IfcBuildingStorey? storey = null, IfcMesh? mesh = null)

Parameters

name string
spaceNumber string?
longName string?
grossFloorArea double
height double
storey IfcBuildingStorey?
mesh IfcMesh?

Returns

IfcSpace

AddStorey(string, double)

Adds a storey to the building spatial hierarchy.

public IfcBuildingStorey AddStorey(string name, double elevation = 0)

Parameters

name string
elevation double

Returns

IfcBuildingStorey

AddSystem(string, string, IEnumerable<IfcElement>?)

Creates and registers a functional MEP building system (e.g. HVAC, Hydronic, Plumbing, Electrical).

public IfcSystem AddSystem(string name, string systemType = "HVAC", IEnumerable<IfcElement>? elements = null)

Parameters

name string
systemType string
elements IEnumerable<IfcElement>?

Returns

IfcSystem

AddWorkSchedule(string, string?)

Creates and registers a 4D construction work schedule. Conforms to buildingSMART standard IFCWORKSCHEDULE.

public IfcWorkSchedule AddWorkSchedule(string name, string? description = null)

Parameters

name string
description string?

Returns

IfcWorkSchedule

AddZone(string, string?, IEnumerable<IfcSpace>?)

Creates and registers a spatial zone grouping spaces sharing thermal, fire, or acoustic classifications. Conforms to buildingSMART standard IFCZONE.

public IfcZone AddZone(string name, string? zoneType = null, IEnumerable<IfcSpace>? spaces = null)

Parameters

name string
zoneType string?
spaces IEnumerable<IfcSpace>?

Returns

IfcZone

AssignGridLocations(IfcGridSystem?)

Populates grid location tags across elements in this model using the attached or extracted grid system.

public int AssignGridLocations(IfcGridSystem? gridSystem = null)

Parameters

gridSystem IfcGridSystem?

Returns

int

AssignMaterialLayerSet(IfcElement, IfcMaterialLayerSet, double)

Associates a multi-layer material set with an element with an optional reference line offset. Conforms to buildingSMART IFCMATERIALLAYERSETUSAGE and IFCRELASSOCIATESMATERIAL.

public void AssignMaterialLayerSet(IfcElement element, IfcMaterialLayerSet layerSet, double offset = 0)

Parameters

element IfcElement
layerSet IfcMaterialLayerSet
offset double

AssignMaterialProfileSet(IfcElement, IfcMaterialProfileSet, int)

Associates a material profile set with a structural element with a cardinal point alignment. Conforms to buildingSMART IFCMATERIALPROFILESETUSAGE and IFCRELASSOCIATESMATERIAL.

public void AssignMaterialProfileSet(IfcElement element, IfcMaterialProfileSet profileSet, int cardinalPoint = 5)

Parameters

element IfcElement
profileSet IfcMaterialProfileSet
cardinalPoint int

CalculateAllBaseQuantities(bool)

Computes buildingSMART standard Base Quantities (QTO) for all elements in the model based on their 3D geometry.

public void CalculateAllBaseQuantities(bool overwriteExisting = false)

Parameters

overwriteExisting bool

Whether to replace existing Qto_* sets if already present.

CalculateTotalCost()

Calculates the grand total cost across all cost schedules in the model.

public double CalculateTotalCost()

Returns

double

ClassifyElement(string, string?)

public static string ClassifyElement(string name, string? materialName = null)

Parameters

name string
materialName string?

Returns

string

Compare(IfcModel, IfcDiffOptions?)

Compares this baseline model against a revision model, detecting added, deleted, and modified elements.

public IfcDiffReport Compare(IfcModel revisionModel, IfcDiffOptions? options = null)

Parameters

revisionModel IfcModel
options IfcDiffOptions?

Returns

IfcDiffReport

ConnectPorts(IfcDistributionPort, IfcDistributionPort)

Connects two distribution ports to model fluid, airflow, or electrical continuity between MEP elements. Conforms to buildingSMART IFCRELCONNECTSPORTS.

public static void ConnectPorts(IfcDistributionPort portA, IfcDistributionPort portB)

Parameters

portA IfcDistributionPort
portB IfcDistributionPort

Create(string, IfcSchema)

Creates a new empty IFC model with the specified project name and schema.

public static IfcModel Create(string projectName, IfcSchema schema = IfcSchema.Ifc2x3)

Parameters

projectName string
schema IfcSchema

Returns

IfcModel

DetectClashes(IfcModel, IfcClashOptions?)

Performs geometric clash detection between this model and another IFC model.

public IfcClashReport DetectClashes(IfcModel otherModel, IfcClashOptions? options = null)

Parameters

otherModel IfcModel
options IfcClashOptions?

Returns

IfcClashReport

DetectClashes(IfcClashOptions?)

Performs geometric self-clash detection within this IFC model.

public IfcClashReport DetectClashes(IfcClashOptions? options = null)

Parameters

options IfcClashOptions?

Returns

IfcClashReport

ExportCsv(string, IEnumerable<string>, string)

Exports elements and selected properties to a CSV spreadsheet file.

public void ExportCsv(string path, IEnumerable<string> propertyNames, string delimiter = ";")

Parameters

path string
propertyNames IEnumerable<string>
delimiter string

ExportCsv(TextWriter, IEnumerable<string>, string)

Exports elements and selected properties to a CSV System.IO.TextWriter.

public void ExportCsv(TextWriter writer, IEnumerable<string> propertyNames, string delimiter = ";")

Parameters

writer TextWriter
propertyNames IEnumerable<string>
delimiter string

ExportValidationBcf(string)

Runs model validation and exports any detected errors or warnings as a BCF 2.1 archive (.bcfzip) with affected element GUIDs linked for cross-discipline issue coordination.

public void ExportValidationBcf(string path)

Parameters

path string

Extract(string, string?)

Extracts elements matching a selector query string into a new self-contained IFC model.

public IfcModel Extract(string selectorQuery, string? newProjectName = null)

Parameters

selectorQuery string
newProjectName string?

Returns

IfcModel

Extract(Func<IfcElement, bool>, string?)

Extracts elements matching a predicate into a new self-contained IFC model.

public IfcModel Extract(Func<IfcElement, bool> predicate, string? newProjectName = null)

Parameters

predicate Func<IfcElement, bool>
newProjectName string?

Returns

IfcModel

ExtractGridSystem()

Automatically extracts grid axes from IFCGRID elements or metadata in this model.

public IfcGridSystem ExtractGridSystem()

Returns

IfcGridSystem

GetElementSimulationStateAt(IfcElement, DateTime)

Gets the 4D construction simulation state of an element at the specified date using the active work schedule.

public IfcElementSimulationState GetElementSimulationStateAt(IfcElement element, DateTime date)

Parameters

element IfcElement
date DateTime

Returns

IfcElementSimulationState

GetOrCreateType(string, string?)

Gets or creates a reusable IFC type definition object.

public IfcTypeProduct GetOrCreateType(string typeName, string? ifcType = null)

Parameters

typeName string
ifcType string?

Returns

IfcTypeProduct

GetSimulationProgressAt(DateTime)

Gets the overall 4D construction schedule progress (0.0 to 100.0) at the specified date.

public double GetSimulationProgressAt(DateTime date)

Parameters

date DateTime

Returns

double

ImportBcf(string)

Imports a BCF 2.1 archive (.bcfzip) file from disk.

public static List<BcfTopic> ImportBcf(string path)

Parameters

path string

Returns

List<BcfTopic>

ImportCsv(string, string)

Imports tabular CSV property values into matching elements by GlobalId or Id from a file.

public (int ElementsUpdated, int PropertiesUpdated) ImportCsv(string path, string delimiter = ";")

Parameters

path string
delimiter string

Returns

(int ElementsUpdated, int PropertiesUpdated)

ImportCsv(TextReader, string)

Imports tabular CSV property values into matching elements by GlobalId or Id from a System.IO.TextReader.

public (int ElementsUpdated, int PropertiesUpdated) ImportCsv(TextReader reader, string delimiter = ";")

Parameters

reader TextReader
delimiter string

Returns

(int ElementsUpdated, int PropertiesUpdated)

LoadBcf(string)

Loads BCF topics from a BCF 2.1 zip archive (.bcfzip).

public static List<BcfTopic> LoadBcf(string path)

Parameters

path string

Returns

List<BcfTopic>

Merge(IEnumerable<IfcModel>, string)

Merges multiple IFC models into a single coordinated model, reconciling storeys and re-indexing IDs.

public static IfcModel Merge(IEnumerable<IfcModel> models, string mergedProjectName = "Merged Project")

Parameters

models IEnumerable<IfcModel>
mergedProjectName string

Returns

IfcModel

OffsetCoordinates(IfcVector3)

Offsets all 3D mesh vertices in the model by a translation vector.

public void OffsetCoordinates(IfcVector3 offset)

Parameters

offset IfcVector3

Open(string)

Parses an existing IFC STEP file (.ifc or .ifczip) from disk into a structured model.

public static IfcModel Open(string path)

Parameters

path string

Returns

IfcModel

Open(Stream, string?)

Parses an existing IFC STEP physical file or stream into a structured model.

public static IfcModel Open(Stream stream, string? modelName = null)

Parameters

stream Stream
modelName string?

Returns

IfcModel

Open(TextReader, string?)

Parses an existing IFC STEP stream into a structured model with storeys, elements, properties, and meshes.

public static IfcModel Open(TextReader reader, string? modelName = null)

Parameters

reader TextReader
modelName string?

Returns

IfcModel

Purge()

Purges unreferenced, empty, and duplicate property sets, quantity sets, and empty building storeys.

public IfcPurgeStats Purge()

Returns

IfcPurgeStats

ResetCoordinates(out IfcVector3, double)

Detects large absolute coordinate offsets and centers geometry around the local origin (0,0,0) to prevent precision jitter.

public bool ResetCoordinates(out IfcVector3 offset, double thresholdDistance = 10000)

Parameters

offset IfcVector3
thresholdDistance double

Returns

bool

Save(string)

Serializes the IFC model to a file on disk (.ifc or .ifczip).

public void Save(string path)

Parameters

path string

Save(Stream, string)

Serializes the IFC model to a System.IO.Stream in ISO 10303-21 format.

public void Save(Stream stream, string fileName = "model.ifc")

Parameters

stream Stream
fileName string

Save(TextWriter, string)

Serializes the IFC model to a System.IO.TextWriter in ISO 10303-21 format.

public void Save(TextWriter writer, string fileName = "model.ifc")

Parameters

writer TextWriter
fileName string

SaveBcf(string, IEnumerable<BcfTopic>)

Exports a collection of BCF topics to a buildingSMART BCF 2.1 zip archive (.bcfzip).

public void SaveBcf(string path, IEnumerable<BcfTopic> topics)

Parameters

path string
topics IEnumerable<BcfTopic>

SaveBcf(Stream, IEnumerable<BcfTopic>)

Exports a collection of BCF topics to a stream in BCF 2.1 format.

public void SaveBcf(Stream stream, IEnumerable<BcfTopic> topics)

Parameters

stream Stream
topics IEnumerable<BcfTopic>

SaveGlb(string)

Exports the model to binary glTF 2.0 (.glb) format.

public void SaveGlb(string path)

Parameters

path string

SaveGlb(Stream)

Exports the model to binary glTF 2.0 (.glb) stream.

public void SaveGlb(Stream stream)

Parameters

stream Stream

SaveHtmlViewer(string, IfcHtmlViewerOptions?)

Exports the model to a standalone, interactive 3D WebGL HTML viewer (.html) with zero dependencies.

public void SaveHtmlViewer(string path, IfcHtmlViewerOptions? options = null)

Parameters

path string
options IfcHtmlViewerOptions?

SaveObj(string)

Exports the model to Wavefront OBJ format (.obj + .mtl).

public void SaveObj(string path)

Parameters

path string

SaveZip(string)

Serializes the IFC model to a compressed PKZip (.ifczip) archive file on disk.

public void SaveZip(string path)

Parameters

path string

Select(string)

Selects all elements in the model matching an IfcOpenShell-style selector query string.

public IEnumerable<IfcElement> Select(string selectorQuery)

Parameters

selectorQuery string

Returns

IEnumerable<IfcElement>

ToStepString(string)

Serializes the IFC model to an ISO 10303-21 STEP physical string.

public string ToStepString(string fileName = "model.ifc")

Parameters

fileName string

Returns

string

TraceConnectedElements(IfcElement)

Traverses the connected MEP distribution element network using Breadth-First Search (BFS) starting from the specified element.

public static List<IfcElement> TraceConnectedElements(IfcElement startElement)

Parameters

startElement IfcElement

Returns

List<IfcElement>

Validate()

Validates the model against buildingSMART MVD and geometric integrity rules.

public IfcValidationResult Validate()

Returns

IfcValidationResult

ValidateIds(string)

Validates the model against a buildingSMART Information Delivery Specification (IDS 1.0) XML file.

public IfcIdsValidationReport ValidateIds(string idsPath)

Parameters

idsPath string

Returns

IfcIdsValidationReport

ValidateIds(Stream)

Validates the model against a buildingSMART Information Delivery Specification (IDS 1.0) XML stream.

public IfcIdsValidationReport ValidateIds(Stream idsStream)

Parameters

idsStream Stream

Returns

IfcIdsValidationReport

ValidateIds(XDocument)

Validates the model against a loaded buildingSMART IDS System.Xml.Linq.XDocument.

public IfcIdsValidationReport ValidateIds(XDocument idsDoc)

Parameters

idsDoc XDocument

Returns

IfcIdsValidationReport