mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Fix wall edit lifecycle + drain wall_offset_gizmos cache on load
Bundled bug fixes + the forward-compat AST guard that prevents the
underlying class of bug from coming back.
* bim/module/model/wall.py: FinishEditingWall._execute early-returns
CANCELLED when props.is_editing is False. Without this guard, a
failed enable (e.g. on a wall without IfcMaterialLayerSetUsage)
leaves is_editing False but a press on finish still walked the
sub-ops below, which dereferenced layer-set-dependent state and
crashed.
* tool/model.py: Model.offset_wall now guards against
ifcopenshell.util.element.get_material returning None before
calling .is_a("IfcMaterialLayerSetUsage"). Fixes the pre-existing
test/bim/module/model/test_wall_header_refresh.py crash that has
been the only failing test in the wall lane since this branch
started.
* bim/handler.py: _apply_save_file_invariants drains
wall_offset_gizmos.clear_caches() on load_post. The module-scope
GenerationKeyedCache instance survives the .blend reload; without
the drain the cache may serve entries whose bpy_struct references
point into the freed bpy.data of the previous file.
* test/bim/test_handler_forward_compat.py: AST-walk test that
enumerates every bim/module/model/*.py source declaring both a
module-scope GenerationKeyedCache assignment AND a top-level
clear_caches function, and asserts each module appears as a
<module>.clear_caches() call in _apply_save_file_invariants. Pins
the contract: any future module-scope geom cache that exposes
clear_caches must wire into the load_post drain.
* test/bim/feature/model.feature + test/bim/test_feature.py: wall
edit-lifecycle scenarios switch from "add cube + assign as
IfcWallType" to "load the demo construction library + add an
occurrence of the WAL100 wall type", so the parametric edit runs
against a real LAYER2 wall with IfcMaterialLayerSetUsage rather
than a vanilla-mesh promotion that lacks one. The demo-library
step also picks the schema-matching library file (IFC2X3 /
IFC4 / IFC4X3) so the appended types remain valid across schemas.
Door saved-height assertion updates from 2.5 → 2500 to reflect
that BBIM_Door pset stores project units (METRIC_MM in the
empty-project fixture).
Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -1764,7 +1764,17 @@ def i_load_the_ifc_test_file(filepath):
|
||||
@given("I load the demo construction library")
|
||||
@when("I load the demo construction library")
|
||||
def i_add_a_construction_library():
|
||||
lib_path = "./bonsai/bim/data/libraries/IFC4 Demo Library.ifc"
|
||||
# Pick the library file whose schema matches the current project so the
|
||||
# appended types are valid (IFC2X3-vs-IFC4 entity attributes differ).
|
||||
schema_to_library = {
|
||||
"IFC2X3": "IFC2X3 Demo Library.ifc",
|
||||
"IFC4": "IFC4 Demo Library.ifc",
|
||||
"IFC4X3": "IFC4X3 Demo Library.ifc",
|
||||
"IFC4X3_ADD2": "IFC4X3 Demo Library.ifc",
|
||||
}
|
||||
schema = tool.Ifc.get().schema
|
||||
lib_name = schema_to_library.get(schema, "IFC4 Demo Library.ifc")
|
||||
lib_path = f"./bonsai/bim/data/libraries/{lib_name}"
|
||||
bpy.ops.bim.select_library_file(filepath=lib_path, append_all=True)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user