See #5972. You can now remove boolean operations in the stack without deleting operands.

This commit is contained in:
Dion Moult
2025-01-19 01:08:47 +11:00
parent 8c746b1a2c
commit e40644c4f6
6 changed files with 150 additions and 30 deletions
@@ -88,6 +88,7 @@ classes = (
opening.HideOpenings,
opening.PurgeUnusedOpenings,
opening.RecalculateFill,
opening.RemoveBoolean,
opening.RemoveBooleans,
opening.ShowBooleans,
opening.ShowOpenings,
@@ -1144,6 +1144,27 @@ class PurgeUnusedOpenings(Operator, tool.Ifc.Operator):
return {"FINISHED"}
class RemoveBoolean(Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_boolean"
bl_label = "Remove Boolean"
bl_options = {"REGISTER", "UNDO"}
bl_description = "Removes the actively selected boolean"
@classmethod
def poll(cls, context):
props = context.scene.BIMBooleanProperties
return props.active_boolean
def _execute(self, context):
props = context.scene.BIMBooleanProperties
ifcopenshell.api.geometry.remove_boolean(
tool.Ifc.get(), tool.Ifc.get().by_id(props.active_boolean.ifc_definition_id)
)
bpy.ops.bim.enable_editing_booleans()
rep_obj = bpy.context.scene.BIMGeometryProperties.representation_obj
tool.Geometry.reload_representation(rep_obj)
# TODO: merge with ProfileDecorator?
class DecorationsHandler:
installed = None
@@ -45,3 +45,8 @@ class BIMBooleanProperties(PropertyGroup):
name="Operator",
default="DIFFERENCE",
)
@property
def active_boolean(self):
if self.booleans and self.active_boolean_index < len(self.booleans):
return self.booleans[self.active_boolean_index]
+4
View File
@@ -176,6 +176,10 @@ class BIM_PT_booleans(Panel):
row.prop(props, "operator", text="")
row.operator("bim.add_boolean", text="", icon="ADD")
row = layout.row(align=True)
row.alignment = "RIGHT"
row.operator("bim.remove_boolean", text="", icon="X")
self.layout.template_list("BIM_UL_booleans", "", props, "booleans", props, "active_boolean_index")