You can now add structural connections to members

This commit is contained in:
Dion Moult
2021-04-01 11:09:44 +11:00
parent 1820f72bc4
commit e7c6f28312
6 changed files with 42 additions and 9 deletions
@@ -11,6 +11,22 @@ class AddStructuralMemberConnection(bpy.types.Operator):
bl_label = "Add Structural Member Connection"
def execute(self, context):
obj = bpy.context.active_object
oprops = obj.BIMObjectProperties
props = obj.BIMStructuralProperties
file = IfcStore.get_file()
related_structural_connection = file.by_id(oprops.ifc_definition_id)
relating_structural_member = file.by_id(props.relating_structural_member.BIMObjectProperties.ifc_definition_id)
if not relating_structural_member.is_a("IfcStructuralMember"):
return {"FINISHED"}
ifcopenshell.api.run(
"structural.add_structural_member_connection",
file,
relating_structural_member=relating_structural_member,
related_structural_connection=related_structural_connection,
)
props.relating_structural_member = None
Data.load(IfcStore.get_file(), related_structural_connection.id())
return {"FINISHED"}
@@ -32,3 +32,4 @@ class BIMObjectStructuralProperties(PropertyGroup):
boundary_condition_attributes: CollectionProperty(name="Boundary Condition Attributes", type=Attribute)
active_boundary_condition: IntProperty(name="Active Boundary Condition")
active_connects_structural_member: IntProperty(name="Active Connects Structural Member")
relating_structural_member: PointerProperty(name="Relating Structural Member", type=bpy.types.Object)
@@ -115,13 +115,13 @@ class BIM_PT_connected_structural_members(Panel):
rel_ids = Data.connections[self.oprops.ifc_definition_id]["ConnectsStructuralMembers"]
row = self.layout.row(align=True)
row.label(text=f"{len(rel_ids)} Connected Structural Members", icon="CON_TRACKTO")
row.prop(self.props, "relating_structural_member", text="", icon="CON_TRACKTO")
row.operator("bim.add_structural_member_connection", text="", icon="ADD")
for rel_id in rel_ids:
rel = Data.connects_structural_members[rel_id]
row = self.layout.row(align=True)
row.label(text=f"To Member #{rel['RelatingStructuralMember']}")
row.label(text=f"To Member #{IfcStore.get_file().by_id(rel['RelatingStructuralMember']).Name}")
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.enabled = self.props.active_boundary_condition != rel["AppliedCondition"]