IfcIO.Cli
0.8.0
See the version list below for details.
dotnet tool install --global IfcIO.Cli --version 0.8.0
dotnet new tool-manifest
dotnet tool install --local IfcIO.Cli --version 0.8.0
#tool dotnet:?package=IfcIO.Cli&version=0.8.0
nuke :add-package IfcIO.Cli --version 0.8.0
<p align="center"> <img src="docs/images/ifcio-banner.png" alt="IfcIO" width="640"> </p>
IfcIO
IfcIO is a fast, 100% managed .NET library for building, reading, and exporting Industry Foundation Classes (.ifc) files compliant with IFC2x3 Coordination View V2.0 and IFC4 Design Transfer / Reference View without third-party dependencies or native code.
Built clean-room under the IOExtend organization as the shared open-standards IFC foundation for AEC/BIM projects (including NwcIO and RvtIO).
Features
- Full High-Level Model Ingestion (
IfcModel.Open):- Reconstructs complete spatial hierarchy (Project, Site, Building, Storeys), elements, properties, materials, and 3D meshes from any
.ifcor.ifczipfile. - Multi-line STEP statement accumulation and quote-aware tokenization in
StepReader.
- Reconstructs complete spatial hierarchy (Project, Site, Building, Storeys), elements, properties, materials, and 3D meshes from any
- IFC4 Modern Tessellation (
IfcTriangulatedFaceSet):- Encodes geometry using compact
IfcTriangulatedFaceSetandIfcCartesianPointList3Dunder representation type'Tessellation'for IFC4 exports (>60% smaller files).
- Encodes geometry using compact
- Direct 3D Exporters (glTF 2.0 & Wavefront OBJ):
- Instant conversion of any IFC model to binary glTF 2.0 (
.glb) with PBR metallic-roughness materials and vertex normals, or Wavefront OBJ (.obj+.mtl).
- Instant conversion of any IFC model to binary glTF 2.0 (
- PKZip Compressed IFC (
.ifczip):- Built-in transparent compression and decompression for standard
.ifcziparchives with zero native dependencies.
- Built-in transparent compression and decompression for standard
- Cross-Platform CLI Tool (
ifcio):- Global .NET CLI tool (
IfcIO.Clion NuGet) providinginfo,export,pack,unpack, andvalidatecommands.
- Global .NET CLI tool (
- buildingSMART 22-Character GlobalId (
IfcGuid):- Standard base64-like buildingSMART encoding (
0-9, A-Z, a-z, _, $). - Bidirectional conversion between 128-bit
.NET Guidand 22-character IFC GlobalId. - Deterministic GUID generation via SHA-256 namespace hashing for elements and models.
- Standard base64-like buildingSMART encoding (
- 3D Faceted BRep Geometry (
IfcFacetedBrep):- Encodes 3D meshes as
IfcFacetedBrep→IfcClosedShell→IfcFace→IfcFaceOuterBound→IfcPolyLoop→IfcCartesianPoint. - Vertex deduplication via shared per-mesh
IfcCartesianPointcoordinates.
- Encodes 3D meshes as
- BIM Spatial Containment:
- Standard spatial aggregation:
IfcProject→IfcSite→IfcBuilding→IfcBuildingStoreyviaIfcRelAggregates. - Elements assigned to storeys via
IfcRelContainedInSpatialStructure.
- Standard spatial aggregation:
- Semantic Classification & Properties:
- Automatic classification for standard BIM entities:
IfcWall,IfcSlab,IfcColumn,IfcBeam,IfcReinforcingBar,IfcWindow,IfcDoor,IfcFooting,IfcStair,IfcRailing,IfcRoof,IfcPipeSegment,IfcDuctSegment,IfcBuildingElementProxy. - Property sets (
IfcPropertySet,IfcPropertySingleValue) with typed values (IfcText,IfcInteger,IfcReal,IfcBoolean). - Reusable Type Products (
IfcTypeProduct) linked viaIfcRelDefinesByType. - Surface styles and materials (
IfcSurfaceStyle,IfcSurfaceStyleShading,IfcColourRgb,IfcStyledItem).
- Automatic classification for standard BIM entities:
- Constructive Solid Geometry (CSG) & Boolean Clipping (
IfcBooleanResult):- Full parametric plane clipping (
IFCBOOLEANCLIPPINGRESULT,IFCHALFSPACESOLID,IFCPLANE) with exact 3D polygon mesh evaluation (ToMesh()).
- Full parametric plane clipping (
- Standard Structural Steel Profiles (
IfcProfileDef):- Parameterized cross-sections for structural framing:
IfcIShapeProfileDef(I-beam/H-beam),IfcLShapeProfileDef(angle), andIfcUShapeProfileDef(channel) with boundary points and solid extrusion.
- Parameterized cross-sections for structural framing:
- Topological MEP Ports & Flow Networks (
IfcDistributionPort):- Strongly-typed ports with
IfcFlowDirection,IFCRELCONNECTSPORTTOELEMENT,IFCRELCONNECTSPORTS, and BFS network tracing (TraceConnectedElements).
- Strongly-typed ports with
- Multi-layer Material Systems & Profile Sets (
IfcIO.Model):- Composite layer assemblies (
IfcMaterialLayer,IfcMaterialLayerSet,IfcMaterialLayerSetUsage) and structural profile sets (IfcMaterialProfile,IfcMaterialProfileSet,IfcMaterialProfileSetUsage) linked viaIFCRELASSOCIATESMATERIAL.
- Composite layer assemblies (
- Architectural & MEP Spaces (
IfcSpace) & BCF 2.1 Coordination:- High-level spaces, space boundaries (
IfcSpaceBoundary), MEP systems (IfcSystem), and full BIM Collaboration Format 2.1 zip read/write (IfcIO.Bcf).
- High-level spaces, space boundaries (
- IfcOpenShell-Style Query Selector Engine (
IfcSelector):- Declarative filtering syntax for entities, spatial storeys, property/attribute constraints (
[LoadBearing=TRUE],[FireRating>=60],[Name*='Conc']), and union lists (IfcWall, IfcColumn).
- Declarative filtering syntax for entities, spatial storeys, property/attribute constraints (
- Model Repair, Cleanup & Recipes (
IfcPatch):Purge: removes empty/duplicate property sets and empty storeys.ResetCoordinates: detects large UTM coordinates (>10,000m) and centers model geometry at origin (0, 0, 0) to prevent precision jitter.Extract: extracts element subsets into self-contained models.Merge: combines multiple models reconciling storeys and re-indexing IDs.
- buildingSMART IDS 1.0 Compliance Engine (
IfcIdsValidator):- Audits models against Information Delivery Specification (
.ids) XML files and exports violations to BCF 2.1 archives (.bcfzip).
- Audits models against Information Delivery Specification (
- Tabular Property CSV Roundtrip Bridge (
IfcCsvBridge):- Fast CSV spreadsheet export and bulk property import conforming to
ifccsv.
- Fast CSV spreadsheet export and bulk property import conforming to
- 3D Geometric Clash Detection (
IfcClashDetector):- Pure managed collision engine executing broad-phase bounding box pruning and narrow-phase Möller triangle-to-triangle intersection testing for cross-model (Structure vs MEP) and intra-model interference analysis conforming to
ifcclash. Direct export to structured JSON and buildingSMART BCF 2.1 zip archives.
- Pure managed collision engine executing broad-phase bounding box pruning and narrow-phase Möller triangle-to-triangle intersection testing for cross-model (Structure vs MEP) and intra-model interference analysis conforming to
- Semantic & Geometric Revision Comparison (
IfcDiffEngine):- Full revision comparison between two IFC models detecting added, deleted, and modified elements (3D geometry displacement, property set deltas, quantity variations, and storey re-assignments) conforming to
ifcdiff. Direct export to JSON and BCF 2.1 archives.
- Full revision comparison between two IFC models detecting added, deleted, and modified elements (3D geometry displacement, property set deltas, quantity variations, and storey re-assignments) conforming to
- Standalone 3D WebGL HTML Viewer (
IfcHtmlViewerExporter):- Export any IFC model to an interactive, self-contained single-file 3D HTML viewer (
.html) with zero external scripts, CDNs, or server dependencies. Includes orbit camera controls, live multi-axis section clipping planes (Cut X, Cut Y, Cut Z), spatial tree navigation, and element property inspector.
- Export any IFC model to an interactive, self-contained single-file 3D HTML viewer (
- Zero Dependencies: Pure C# targeting
.NET 8and.NET 10.
Install
Add the package to your .NET project:
dotnet add package IfcIO
Library Usage (C#)
Creating and Exporting an IFC Model
using IfcIO;
using IfcIO.Geometry;
using IfcIO.Model;
using IfcIO.Schema;
// Create model (IFC2X3 or IFC4)
var model = IfcModel.Create("Residential Building Block 1", IfcSchema.Ifc2x3);
model.Author = "mahach666";
model.Organization = "IOExtend";
// Add storeys
var floor1 = model.AddStorey("Level 1", elevation: 0.0);
var floor2 = model.AddStorey("Level 2", elevation: 3300.0);
// Materials & colors
var concrete = new IfcMaterial { Name = "Concrete B25", R = 0.72, G = 0.72, B = 0.75 };
// Add 3D polygon mesh element
var vertices = new IfcVector3[]
{
new(0, 0, 0),
new(2000, 0, 0),
new(2000, 200, 0),
new(0, 200, 0),
new(0, 0, 2800),
new(2000, 0, 2800),
new(2000, 200, 2800),
new(0, 200, 2800)
};
var indices = new int[]
{
0, 2, 1, 0, 3, 2, // bottom
4, 5, 6, 4, 6, 7, // top
0, 1, 5, 0, 5, 4, // front
1, 2, 6, 1, 6, 5, // right
2, 3, 7, 2, 7, 6, // back
3, 0, 4, 3, 4, 7 // left
};
var wall = model.AddMesh("Стена монолитная 200", vertices, indices, concrete, floor1);
// Add parametric swept solids (walls, columns)
var paramWall = model.AddExtrudedRectangle(
name: "ExtrudedWall",
xDim: 300.0,
yDim: 6000.0,
depth: 3000.0,
material: concrete,
storey: floor1);
// Add opening and window filling
var openingSolid = new IfcExtrudedAreaSolid(
new IfcRectangleProfileDef(300.0, 1200.0),
depth: 1500.0,
position: new IfcVector3(0, 2000, 900));
var window = new IfcElement
{
Id = 101,
Name = "Window1",
IfcType = "IFCWINDOW",
Solid = new IfcExtrudedAreaSolid(new IfcRectangleProfileDef(100.0, 1180.0), depth: 1480.0),
};
model.AddOpening(paramWall, "WallOpening", solid: openingSolid, filling: window);
// Attach standard buildingSMART Property Sets
paramWall.PropertySets.Add(StandardPsets.WallCommon(
reference: "W-01",
loadBearing: true,
isExternal: true,
fireRating: "REI 120",
thermalTransmittance: 0.28));
// Add parametric revolved solids (curved pipes, fittings, flanged connections)
var pipeProfile = new IfcCircleProfileDef(radius: 100.0, position: new IfcVector3(500, 0, 0));
model.AddRevolvedSolid("90DegElbow", pipeProfile, angle: Math.PI * 0.5, storey: floor1, ifcType: "IFCPIPEFITTING");
// Automatic buildingSMART Quantity Takeoff (QTO) calculation directly from 3D geometry
model.CalculateAllBaseQuantities();
// Attach explicit custom quantity sets
paramWall.QuantitySets.Add(StandardQtoSets.WallBaseQuantities(
length: 6000.0,
width: 300.0,
height: 3000.0,
grossVolume: 5.4,
netVolume: 4.8));
// Add architectural space (room) with space boundary
var office = model.AddSpace(
name: "Office 101",
spaceNumber: "101",
longName: "Open Plan Office",
grossFloorArea: 45.0,
height: 3.0,
storey: floor1);
office.Boundaries.Add(new IfcSpaceBoundary
{
Name = "Wall Boundary",
PhysicalOrVirtual = IfcPhysicalOrVirtual.Physical,
InternalOrExternal = IfcInternalOrExternal.Internal,
RelatedBuildingElement = paramWall,
});
// Group elements into HVAC system
var hvac = model.AddSystem("Supply Air AHU-01", isDistribution: true);
hvac.Elements.Add(paramWall);
// Validate model and export detected issues as buildingSMART BCF 2.1 archive
model.ExportValidationBcf("Building_Issues.bcfzip");
// Validate model integrity
var validation = model.Validate();
if (!validation.IsValid)
{
foreach (var issue in validation.Issues)
Console.WriteLine($"[{issue.Severity}] {issue.RuleId}: {issue.Message}");
}
// Save to multiple formats with one call:
model.Save("Building.ifc"); // Standard STEP file (IFCEXTRUDEDAREASOLID, IFCRELVOIDSELEMENT)
model.SaveZip("Building.ifczip"); // Compressed PKZip archive
model.SaveGlb("Building.glb"); // Binary glTF 2.0 with PBR materials
model.SaveObj("Building.obj"); // Wavefront OBJ + MTL
Loading and Inspecting an IFC Model
using IfcIO;
// Load an existing .ifc or .ifczip model
var model = IfcModel.Open("Building.ifc");
Console.WriteLine($"Project: {model.ProjectName}");
Console.WriteLine($"Schema: {model.Schema}");
Console.WriteLine($"Storeys: {model.Storeys.Count}");
Console.WriteLine($"Elements: {model.AllElements.Count()}");
// Convert directly to glTF 2.0
model.SaveGlb("Building_Converted.glb");
Querying Elements (IfcSelector)
Filter elements using IfcOpenShell-compatible selector syntax:
// Select load-bearing walls on Level 1
var walls = model.Select("IfcWall#Level 1[LoadBearing=TRUE]");
// Select high-fire-rating elements across multiple types
var fireResistant = model.Select("IfcWall, IfcColumn[FireRating>=60]");
// Check if a single element matches a query condition
bool isCandidate = element.Matches("[Name*='Concrete']");
Model Cleanup, Coordinate Shifting & Merging (IfcPatch)
// 1. Purge unreferenced and empty property sets and empty storeys
var purgeReport = model.Purge();
// 2. Center models located at large absolute UTM coordinates (>10,000 m)
if (model.ResetCoordinates(out var offsetVector))
{
Console.WriteLine($"Recentered model to origin (offset applied: {offsetVector})");
}
// 3. Extract a standalone model containing only structural elements
var structureModel = model.Extract("IfcWall, IfcColumn, IfcBeam", "Structural Package");
structureModel.Save("Structure_Only.ifc");
// 4. Merge multiple disciplinary models into a coordinated model
var merged = IfcPatch.Merge([archModel, structModel, mepModel], "Campus Combined");
merged.Save("Campus_Coordinated.ifc");
Information Delivery Specification (IDS 1.0) & BCF Export
// Audit IFC model against buildingSMART IDS 1.0 specification
var idsReport = model.ValidateIds("Requirements.ids");
if (!idsReport.IsCompliant)
{
Console.WriteLine($"Audit failed with {idsReport.Failures.Count} violations.");
// Export non-compliant elements directly to BCF 2.1 for issue tracking
idsReport.SaveBcf("IDS_Compliance_Issues.bcfzip");
}
Tabular CSV Property Schedules (IfcCsvBridge)
// Export elements and custom property sets to CSV spreadsheet
model.ExportCsv("Schedules.csv", ["Pset_WallCommon.FireRating", "LoadBearing", "Material"]);
// Re-import modified properties back into matching elements
var (elementsUpdated, propertiesUpdated) = model.ImportCsv("Schedules_Edited.csv");
model.Save("Building_Updated.ifc");
3D Geometric Clash Detection (IfcClashDetector)
using IfcIO.Clash;
// Run cross-model clash detection between architectural and MEP models
var clashReport = archModel.DetectClashes(mepModel, new IfcClashOptions
{
Tolerance = 0.002, // 2mm penetration tolerance
SelectorA = "IfcWall, IfcColumn, IfcBeam",
SelectorB = "IfcFlowSegment, IfcFlowFitting",
});
Console.WriteLine($"Detected {clashReport.TotalClashesCount} clashes.");
// Save detailed JSON report
clashReport.SaveJson("Clashes.json");
// Export directly to buildingSMART BCF 2.1 zip archive for Revit / Solibri / BIMcollab
clashReport.SaveBcf("Clashes.bcfzip");
Semantic & Geometric Revision Diff (IfcDiffEngine)
using IfcIO.Diff;
// Compare baseline model against revision
var diffReport = baselineModel.Compare(revisionModel, new IfcDiffOptions
{
GeometricTolerance = 0.005, // 5mm displacement threshold
CompareProperties = true,
CompareQuantities = true,
});
Console.WriteLine($"Total Changes: {diffReport.TotalChangesCount}");
Console.WriteLine($" - Added: {diffReport.Added.Count}");
Console.WriteLine($" - Deleted: {diffReport.Deleted.Count}");
Console.WriteLine($" - Modified: {diffReport.Modified.Count}");
// Export diff report to JSON
diffReport.SaveJson("ModelDiff.json");
// Export changes to BCF 2.1 with camera viewpoints framing each modified element
diffReport.SaveBcf("RevisionChanges.bcfzip");
Standalone 3D WebGL HTML Viewer Export
using IfcIO.Exporters;
// Export IFC model to an interactive, zero-dependency 3D HTML viewer
model.SaveHtmlViewer("BuildingModel.html", new IfcHtmlViewerOptions
{
Title = "Residential Complex - Coordination Viewer",
IncludeProperties = true,
IncludeQuantities = true,
IncludeSpatialTree = true,
IncludeSectioning = true,
});
Global CLI Tool (ifcio)
Install the cross-platform command-line tool globally via NuGet:
dotnet tool install --global IfcIO.Cli
CLI Commands
# Inspect model metadata, storeys, spaces, systems, and element distribution
ifcio info Building.ifc --report --spaces --systems
# Query elements matching IfcOpenShell-style selector
ifcio query Building.ifc "IfcWall[LoadBearing=TRUE]"
# Model repair and coordinate recipes (purge, reset UTM coordinates, extract)
ifcio patch Building.ifc -o Cleaned.ifc --purge --reset-coords
# Audit compliance against buildingSMART IDS 1.0 and export BCF issues
ifcio validate-ids Building.ifc Requirements.ids --bcf AuditIssues.bcfzip
# Export tabular CSV property schedules
ifcio export-csv Building.ifc -o Schedules.csv -p "FireRating,LoadBearing"
# Import updated property schedules back into IFC
ifcio import-csv Building.ifc --csv Schedules_Edited.csv -o Building_Updated.ifc
# Convert IFC to binary glTF 2.0 and Wavefront OBJ
ifcio export Building.ifc --glb scene.glb --obj scene.obj
# Compress IFC to .ifczip
ifcio pack Building.ifc -o Building.ifczip
# Extract IFC from .ifczip
ifcio unpack Building.ifczip -o Building.ifc
# Run 3D geometric clash detection between models (or within one model)
ifcio clash Arch.ifc Mep.ifc -o Clashes.json --bcf Clashes.bcfzip --tolerance 0.002
# Compare two IFC model revisions (added, deleted, modified)
ifcio diff Baseline.ifc Revision.ifc -o Changes.json --bcf RevisionChanges.bcfzip
# Export standalone 3D WebGL HTML viewer (.html) with zero dependencies
ifcio view Building.ifc -o BuildingViewer.html
# Validate ISO 10303-21 structure and export BCF 2.1 issues for coordination
ifcio validate Building.ifc --bcf Issues.bcfzip
License and trademarks
IfcIO is licensed under the MIT License. Copyright © 2026 IOExtend.
buildingSMART and IFC are registered trademarks of buildingSMART International Ltd.
IfcIO is an independent implementation of the ISO 10303-21 STEP and buildingSMART specifications. No proprietary code or binaries are included.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.