mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 12:07:06 +00:00
A button to jump back from boolean to the original object
Example - https://imgur.com/a/A3dVbFM
This commit is contained in:
@@ -506,10 +506,14 @@ class AddBoolean(Operator, tool.Ifc.Operator):
|
|||||||
bl_idname = "bim.add_boolean"
|
bl_idname = "bim.add_boolean"
|
||||||
bl_label = "Add Boolean"
|
bl_label = "Add Boolean"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
bl_description = "Applies a boolean to the selected IFC object using the other selected blender object as a void"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return len(context.selected_objects) == 2
|
if not len(context.selected_objects) == 2:
|
||||||
|
cls.poll_message_set("Exactly 2 objects need to be selected.")
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
props = context.scene.BIMModelProperties
|
props = context.scene.BIMModelProperties
|
||||||
@@ -654,6 +658,7 @@ class RemoveBooleans(Operator, tool.Ifc.Operator, AddObjectHelper):
|
|||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
|
upstream_obj = None
|
||||||
for obj in context.selected_objects:
|
for obj in context.selected_objects:
|
||||||
if (
|
if (
|
||||||
not obj.data
|
not obj.data
|
||||||
@@ -681,6 +686,8 @@ class RemoveBooleans(Operator, tool.Ifc.Operator, AddObjectHelper):
|
|||||||
should_sync_changes_first=False,
|
should_sync_changes_first=False,
|
||||||
)
|
)
|
||||||
bpy.data.objects.remove(obj)
|
bpy.data.objects.remove(obj)
|
||||||
|
|
||||||
|
tool.Blender.set_active_object(upstream_obj)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -115,8 +115,17 @@ class BIM_PT_booleans(Panel):
|
|||||||
row.operator("bim.add_boolean", text="Apply Boolean", icon="ADD")
|
row.operator("bim.add_boolean", text="Apply Boolean", icon="ADD")
|
||||||
show_boolean_button = row.row(align=True)
|
show_boolean_button = row.row(align=True)
|
||||||
show_boolean_button.operator("bim.show_booleans", text="", icon="HIDE_OFF")
|
show_boolean_button.operator("bim.show_booleans", text="", icon="HIDE_OFF")
|
||||||
show_boolean_button.enabled = BooleansData.data['total_booleans'] > 0
|
show_boolean_button.enabled = BooleansData.data["total_booleans"] > 0
|
||||||
row.operator("bim.hide_booleans", text="", icon="HIDE_ON")
|
row.operator("bim.hide_booleans", text="", icon="HIDE_ON")
|
||||||
|
|
||||||
elif context.active_object.data.BIMMeshProperties.ifc_boolean_id:
|
elif context.active_object.data.BIMMeshProperties.ifc_boolean_id:
|
||||||
|
upsteam_obj = context.active_object.data.BIMMeshProperties.obj
|
||||||
|
upstream_obj_ifc_id = upsteam_obj.BIMObjectProperties.ifc_definition_id
|
||||||
|
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="Used as a boolean operand with:")
|
||||||
|
row.operator("bim.select_entity", text="", icon="RESTRICT_SELECT_OFF").ifc_id = upstream_obj_ifc_id
|
||||||
|
row.label(text=upsteam_obj.name)
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.operator("bim.remove_booleans", text="Remove Boolean", icon="X")
|
row.operator("bim.remove_booleans", text="Remove Boolean", icon="X")
|
||||||
|
|||||||
Reference in New Issue
Block a user