mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix #5526. Fix bug where reloading a representation used by filtered / unloaded elements would fail.
This commit is contained in:
@@ -1067,8 +1067,11 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
|
||||
# Filter out unique meshes to avoid
|
||||
# reloading the same representation multiple times.
|
||||
meshes_to_objects: dict[bpy.types.Mesh, bpy.types.Object]
|
||||
meshes_to_objects = {(obj := tool.Ifc.get_object(element)).data: obj for element in elements}
|
||||
meshes_to_objects: dict[bpy.types.Mesh, bpy.types.Object] = {}
|
||||
for element in elements:
|
||||
# Some objects may not exist if they are filtered out, or are unloaded (e.g. openings)
|
||||
if (obj := tool.Ifc.get_object(element)) and obj.data:
|
||||
meshes_to_objects[obj.data] = obj
|
||||
|
||||
for obj in meshes_to_objects.values():
|
||||
cls._reload_representation(obj)
|
||||
|
||||
Reference in New Issue
Block a user