From 6995cafe63f3e38c18ade4fedabea4f0741c191e Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 16 May 2024 17:33:27 +0500 Subject: [PATCH] bim.split_along_edge fixes #4675 1) description to emphasize that active object will be the one that's cutting 2) skip non-ifc elements, previously they failed to process with error `AttributeError: 'NoneType' object has no attribute 'RepresentationType'`. Also skip objects without representations. 3) add an info message at the end Here's a short gif in case if anyone doesn't about that feature: https://imgur.com/a/338w7jx --- .../blenderbim/bim/module/misc/operator.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/misc/operator.py b/src/blenderbim/blenderbim/bim/module/misc/operator.py index ed2e714d32..aed020dcc9 100644 --- a/src/blenderbim/blenderbim/bim/module/misc/operator.py +++ b/src/blenderbim/blenderbim/bim/module/misc/operator.py @@ -135,6 +135,10 @@ class ResizeToStorey(bpy.types.Operator, Operator): class SplitAlongEdge(bpy.types.Operator, Operator): bl_idname = "bim.split_along_edge" bl_label = "Split Along Edge" + bl_description = ( + "Active object is considered to be a cutting object." + "Will unassign element from a type if type has a representation." + ) bl_options = {"REGISTER", "UNDO"} @classmethod @@ -150,10 +154,12 @@ class SplitAlongEdge(bpy.types.Operator, Operator): for obj in objs: # You cannot split meshes if the representation is mapped. element = tool.Ifc.get_entity(obj) - if element: - relating_type = tool.Root.get_element_type(element) - if relating_type and tool.Root.does_type_have_representations(relating_type): - bpy.ops.bim.unassign_type(related_object=obj.name) + if not element: + continue + + relating_type = tool.Root.get_element_type(element) + if relating_type and tool.Root.does_type_have_representations(relating_type): + bpy.ops.bim.unassign_type(related_object=obj.name) # refresh representation representation = tool.Geometry.get_active_representation(obj) @@ -197,6 +203,8 @@ class SplitAlongEdge(bpy.types.Operator, Operator): apply_openings=True, ) + self.report({"INFO"}, f"Splitting finished, {len(new_objs)} new objects created.") + class GetConnectedSystemElements(bpy.types.Operator, Operator): bl_idname = "bim.get_connected_system_elements"