mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
6080409c63
Four classification operators (AddManualClassificationReference, RemoveClassificationReference, AddClassificationReference, AddClassificationReferenceFromBSDD) ignored their own obj StringProperty in the obj_type == "Object" branch and used context.selected_objects / context.active_object instead. But bim.assign_class runs first and clears/replaces the selection (it recreates the object for IfcElementType targets), so active_object is None by the time these operators run - which is why the BDD scenarios pass obj='IfcWallType/Cube' explicitly. The operators just never read it, so they crashed on context.active_object.name being None. Apply the same precedence AssignClass itself uses: explicit self.obj first, then selected objects, then a guarded active_object, else empty (which already no-ops via the `if products:` guard). Fixes the crash and makes the operators honor the passed argument. Verified in headless Blender: the 5 classification BDD scenarios (add/enable-editing/disable-editing/remove/edit classification reference) go from 5 failed to passing (6 passed incl. sibling). This change was made with the assistance of an AI tool. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>