mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
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
This commit is contained in:
@@ -135,6 +135,10 @@ class ResizeToStorey(bpy.types.Operator, Operator):
|
|||||||
class SplitAlongEdge(bpy.types.Operator, Operator):
|
class SplitAlongEdge(bpy.types.Operator, Operator):
|
||||||
bl_idname = "bim.split_along_edge"
|
bl_idname = "bim.split_along_edge"
|
||||||
bl_label = "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"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -150,10 +154,12 @@ class SplitAlongEdge(bpy.types.Operator, Operator):
|
|||||||
for obj in objs:
|
for obj in objs:
|
||||||
# You cannot split meshes if the representation is mapped.
|
# You cannot split meshes if the representation is mapped.
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if element:
|
if not element:
|
||||||
relating_type = tool.Root.get_element_type(element)
|
continue
|
||||||
if relating_type and tool.Root.does_type_have_representations(relating_type):
|
|
||||||
bpy.ops.bim.unassign_type(related_object=obj.name)
|
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
|
# refresh representation
|
||||||
representation = tool.Geometry.get_active_representation(obj)
|
representation = tool.Geometry.get_active_representation(obj)
|
||||||
@@ -197,6 +203,8 @@ class SplitAlongEdge(bpy.types.Operator, Operator):
|
|||||||
apply_openings=True,
|
apply_openings=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.report({"INFO"}, f"Splitting finished, {len(new_objs)} new objects created.")
|
||||||
|
|
||||||
|
|
||||||
class GetConnectedSystemElements(bpy.types.Operator, Operator):
|
class GetConnectedSystemElements(bpy.types.Operator, Operator):
|
||||||
bl_idname = "bim.get_connected_system_elements"
|
bl_idname = "bim.get_connected_system_elements"
|
||||||
|
|||||||
Reference in New Issue
Block a user