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 IfcModelInheritance
Inherited Members
Constructors
IfcModel()
public IfcModel()Properties
AllElements
public IEnumerable<IfcElement> AllElements { get; }Property Value
AllOpenings
public IEnumerable<IfcOpeningElement> AllOpenings { get; }Property Value
AllPorts
public IEnumerable<IfcDistributionPort> AllPorts { get; }Property Value
AllSpaces
public IEnumerable<IfcSpace> AllSpaces { get; }Property Value
AngleUnit
public IfcPlaneAngleUnit AngleUnit { get; set; }Property Value
Application
public string Application { get; set; }Property Value
Author
public string Author { get; set; }Property Value
BuildingName
public string BuildingName { get; set; }Property Value
CostSchedules
public List<IfcCostSchedule> CostSchedules { get; }Property Value
GridSystem
Spatial grid system (axes and levels) associated with the IFC model.
public IfcGridSystem? GridSystem { get; set; }Property Value
Groups
public List<IfcGroup> Groups { get; }Property Value
LengthUnit
public IfcLengthUnit LengthUnit { get; set; }Property Value
MaterialLayerSets
public List<IfcMaterialLayerSet> MaterialLayerSets { get; }Property Value
MaterialProfileSets
public List<IfcMaterialProfileSet> MaterialProfileSets { get; }Property Value
Materials
public List<IfcMaterial> Materials { get; }Property Value
Organization
public string Organization { get; set; }Property Value
ProjectName
public string ProjectName { get; set; }Property Value
Schema
public IfcSchema Schema { get; set; }Property Value
Storeys
public List<IfcBuildingStorey> Storeys { get; }Property Value
Systems
public List<IfcSystem> Systems { get; }Property Value
TypeProducts
public List<IfcTypeProduct> TypeProducts { get; }Property Value
UseTessellationInIfc4
Whether to use modern IfcTriangulatedFaceSet for IFC4 exports (60% smaller files, faster).
public bool UseTessellationInIfc4 { get; set; }Property Value
WorkSchedules
public List<IfcWorkSchedule> WorkSchedules { get; }Property Value
Zones
public List<IfcZone> Zones { get; }Property Value
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
namestringsolidIfcExtrudedAreaSolidplaneIfcPlaneagreementFlagboolmaterialIfcMaterial?storeyIfcBuildingStorey?ifcTypestring
Returns
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
namestringcurrencystringtypeIfcCostScheduleType
Returns
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
hostElementIfcElementnamestringflowDirectionIfcFlowDirectionpositionIfcVector3?directionIfcVector3?systemTypestring?
Returns
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
elementIfcElementstoreyIfcBuildingStorey?
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
namestringradiusdoubledepthdoublepositionIfcVector3?directionIfcVector3?materialIfcMaterial?storeyIfcBuildingStorey?ifcTypestring?
Returns
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
namestringxDimdoubleyDimdoubledepthdoublepositionIfcVector3?directionIfcVector3?materialIfcMaterial?storeyIfcBuildingStorey?ifcTypestring?
Returns
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
namestringdescriptionstring?elementsIEnumerable<IfcElement>?
Returns
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
namestringlayersIEnumerable<IfcMaterialLayer>?
Returns
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
namestringprofilesIEnumerable<IfcMaterialProfile>?
Returns
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
namestringverticesIReadOnlyList<IfcVector3>indicesIReadOnlyList<int>materialIfcMaterial?storeyIfcBuildingStorey?ifcTypestring?
Returns
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
hostElementIfcElementnamestringsolidIfcExtrudedAreaSolid?meshIfcMesh?fillingIfcElement?
Returns
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
namestringprofileIfcProfileDefangledoublepositionIfcVector3?axisIfcAxis1Placement?materialIfcMaterial?storeyIfcBuildingStorey?ifcTypestring?
Returns
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
namestringspaceNumberstring?longNamestring?grossFloorAreadoubleheightdoublestoreyIfcBuildingStorey?meshIfcMesh?
Returns
AddStorey(string, double)
Adds a storey to the building spatial hierarchy.
public IfcBuildingStorey AddStorey(string name, double elevation = 0)Parameters
Returns
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
namestringsystemTypestringelementsIEnumerable<IfcElement>?
Returns
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
Returns
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
namestringzoneTypestring?spacesIEnumerable<IfcSpace>?
Returns
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
gridSystemIfcGridSystem?
Returns
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
elementIfcElementlayerSetIfcMaterialLayerSetoffsetdouble
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
elementIfcElementprofileSetIfcMaterialProfileSetcardinalPointint
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
overwriteExistingbool-
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
ClassifyElement(string, string?)
public static string ClassifyElement(string name, string? materialName = null)Parameters
Returns
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
revisionModelIfcModeloptionsIfcDiffOptions?
Returns
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
portAIfcDistributionPortportBIfcDistributionPort
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
Returns
DetectClashes(IfcModel, IfcClashOptions?)
Performs geometric clash detection between this model and another IFC model.
public IfcClashReport DetectClashes(IfcModel otherModel, IfcClashOptions? options = null)Parameters
otherModelIfcModeloptionsIfcClashOptions?
Returns
DetectClashes(IfcClashOptions?)
Performs geometric self-clash detection within this IFC model.
public IfcClashReport DetectClashes(IfcClashOptions? options = null)Parameters
optionsIfcClashOptions?
Returns
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
pathstringpropertyNamesIEnumerable<string>delimiterstring
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
writerTextWriterpropertyNamesIEnumerable<string>delimiterstring
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
pathstring
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
Returns
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
predicateFunc<IfcElement, bool>newProjectNamestring?
Returns
ExtractGridSystem()
Automatically extracts grid axes from IFCGRID elements or metadata in this model.
public IfcGridSystem ExtractGridSystem()Returns
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
elementIfcElementdateDateTime
Returns
GetOrCreateType(string, string?)
Gets or creates a reusable IFC type definition object.
public IfcTypeProduct GetOrCreateType(string typeName, string? ifcType = null)Parameters
Returns
GetSimulationProgressAt(DateTime)
Gets the overall 4D construction schedule progress (0.0 to 100.0) at the specified date.
public double GetSimulationProgressAt(DateTime date)Parameters
dateDateTime
Returns
ImportBcf(string)
Imports a BCF 2.1 archive (.bcfzip) file from disk.
public static List<BcfTopic> ImportBcf(string path)Parameters
pathstring
Returns
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
Returns
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
readerTextReaderdelimiterstring
Returns
LoadBcf(string)
Loads BCF topics from a BCF 2.1 zip archive (.bcfzip).
public static List<BcfTopic> LoadBcf(string path)Parameters
pathstring
Returns
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
modelsIEnumerable<IfcModel>mergedProjectNamestring
Returns
OffsetCoordinates(IfcVector3)
Offsets all 3D mesh vertices in the model by a translation vector.
public void OffsetCoordinates(IfcVector3 offset)Parameters
offsetIfcVector3
Open(string)
Parses an existing IFC STEP file (.ifc or .ifczip) from disk into a structured model.
public static IfcModel Open(string path)Parameters
pathstring
Returns
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
Returns
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
readerTextReadermodelNamestring?
Returns
Purge()
Purges unreferenced, empty, and duplicate property sets, quantity sets, and empty building storeys.
public IfcPurgeStats Purge()Returns
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
offsetIfcVector3thresholdDistancedouble
Returns
Save(string)
Serializes the IFC model to a file on disk (.ifc or .ifczip).
public void Save(string path)Parameters
pathstring
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
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
writerTextWriterfileNamestring
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
pathstringtopicsIEnumerable<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
streamStreamtopicsIEnumerable<BcfTopic>
SaveGlb(string)
Exports the model to binary glTF 2.0 (.glb) format.
public void SaveGlb(string path)Parameters
pathstring
SaveGlb(Stream)
Exports the model to binary glTF 2.0 (.glb) stream.
public void SaveGlb(Stream stream)Parameters
streamStream
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
pathstringoptionsIfcHtmlViewerOptions?
SaveObj(string)
Exports the model to Wavefront OBJ format (.obj + .mtl).
public void SaveObj(string path)Parameters
pathstring
SaveZip(string)
Serializes the IFC model to a compressed PKZip (.ifczip) archive file on disk.
public void SaveZip(string path)Parameters
pathstring
Select(string)
Selects all elements in the model matching an IfcOpenShell-style selector query string.
public IEnumerable<IfcElement> Select(string selectorQuery)Parameters
selectorQuerystring
Returns
ToStepString(string)
Serializes the IFC model to an ISO 10303-21 STEP physical string.
public string ToStepString(string fileName = "model.ifc")Parameters
fileNamestring
Returns
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
startElementIfcElement
Returns
Validate()
Validates the model against buildingSMART MVD and geometric integrity rules.
public IfcValidationResult Validate()Returns
ValidateIds(string)
Validates the model against a buildingSMART Information Delivery Specification (IDS 1.0) XML file.
public IfcIdsValidationReport ValidateIds(string idsPath)Parameters
idsPathstring
Returns
ValidateIds(Stream)
Validates the model against a buildingSMART Information Delivery Specification (IDS 1.0) XML stream.
public IfcIdsValidationReport ValidateIds(Stream idsStream)Parameters
idsStreamStream
Returns
ValidateIds(XDocument)
Validates the model against a loaded buildingSMART IDS System.Xml.Linq.XDocument.
public IfcIdsValidationReport ValidateIds(XDocument idsDoc)Parameters
idsDocXDocument