bim.override_mesh_separate - fix bug separating elements (7bc4b51)

`obj` variable was used but never passed to `separate_element`

```
Error: Python: Traceback (most recent call last):
  File "\bonsai\bim\ifc.py", line 458, in execute_ifc_operator
    result = getattr(operator, "_execute")(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\bonsai\bim\module\geometry\operator.py", line 105, in _execute
    self.separate_element(element)
  File "\bonsai\bim\module\geometry\operator.py", line 175, in separate_element
    new_objs = [obj]
                ^^^
NameError: name 'obj' is not defined
```
This commit is contained in:
Andrej730
2025-04-22 18:31:10 +05:00
parent 671c887201
commit 69481c2d63
@@ -91,7 +91,7 @@ class OverrideMeshSeparate(bpy.types.Operator, tool.Ifc.Operator):
if tool.Geometry.is_representation_item(obj):
self.separate_item(context, obj)
elif element := tool.Ifc.get_entity(obj):
self.separate_element(element)
self.separate_element(context, element, obj)
def separate_item(self, context: bpy.types.Context, obj: bpy.types.Object) -> None:
item = tool.Geometry.get_active_representation(obj)
@@ -141,7 +141,9 @@ class OverrideMeshSeparate(bpy.types.Operator, tool.Ifc.Operator):
tool.Ifc.link(item, obj)
props.add_item_object(obj, item)
def separate_element(self, element: ifcopenshell.entity_instance) -> None:
def separate_element(
self, context: bpy.types.Context, element: ifcopenshell.entity_instance, obj: bpy.types.Object
) -> None:
# You cannot separate meshes if the representation is mapped.
relating_type = tool.Root.get_element_type(element)
if relating_type and tool.Root.does_type_have_representations(relating_type):