mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
You can now remove structural connection conditions + minor mods
This commit is contained in:
@@ -24,9 +24,6 @@ class EnableEditingStructuralConnectionCondition(bpy.types.Operator):
|
||||
oprops = obj.BIMObjectProperties
|
||||
props = obj.BIMStructuralProperties
|
||||
applied_condition_id = Data.connects_structural_members[self.connects_structural_member]["AppliedCondition"]
|
||||
if applied_condition_id:
|
||||
bpy.ops.bim.enable_editing_structural_boundary_condition(boundary_condition=applied_condition_id)
|
||||
|
||||
props.active_connects_structural_member = self.connects_structural_member
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -45,8 +42,15 @@ class DisableEditingStructuralConnectionCondition(bpy.types.Operator):
|
||||
class RemoveStructuralConnectionCondition(bpy.types.Operator):
|
||||
bl_idname = "bim.remove_structural_connection_condition"
|
||||
bl_label = "Remove Structural Connection Condition"
|
||||
connects_structural_member: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
file = IfcStore.get_file()
|
||||
relation = file.by_id(self.connects_structural_member)
|
||||
connection = relation.RelatedStructuralConnection
|
||||
ifcopenshell.api.run("structural.remove_structural_connection_condition", file, **{"relation": relation})
|
||||
|
||||
Data.load(IfcStore.get_file(), connection.id())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -68,14 +72,17 @@ class AddStructuralBoundaryCondition(bpy.types.Operator):
|
||||
|
||||
class RemoveStructuralBoundaryCondition(bpy.types.Operator):
|
||||
bl_idname = "bim.remove_structural_boundary_condition"
|
||||
bl_label = "Enable Editing Structural Boundary Condition"
|
||||
bl_label = "Remove Structural Boundary Condition"
|
||||
connection: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
obj = context.active_object
|
||||
file = IfcStore.get_file()
|
||||
connection = file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
connection = file.by_id(self.connection)
|
||||
ifcopenshell.api.run("structural.remove_structural_boundary_condition", file, **{"connection": connection})
|
||||
Data.load(IfcStore.get_file(), connection.id())
|
||||
if connection.is_a("IfcRelConnectsStructuralMember"):
|
||||
Data.load(IfcStore.get_file(), connection.RelatedStructuralConnection.id())
|
||||
else:
|
||||
Data.load(IfcStore.get_file(), connection.id())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ def draw_boundary_condition_ui(layout, boundary_condition_id, connection_id, pro
|
||||
row.operator("bim.disable_editing_structural_boundary_condition", text="", icon="X")
|
||||
elif props.active_boundary_condition and props.active_boundary_condition != boundary_condition_id:
|
||||
row.label(text=data["type"], icon="CON_TRACKTO")
|
||||
row.operator("bim.remove_structural_boundary_condition", text="", icon="X")
|
||||
row.operator("bim.remove_structural_boundary_condition", text="", icon="X").connection = connection_id
|
||||
else:
|
||||
row.label(text=data["type"], icon="CON_TRACKTO")
|
||||
op = row.operator("bim.enable_editing_structural_boundary_condition", text="", icon="GREASEPENCIL")
|
||||
op.boundary_condition = data["id"]
|
||||
row.operator("bim.remove_structural_boundary_condition", text="", icon="X")
|
||||
row.operator("bim.remove_structural_boundary_condition", text="", icon="X").connection = connection_id
|
||||
|
||||
if props.active_boundary_condition and props.active_boundary_condition == boundary_condition_id:
|
||||
draw_boundary_condition_editable_ui(layout, props)
|
||||
@@ -124,14 +124,16 @@ class BIM_PT_connected_structural_members(Panel):
|
||||
row.label(text=f"To Member #{rel['RelatingStructuralMember']}")
|
||||
if self.props.active_connects_structural_member and self.props.active_connects_structural_member == rel_id:
|
||||
row.operator("bim.disable_editing_structural_connection_condition", text="", icon="CHECKMARK")
|
||||
row.operator("bim.disable_editing_structural_connection_condition", text="", icon="X")
|
||||
row.enabled = self.props.active_boundary_condition != rel["AppliedCondition"]
|
||||
self.draw_editable_ui(context, self.layout, rel)
|
||||
elif self.props.active_connects_structural_member:
|
||||
row.operator("bim.remove_structural_connection_condition", text="", icon="X")
|
||||
op = row.operator("bim.remove_structural_connection_condition", text="", icon="X")
|
||||
op.connects_structural_member = rel_id
|
||||
else:
|
||||
op = row.operator("bim.enable_editing_structural_connection_condition", text="", icon="GREASEPENCIL")
|
||||
op.connects_structural_member = rel_id
|
||||
row.operator("bim.remove_structural_connection_condition", text="", icon="X")
|
||||
op = row.operator("bim.remove_structural_connection_condition", text="", icon="X")
|
||||
op.connects_structural_member = rel_id
|
||||
|
||||
def draw_editable_ui(self, context, layout, data):
|
||||
box = layout.box()
|
||||
|
||||
@@ -2,9 +2,8 @@ class Data:
|
||||
is_loaded = False
|
||||
products = {}
|
||||
structural_analysis_models = {}
|
||||
boundary_conditions = {}
|
||||
members = {}
|
||||
connections = {}
|
||||
boundary_conditions = {}
|
||||
connects_structural_members = {}
|
||||
|
||||
@classmethod
|
||||
@@ -12,9 +11,8 @@ class Data:
|
||||
cls.is_loaded = False
|
||||
cls.products = {}
|
||||
cls.structural_analysis_models = {}
|
||||
cls.boundary_conditions = {}
|
||||
cls.members = {}
|
||||
cls.connections = {}
|
||||
cls.boundary_conditions = {}
|
||||
cls.connects_structural_members = {}
|
||||
|
||||
@classmethod
|
||||
|
||||
+2
-3
@@ -8,7 +8,6 @@ class Usecase:
|
||||
def execute(self):
|
||||
if not self.settings["connection"].AppliedCondition:
|
||||
return
|
||||
if len(self.file.get_inverse(self.settings["connection"].AppliedCondition)) > 1:
|
||||
self.settings["connection"].AppliedCondition = None
|
||||
else:
|
||||
if len(self.file.get_inverse(self.settings["connection"].AppliedCondition)) == 1:
|
||||
self.file.remove(self.settings["connection"].AppliedCondition)
|
||||
self.settings["connection"].AppliedCondition = None
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"relation": None}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
if self.settings["relation"].AppliedCondition:
|
||||
ifcopenshell.api.run(
|
||||
"structural.remove_structural_boundary_condition",
|
||||
self.file,
|
||||
**{"connection": self.settings["relation"].RelatedStructuralConnection}
|
||||
)
|
||||
self.file.remove(self.settings["relation"])
|
||||
|
||||
Reference in New Issue
Block a user