mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
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:
@@ -91,7 +91,7 @@ class OverrideMeshSeparate(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
if tool.Geometry.is_representation_item(obj):
|
if tool.Geometry.is_representation_item(obj):
|
||||||
self.separate_item(context, obj)
|
self.separate_item(context, obj)
|
||||||
elif element := tool.Ifc.get_entity(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:
|
def separate_item(self, context: bpy.types.Context, obj: bpy.types.Object) -> None:
|
||||||
item = tool.Geometry.get_active_representation(obj)
|
item = tool.Geometry.get_active_representation(obj)
|
||||||
@@ -141,7 +141,9 @@ class OverrideMeshSeparate(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Ifc.link(item, obj)
|
tool.Ifc.link(item, obj)
|
||||||
props.add_item_object(obj, item)
|
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.
|
# You cannot separate meshes if the representation is mapped.
|
||||||
relating_type = tool.Root.get_element_type(element)
|
relating_type = tool.Root.get_element_type(element)
|
||||||
if relating_type and tool.Root.does_type_have_representations(relating_type):
|
if relating_type and tool.Root.does_type_have_representations(relating_type):
|
||||||
|
|||||||
Reference in New Issue
Block a user