mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +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
|
oprops = obj.BIMObjectProperties
|
||||||
props = obj.BIMStructuralProperties
|
props = obj.BIMStructuralProperties
|
||||||
applied_condition_id = Data.connects_structural_members[self.connects_structural_member]["AppliedCondition"]
|
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
|
props.active_connects_structural_member = self.connects_structural_member
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -45,8 +42,15 @@ class DisableEditingStructuralConnectionCondition(bpy.types.Operator):
|
|||||||
class RemoveStructuralConnectionCondition(bpy.types.Operator):
|
class RemoveStructuralConnectionCondition(bpy.types.Operator):
|
||||||
bl_idname = "bim.remove_structural_connection_condition"
|
bl_idname = "bim.remove_structural_connection_condition"
|
||||||
bl_label = "Remove Structural Connection Condition"
|
bl_label = "Remove Structural Connection Condition"
|
||||||
|
connects_structural_member: bpy.props.IntProperty()
|
||||||
|
|
||||||
def execute(self, context):
|
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"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -68,14 +72,17 @@ class AddStructuralBoundaryCondition(bpy.types.Operator):
|
|||||||
|
|
||||||
class RemoveStructuralBoundaryCondition(bpy.types.Operator):
|
class RemoveStructuralBoundaryCondition(bpy.types.Operator):
|
||||||
bl_idname = "bim.remove_structural_boundary_condition"
|
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):
|
def execute(self, context):
|
||||||
obj = context.active_object
|
|
||||||
file = IfcStore.get_file()
|
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})
|
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"}
|
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")
|
row.operator("bim.disable_editing_structural_boundary_condition", text="", icon="X")
|
||||||
elif props.active_boundary_condition and props.active_boundary_condition != boundary_condition_id:
|
elif props.active_boundary_condition and props.active_boundary_condition != boundary_condition_id:
|
||||||
row.label(text=data["type"], icon="CON_TRACKTO")
|
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:
|
else:
|
||||||
row.label(text=data["type"], icon="CON_TRACKTO")
|
row.label(text=data["type"], icon="CON_TRACKTO")
|
||||||
op = row.operator("bim.enable_editing_structural_boundary_condition", text="", icon="GREASEPENCIL")
|
op = row.operator("bim.enable_editing_structural_boundary_condition", text="", icon="GREASEPENCIL")
|
||||||
op.boundary_condition = data["id"]
|
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:
|
if props.active_boundary_condition and props.active_boundary_condition == boundary_condition_id:
|
||||||
draw_boundary_condition_editable_ui(layout, props)
|
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']}")
|
row.label(text=f"To Member #{rel['RelatingStructuralMember']}")
|
||||||
if self.props.active_connects_structural_member and self.props.active_connects_structural_member == rel_id:
|
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="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)
|
self.draw_editable_ui(context, self.layout, rel)
|
||||||
elif self.props.active_connects_structural_member:
|
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:
|
else:
|
||||||
op = row.operator("bim.enable_editing_structural_connection_condition", text="", icon="GREASEPENCIL")
|
op = row.operator("bim.enable_editing_structural_connection_condition", text="", icon="GREASEPENCIL")
|
||||||
op.connects_structural_member = rel_id
|
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):
|
def draw_editable_ui(self, context, layout, data):
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ class Data:
|
|||||||
is_loaded = False
|
is_loaded = False
|
||||||
products = {}
|
products = {}
|
||||||
structural_analysis_models = {}
|
structural_analysis_models = {}
|
||||||
boundary_conditions = {}
|
|
||||||
members = {}
|
|
||||||
connections = {}
|
connections = {}
|
||||||
|
boundary_conditions = {}
|
||||||
connects_structural_members = {}
|
connects_structural_members = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -12,9 +11,8 @@ class Data:
|
|||||||
cls.is_loaded = False
|
cls.is_loaded = False
|
||||||
cls.products = {}
|
cls.products = {}
|
||||||
cls.structural_analysis_models = {}
|
cls.structural_analysis_models = {}
|
||||||
cls.boundary_conditions = {}
|
|
||||||
cls.members = {}
|
|
||||||
cls.connections = {}
|
cls.connections = {}
|
||||||
|
cls.boundary_conditions = {}
|
||||||
cls.connects_structural_members = {}
|
cls.connects_structural_members = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
+2
-3
@@ -8,7 +8,6 @@ class Usecase:
|
|||||||
def execute(self):
|
def execute(self):
|
||||||
if not self.settings["connection"].AppliedCondition:
|
if not self.settings["connection"].AppliedCondition:
|
||||||
return
|
return
|
||||||
if len(self.file.get_inverse(self.settings["connection"].AppliedCondition)) > 1:
|
if len(self.file.get_inverse(self.settings["connection"].AppliedCondition)) == 1:
|
||||||
self.settings["connection"].AppliedCondition = None
|
|
||||||
else:
|
|
||||||
self.file.remove(self.settings["connection"].AppliedCondition)
|
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