Skip to content

fix(bonsai): prevent NoneType assignment crash when modifying spatial structures of voided objects (Resolves #7801, Resolves #7861)#7931

Open
dipayansardar73-decode wants to merge 3 commits intoIfcOpenShell:v0.8.0from
dipayansardar73-decode:fix/bonsai-7801-7861-spatial-nonetype
Open

fix(bonsai): prevent NoneType assignment crash when modifying spatial structures of voided objects (Resolves #7801, Resolves #7861)#7931
dipayansardar73-decode wants to merge 3 commits intoIfcOpenShell:v0.8.0from
dipayansardar73-decode:fix/bonsai-7801-7861-spatial-nonetype

Conversation

@dipayansardar73-decode
Copy link
Copy Markdown

Fixes #7801
Fixes #7861

Description

This PR resolves two advanced architectural bugs where modifying the structural hierarchy or relations of an IFCElement (like changing spatial containers or assembling voided geometries) instantly triggered a fatal AttributeError: 'NoneType' object has no attribute 'users_collection'.

The Bug:
Under the hood, assigning IFC instances into relationship hierarchies triggers Bonsai's core collection manager to physically migrate the underlying .blend object representations across the Blender scene layout.
If an element lacks geometrical representation (e.g. is purely symbolic or has been temporarily voided out), ifc.get_object(element) correctly evaluates to None. However, tool.collector.assign lacked a null-check, meaning it attempted to iterate over the absent users_collection arrays, dropping the entire process.

The Fix:
I have added a clean, robust lifecycle null guard (if not obj: return) directly into the Collector.assign() endpoint. If a purely structural IFC element without 3D Blender geometry needs container modification, Bonsai will now seamlessly update the hierarchy data without committing engine suicide while trying to manipulate non-existent geometry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IfcElementAssembly | error if element is voided Changing an element's spatial container causes an error

1 participant