Two new UX features in the IFC Patch panel, both backed by helpers on bonsai.tool.Patch. Lossy-downgrade confirmation popup. When the user picks the Migrate recipe with a target schema older than the source's (IFC4 -> IFC2X3, IFC4X3 -> IFC2X3), ExecuteIfcPatch.invoke shows a properties dialog listing what's preserved vs lost: IfcIndexedPolyCurve flattened with arcs approximated, IfcPolygonalFaceSet / IfcTriangulatedFaceSet converted to IfcFacetedBrep, IFC4-only IfcElement subclasses (IfcLamp, IfcPipeSegment, IfcGeographicElement, ...) demoted to IfcBuildingElementProxy with the original class + PredefinedType encoded into ObjectType, and PredefinedType enum values absent from IFC2X3 dropped. The user explicitly approves before the recipe runs. The popup is gated on tool.Patch.migration_is_lossy_downgrade() which resolves the source schema via header-only parsing (tool.Patch._patch_source_schema reads the first ~2KB and matches a FILE_SCHEMA regex, then normalises via ifcopenshell.util.schema. get_fallback_schema). Avoids a full ifcopenshell.open() on every Execute click — multi-second saving on large files. The target schema is looked up by argument name rather than position so it survives recipe-parameter reordering. Per-recipe preset menu. New BIM_MT_ifc_patch_presets + AddIfcPatchPreset wire Blender's standard preset system into the panel. Each recipe gets its own preset subdirectory (bonsai/ifc_patch/<RecipeName>/), so a preset saved for ExtractElements does not pollute the Migrate preset list. The preset operator uses Attribute.get_value_name() (single source of truth for data_type -> storage-field mapping) to build the preset_values list dynamically per recipe. The recipe-change callback resets BIM_MT_ifc_patch_presets.bl_label to the canonical title — Blender's script.execute_preset mutates the menu's bl_label to the loaded preset's name as a "currently-selected" indicator, and without an explicit reset the previous recipe's preset name would falsely advertise itself in the new recipe's menu. tool.Patch gains get_preset_subdir, migration_is_lossy_downgrade, _patch_source_schema as cross-cutting helpers. _SCHEMA_AGE module constant provides the ordering used by the downgrade-detection predicate. Test coverage: 12 bim-lane tests under test/bim/module/patch/. The truth table for migration_is_lossy_downgrade covers IFC4/IFC4X3 source x downgrade/upgrade/same-schema target x Migrate/non-Migrate recipe. The schema-sniffing tests write a real IFC4X3_ADD2 file to disk and assert the helper resolves it to IFC4X3 (regression for the original startswith iteration-order bug). An end-to-end test drives bpy.ops.bim.execute_ifc_patch with an in-memory IfcLamp source and verifies the on-disk IFC2X3 file contains a single IfcBuildingElementProxy with ObjectType "IfcLamp/COMPACTFLUORESCENT" and the original GlobalId preserved. Generated with the assistance of an AI coding tool.
IfcOpenShell
IfcOpenShell is an open source (LGPL) software library for working with Industry Foundation Classes (IFC). Complete parsing support is provided for IFC2x3 TC1, IFC4 Add2 TC1, IFC4x1, IFC4x2, and IFC4x3 Add2. Extensive geometric support is implemented for the IFC releases IFC2x3 TC1 and IFC4 Add2 TC1. Extending with support for arbitrary IFC schemas is possible at compile-time when using C++ and at run-time when using Python.
In addition to a C++ and Python API, IfcOpenShell comes with an ecosystem of tools, notably including IfcConvert (an application to convert IFC models to other formats), Bonsai (an add-on to Blender providing a graphical IFC authoring platform), and many other libraries, CLI apps, and more. Support is also provided for auxiliary standards such as BCF and IDS.
For more information, see:
Development is sponsored through your generous donations!
Contents
| Name | Description | License | Service |
|---|---|---|---|
| bcf | Library to read and write BCF-XML and query OpenCDE BCF-API modules | LGPL-3.0-or-later | |
| bonsai | Add-on to Blender providing a graphical native IFC authoring platform | GPL-3.0-or-later | |
| bsdd | Library to query the bSDD API | LGPL-3.0-or-later | |
| ifc2ca | Utility to convert IFC structural analysis models to Code_Aster | LGPL-3.0-or-later | |
| ifc4d | Convert to and from IFC and project management software | LGPL-3.0-or-later | |
| ifc5d | Report and optimise cost information from IFC | LGPL-3.0-or-later | |
| ifcbimtester | Wrapper for Gherkin based unit testing for IFC models | LGPL-3.0-or-later | |
| ifcblender | Historic Blender IFC import add-on | LGPL-3.0-or-later* | |
| ifccityjson | Convert CityJSON to IFC | LGPL-3.0-or-later | |
| ifcclash | Clash detection library and CLI app | LGPL-3.0-or-later | |
| ifcconvert | CLI app to convert IFC to many other formats | LGPL-3.0-or-later* | |
| ifccsv | Library and CLI app to export and import schedules from IFC | LGPL-3.0-or-later | |
| ifcdiff | Compare changes between IFC models | LGPL-3.0-or-later | |
| ifcedit | CLI wrapper for ifcopenshell.api IFC model mutation functions | LGPL-3.0-or-later | |
| ifcfm | Extract IFC data for FM handover requirements | LGPL-3.0-or-later | |
| ifcmax | Historic extension for IFC support in 3DS Max | LGPL-3.0-or-later* | |
| ifcmcp | MCP server for querying and editing IFC building models | LGPL-3.0-or-later | |
| ifcopenshell-python | Python library for IFC manipulation | LGPL-3.0-or-later* | |
| ifcpatch | Utility to run pre-packaged scripts to manipulate IFCs | LGPL-3.0-or-later | |
| ifcquery | CLI tool for querying and inspecting IFC building models | LGPL-3.0-or-later | |
| ifcsverchok | Blender Add-on for visual node programming with IFC | GPL-3.0-or-later | |
| ifctester | Library, CLI and webapp for IDS model auditing | LGPL-3.0-or-later |
The IfcOpenShell C++ codebase is split into multiple interal libraries:
| Name | Description | License |
|---|---|---|
| ifcgeom | Internal library for IfcOpenShell | LGPL-3.0-or-later* |
| ifcgeom_schema_agnostic | Internal library for IfcOpenShell | LGPL-3.0-or-later* |
| ifcgeomserver | Internal library for IfcOpenShell | LGPL-3.0-or-later* |
| ifcjni | Internal library for IfcOpenShell | LGPL-3.0-or-later* |
| ifcparse | Internal library for IfcOpenShell | LGPL-3.0-or-later* |
| ifcwrap | Internal library for IfcOpenShell | LGPL-3.0-or-later* |
| qtviewer | Internal library for IfcOpenShell | LGPL-3.0-or-later* |
| serializers | Internal library for IfcOpenShell | LGPL-3.0-or-later* |