Skip to content

Changing an element's spatial container causes an error #7801

@balrobs

Description

@balrobs

Bug Description

  1. Open file Problem.ifc.txt
  2. Select Wall
  3. Navigate to Object Information Tab
  4. Change the Spatial Container of the Wall to IfcBuildingStorey/OG_02

Attachments

I see this error:

os: Windows
os_version: 10.0.19045
python_version: 3.11.11
architecture: ('64bit', 'WindowsPE')
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
blender_version: 4.5.0
bonsai_version: 0.8.5-alpha260315
bonsai_commit_hash: 1999d93
bonsai_commit_date: 2026-03-16T07:30:49+11:00
last_actions: 
# operator: BIM_OT_assign_container
# ifcopenshell.api: spatial.assign_container
>>> {"products": [{"cast_type": "entity_instance", "value": 18331, "Name": "Wall"}], "relating_structure": {"cast_type": "entity_instance", "value": 25311, "Name": "OG_02"}}
# ifcopenshell.api: aggregate.unassign_object
>>> {"products": "[]"}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 25183, "Name": null}}
# ifcopenshell.api: owner.create_owner_history
>>> {}
# ifcopenshell.api: geometry.edit_object_placement
>>> {"product": {"cast_type": "entity_instance", "value": 18331, "Name": "Wall"}, "matrix": {"cast_type": "ndarray", "value": [[1.57324599048209e-13, 1.0, 0.0, 0.862274935870782], [-1.0, 1.57324599048209e-13, 0.0, -6.80189971535034], [0.0, 0.0, 1.0, 2.92], [0.0, 0.0, 0.0, 1.0]]}, "is_si": "False"}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 18331, "Name": "Wall"}}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 18529, "Name": "Fenster"}}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 18748, "Name": "Fenster"}}
# operator: BIM_OT_save_project
# operator: BIM_OT_save_project
# operator: BIM_OT_assign_container
# ifcopenshell.api: spatial.assign_container
>>> {"products": [{"cast_type": "entity_instance", "value": 18331, "Name": "Wall"}], "relating_structure": {"cast_type": "entity_instance", "value": 25311, "Name": "OG_02"}}
# ifcopenshell.api: aggregate.unassign_object
>>> {"products": "[]"}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 25183, "Name": null}}
# ifcopenshell.api: owner.create_owner_history
>>> {}
# ifcopenshell.api: geometry.edit_object_placement
>>> {"product": {"cast_type": "entity_instance", "value": 18331, "Name": "Wall"}, "matrix": {"cast_type": "ndarray", "value": [[1.57324599048209e-13, 1.0, 0.0, 0.862274935870782], [-1.0, 1.57324599048209e-13, 0.0, -6.80189971535034], [0.0, 0.0, 1.0, 2.92], [0.0, 0.0, 0.0, 1.0]]}, "is_si": "False"}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 18331, "Name": "Wall"}}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 18529, "Name": "Fenster"}}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 18748, "Name": "Fenster"}}
last_error: Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.5\extensions\.local\lib\python3.11\site-packages\bonsai\bim\ifc.py", line 528, in execute_ifc_operator
    result = getattr(operator, "_execute")(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.5\extensions\.local\lib\python3.11\site-packages\bonsai\bim\module\spatial\operator.py", line 174, in _execute
    core.assign_container(
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.5\extensions\.local\lib\python3.11\site-packages\bonsai\core\spatial.py", line 70, in assign_container
    collector.assign(ifc.get_object(element))
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.5\extensions\.local\lib\python3.11\site-packages\bonsai\tool\collector.py", line 32, in assign
    for users_collection in obj.users_collection:
                            ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'users_collection'

blend_file_path: Not saved
blend_file_dirty: N/A
ifc_file_path: C:/Users/user/Desktop/PROBLEM/Problem_test.ifc
ifc_is_dirty: True
ifc: Problem_test.ifc
schema: IFC4
preprocessor_version: IfcOpenShell 0.8.5-alpha260315
originating_system: Bonsai 0.8.5-alpha260315-1999d93

I'm using Blender 4.5.0
The file was originally created with Allplan and then reduced to only the problematic elements.

Debug and Error Output


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions