Table of Contents

Class IfcPatch

Namespace
IfcIO.Patch
Assembly
IfcIO.dll

Provides powerful model repair, cleanup, coordinate shifting, extraction, and merging recipes for Industry Foundation Classes (IFC) models, conforming to the IfcOpenShell ifcpatch recipe architecture.

public static class IfcPatch

Inheritance

Inherited Members

Methods

Extract(IfcModel, string, string?)

Extracts a subset of elements matching an IfcIO.Query.IfcSelector query string into a new, self-contained IFC model.

public static IfcModel Extract(IfcModel source, string query, string? newProjectName = null)

Parameters

source IfcModel
query string
newProjectName string?

Returns

IfcModel

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

Extracts a subset of elements matching a predicate function into a new, self-contained IFC model. Preserves spatial storeys, project units, materials, and property sets of extracted elements.

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

Parameters

source IfcModel
predicate Func<IfcElement, bool>
newProjectName string?

Returns

IfcModel

Merge(IEnumerable<IfcModel>, string)

Merges multiple IFC models into a single coordinated model, reconciling storeys by name/elevation and assigning unique, non-colliding entity IDs.

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

Parameters

models IEnumerable<IfcModel>
mergedProjectName string

Returns

IfcModel

MigrateSchema(IfcModel, IfcSchema)

Migrates an IFC model to a target schema (e.g. upgrades IFC2X3 to IFC4), enabling modern tessellated geometries and updating schema version identifiers.

public static void MigrateSchema(IfcModel model, IfcSchema targetSchema)

Parameters

model IfcModel
targetSchema IfcSchema

OffsetCoordinates(IfcModel, IfcVector3)

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

public static void OffsetCoordinates(IfcModel model, IfcVector3 offset)

Parameters

model IfcModel
offset IfcVector3

Purge(IfcModel)

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

public static IfcPurgeStats Purge(IfcModel model)

Parameters

model IfcModel

Returns

IfcPurgeStats

ResetCoordinates(IfcModel, out IfcVector3, double)

Detects large absolute coordinate offsets (e.g. Revit/Civil UTM coordinates exceeding thresholdDistance meters) and shifts model geometry back to the local origin (0, 0, 0) to eliminate 32-bit/64-bit floating point precision jitter.

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

Parameters

model IfcModel

The IFC model to check and recenter.

offset IfcVector3

Output parameter receiving the negative offset vector that was applied.

thresholdDistance double

Distance from origin above which coordinates are recentered (default: 10,000 meters).

Returns

bool

True if coordinates were recentered; otherwise false.

ScaleModel(IfcModel, double)

Uniformly scales all 3D mesh vertices across all elements in the model by a specified scaling factor (e.g. 0.001 to convert mm to m).

public static void ScaleModel(IfcModel model, double scaleFactor)

Parameters

model IfcModel
scaleFactor double

SetProperties(IfcModel, string, string, IReadOnlyDictionary<string, string>)

Sets or updates multiple property values across all elements matching an IfcIO.Query.IfcSelector query string.

public static int SetProperties(IfcModel model, string selectorQuery, string psetName, IReadOnlyDictionary<string, string> properties)

Parameters

model IfcModel
selectorQuery string
psetName string
properties IReadOnlyDictionary<string, string>

Returns

int

The number of elements updated.

SetProperties(IfcModel, string, string, string, string)

Sets or updates a property value across all elements matching an IfcIO.Query.IfcSelector query string.

public static int SetProperties(IfcModel model, string selectorQuery, string psetName, string propName, string value)

Parameters

model IfcModel
selectorQuery string
psetName string
propName string
value string

Returns

int

The number of elements updated.