When PredefinedType is not found in the related enum reassign_class is considering it USERDEFINED and trying to set .ObjectType. The problem was it was doing for type classes also, when it should have set .ElementType instead.
Why it crashed BlenderBIM - in IfcClassData.data["has_entity"] we store currently active IFC entity which is recreated during `ifcopenshell.util.schema.reassign_class` making old entity invalid. Since `root.reassign_class` was failing in the process, related BBIM operator was failing too, IfcClassData wasn't updated and removed entity was accessed from UI leading to crash.
- error in settings poll message for bim.assign_selected_as_product
- test that drawing.assign_product won't create new assignments for the same product
Also:
- fixed bug with bim.mep_connect_elements not considering actual blender blender object's position
- moved syncing ifc position with blender object position to tools (sync_object_ifc_position)
- fixed a bug in adding a bend that occured if either any of the start/end points of the start/end segments matched - in that case one of the segments end up not connected to the bend
In case if some element (not another aggregate) was aggregated by IfcProject directly, importing IFC was resulting in error below since the project's collection was never added to `self.collections`.
Traceback:
```
File "\scripts\addons\blenderbim\bim\module\project\operator.py", line 732, in execute
ifc_importer.execute()
File "\scripts\addons\blenderbim\bim\import_ifc.py", line 292, in execute
self.place_objects_in_collections()
File "\scripts\addons\blenderbim\bim\import_ifc.py", line 1668, in place_objects_in_collections
self.place_object_in_collection(self.file.by_id(ifc_definition_id), obj)
File "\scripts\addons\blenderbim\bim\import_ifc.py", line 1672, in place_object_in_collection
self.place_object_in_decomposition_collection(element, obj)
File "\scripts\addons\blenderbim\bim\import_ifc.py", line 1689, in place_object_in_decomposition_collection
return self.collections[aggregate.GlobalId].objects.link(obj)
KeyError: '2bKVb8E7L6e89EQYJUk8BM'
```
Noticed the issue adding IfcFurnitureType in IFC2x3
```
Traceback (most recent call last):
File "\Blender\4.0\scripts\addons\blenderbim\bim\module\model\workspace.py", line 71, in draw_settings
BimToolUI.draw(context, layout, ifc_element_type="all")
File "\Blender\4.0\scripts\addons\blenderbim\bim\module\model\workspace.py", line 230, in draw
AuthoringData.load(ifc_element_type)
File "\Blender\4.0\scripts\addons\blenderbim\bim\module\model\data.py", line 56, in load
cls.data["predefined_type"] = cls.predefined_type()
File "\Blender\4.0\scripts\addons\blenderbim\bim\module\model\data.py", line 258, in predefined_type
predefined_type = relating_type.PredefinedType
File "\Blender\4.0\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\entity_instance.py", line 191, in __getattr__
raise AttributeError(
AttributeError: entity instance of type 'IFC2X3.IfcFurnitureType' has no attribute 'PredefinedType'
```
It was providing project units to `geometry.add_slab_representation` resulting and then they were converted to project units once again during `geometry.add_slab_representation`.
data.py doesn't update on every undo, so passed blender objects got invalidated on undo resulting in errors. changed blender objects to blender object names