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 IfcPatchInheritance
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
Returns
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
sourceIfcModelpredicateFunc<IfcElement, bool>newProjectNamestring?
Returns
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
modelsIEnumerable<IfcModel>mergedProjectNamestring
Returns
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
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
modelIfcModeloffsetIfcVector3
Purge(IfcModel)
Purges unreferenced, empty, or duplicate property sets, quantity sets, and empty building storeys.
public static IfcPurgeStats Purge(IfcModel model)Parameters
modelIfcModel
Returns
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
modelIfcModel-
The IFC model to check and recenter.
offsetIfcVector3-
Output parameter receiving the negative offset vector that was applied.
thresholdDistancedouble-
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
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
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
Returns
- int
-
The number of elements updated.