mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
work on structural connection conditions
This commit is contained in:
@@ -16,6 +16,9 @@ classes = (
|
|||||||
operator.RemoveStructuralBoundaryCondition,
|
operator.RemoveStructuralBoundaryCondition,
|
||||||
operator.EnableEditingStructuralBoundaryCondition,
|
operator.EnableEditingStructuralBoundaryCondition,
|
||||||
operator.DisableEditingStructuralBoundaryCondition,
|
operator.DisableEditingStructuralBoundaryCondition,
|
||||||
|
operator.AddStructuralMemberConnection,
|
||||||
|
operator.EnableEditingStructuralConnectionCondition,
|
||||||
|
operator.RemoveStructuralConnectionCondition,
|
||||||
prop.StructuralAnalysisModel,
|
prop.StructuralAnalysisModel,
|
||||||
prop.BIMStructuralProperties,
|
prop.BIMStructuralProperties,
|
||||||
prop.BIMObjectStructuralProperties,
|
prop.BIMObjectStructuralProperties,
|
||||||
|
|||||||
@@ -6,6 +6,30 @@ from blenderbim.bim.ifc import IfcStore
|
|||||||
from ifcopenshell.api.structural.data import Data
|
from ifcopenshell.api.structural.data import Data
|
||||||
|
|
||||||
|
|
||||||
|
class AddStructuralMemberConnection(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.add_structural_member_connection"
|
||||||
|
bl_label = "Add Structural Member Connection"
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class EnableEditingStructuralConnectionCondition(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.enable_editing_structural_connection_condition"
|
||||||
|
bl_label = "Enable Editing Structural Connection Condition"
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class RemoveStructuralConnectionCondition(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.remove_structural_connection_condition"
|
||||||
|
bl_label = "Remove Structural Connection Condition"
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class AddStructuralBoundaryCondition(bpy.types.Operator):
|
class AddStructuralBoundaryCondition(bpy.types.Operator):
|
||||||
bl_idname = "bim.add_structural_boundary_condition"
|
bl_idname = "bim.add_structural_boundary_condition"
|
||||||
bl_label = "Add Structural Boundary Condition"
|
bl_label = "Add Structural Boundary Condition"
|
||||||
|
|||||||
@@ -31,4 +31,4 @@ class BIMStructuralProperties(PropertyGroup):
|
|||||||
class BIMObjectStructuralProperties(PropertyGroup):
|
class BIMObjectStructuralProperties(PropertyGroup):
|
||||||
boundary_condition_attributes: CollectionProperty(name="Boundary Condition Attributes", type=Attribute)
|
boundary_condition_attributes: CollectionProperty(name="Boundary Condition Attributes", type=Attribute)
|
||||||
is_editing_boundary_condition: BoolProperty(name="Is Editing Boundary Condition", default=False)
|
is_editing_boundary_condition: BoolProperty(name="Is Editing Boundary Condition", default=False)
|
||||||
connected_structural_members: CollectionProperty(name="Connected Structural Members", type=Attribute)
|
is_editing_connection_conditions: BoolProperty(name="Is Editing Connection Conditions", default=False)
|
||||||
|
|||||||
@@ -102,27 +102,20 @@ class BIM_PT_connected_structural_members(Panel):
|
|||||||
|
|
||||||
self.data = Data.connected_structural_members[self.oprops.ifc_definition_id]
|
self.data = Data.connected_structural_members[self.oprops.ifc_definition_id]
|
||||||
|
|
||||||
for member in self.data:
|
row = self.layout.row(align=True)
|
||||||
|
row.label(text=f"{len(self.data.keys())} Connected Structural Members Found", icon="CON_TRACKTO")
|
||||||
|
row.operator("bim.add_structural_member_connection", text="", icon="ADD")
|
||||||
|
|
||||||
|
for _,rel in self.data.items():
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text=str(member))
|
if self.props.is_editing_connection_conditions:
|
||||||
|
row.label(text=str(rel["RelatingStructuralMember"]))
|
||||||
# row = self.layout.row(align=True)
|
# row.operator("bim.edit_structural_member_connection", text="", icon="CHECKMARK")
|
||||||
# if self.data and self.props.is_editing_boundary_condition:
|
# row.operator("bim.disable_editing_structural_member_connection", text="", icon="X")
|
||||||
# row.label(text=self.data["type"], icon="CON_TRACKTO")
|
else:
|
||||||
# row.operator("bim.edit_structural_boundary_condition", text="", icon="CHECKMARK")
|
row.label(text=f"To Member #{rel['RelatingStructuralMember']}")
|
||||||
# row.operator("bim.disable_editing_structural_boundary_condition", text="", icon="X")
|
row.operator("bim.enable_editing_structural_connection_condition", text="", icon="GREASEPENCIL")
|
||||||
# elif self.data and not self.props.is_editing_boundary_condition:
|
row.operator("bim.remove_structural_connection_condition", text="", icon="X")
|
||||||
# row.label(text=self.data["type"], icon="CON_TRACKTO")
|
|
||||||
# row.operator("bim.enable_editing_structural_boundary_condition", text="", icon="GREASEPENCIL")
|
|
||||||
# row.operator("bim.remove_structural_boundary_condition", text="", icon="X")
|
|
||||||
# else:
|
|
||||||
# row.label(text="No Boundary Condition Found", icon="CON_TRACKTO")
|
|
||||||
# row.operator("bim.add_structural_boundary_condition", text="", icon="ADD")
|
|
||||||
|
|
||||||
# if self.props.is_editing_boundary_condition:
|
|
||||||
# self.draw_editable_ui(context)
|
|
||||||
# else:
|
|
||||||
# self.draw_read_only_ui(context)
|
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_structural_analysis_models(Panel):
|
class BIM_PT_structural_analysis_models(Panel):
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
class Data:
|
class Data:
|
||||||
is_loaded = False
|
is_loaded = False
|
||||||
products = {}
|
products = {}
|
||||||
boundary_conditions = {}
|
|
||||||
structural_analysis_models = {}
|
structural_analysis_models = {}
|
||||||
|
boundary_conditions = {}
|
||||||
|
connected_structural_members = {}
|
||||||
|
connection_conditions = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def purge(cls):
|
def purge(cls):
|
||||||
cls.is_loaded = False
|
cls.is_loaded = False
|
||||||
cls.products = {}
|
cls.products = {}
|
||||||
|
cls.structural_analysis_models = {}
|
||||||
cls.boundary_conditions = {}
|
cls.boundary_conditions = {}
|
||||||
cls.connected_structural_members = {}
|
cls.connected_structural_members = {}
|
||||||
cls.structural_analysis_models = {}
|
cls.connection_conditions = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, file, product_id=None):
|
def load(cls, file, product_id=None):
|
||||||
cls._file = file
|
cls._file = file
|
||||||
|
if not cls._file:
|
||||||
|
return
|
||||||
if product_id:
|
if product_id:
|
||||||
cls.boundary_conditions = {}
|
|
||||||
return cls.load_structural_connection(product_id)
|
return cls.load_structural_connection(product_id)
|
||||||
cls.products = {}
|
|
||||||
cls.structural_analysis_models = {}
|
|
||||||
cls.load_structural_analysis_models()
|
cls.load_structural_analysis_models()
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load_structural_analysis_models(cls):
|
def load_structural_analysis_models(cls):
|
||||||
|
cls.products = {}
|
||||||
|
cls.structural_analysis_models = {}
|
||||||
|
|
||||||
for model in cls._file.by_type("IfcStructuralAnalysisModel"):
|
for model in cls._file.by_type("IfcStructuralAnalysisModel"):
|
||||||
if model.IsGroupedBy:
|
if model.IsGroupedBy:
|
||||||
for rel in model.IsGroupedBy:
|
for rel in model.IsGroupedBy:
|
||||||
@@ -44,10 +49,16 @@ class Data:
|
|||||||
has_results.append(result_group.id())
|
has_results.append(result_group.id())
|
||||||
data["HasResults"] = has_results
|
data["HasResults"] = has_results
|
||||||
|
|
||||||
|
data["SharedPlacement"] = model.SharedPlacement.id()
|
||||||
|
|
||||||
cls.structural_analysis_models[model.id()] = data
|
cls.structural_analysis_models[model.id()] = data
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load_structural_connection(cls, product_id):
|
def load_structural_connection(cls, product_id):
|
||||||
|
cls.boundary_conditions = {}
|
||||||
|
cls.connected_structural_members = {}
|
||||||
|
# cls.connection_conditions = {}
|
||||||
|
|
||||||
connection = cls._file.by_id(product_id)
|
connection = cls._file.by_id(product_id)
|
||||||
if connection.AppliedCondition:
|
if connection.AppliedCondition:
|
||||||
data = connection.AppliedCondition.get_info()
|
data = connection.AppliedCondition.get_info()
|
||||||
@@ -59,8 +70,33 @@ class Data:
|
|||||||
data = {}
|
data = {}
|
||||||
cls.boundary_conditions[connection.id()] = data
|
cls.boundary_conditions[connection.id()] = data
|
||||||
|
|
||||||
cls.connected_structural_members[connection.id()] = [
|
cls.connected_structural_members[connection.id()] = {}
|
||||||
rel.RelatingStructuralMember.id()
|
for rel in connection.ConnectsStructuralMembers or []:
|
||||||
for rel in connection.ConnectsStructuralMembers or []
|
data = rel.get_info()
|
||||||
]
|
del data["OwnerHistory"]
|
||||||
|
data["RelatingStructuralMember"] = rel.RelatingStructuralMember.id()
|
||||||
|
data["RelatedStructuralConnection"] = rel.RelatedStructuralConnection.id()
|
||||||
|
del data["ConditionCoordinateSystem"] # TODO: consider orientation
|
||||||
|
del data["AppliedCondition"] # delete and parse below
|
||||||
|
if rel.is_a("IfcRelConnectsWithEccentricity"):
|
||||||
|
data["ConnectionConstraint"] = rel.ConnectionConstraint # TODO
|
||||||
|
|
||||||
|
cls.connected_structural_members[connection.id()][rel.id()] = data
|
||||||
|
|
||||||
|
if rel.AppliedCondition:
|
||||||
|
data = rel.AppliedCondition.get_info()
|
||||||
|
for key, value in data.items():
|
||||||
|
if not value or key in ["Name", "type", "id"]:
|
||||||
|
continue
|
||||||
|
data[key] = value.wrappedValue
|
||||||
|
else:
|
||||||
|
data = {}
|
||||||
|
cls.connection_conditions[rel.id()] = data
|
||||||
|
|
||||||
|
print(cls.connected_structural_members)
|
||||||
|
print(cls.connection_conditions)
|
||||||
|
|
||||||
|
# cls.connected_structural_members[connection.id()] = [
|
||||||
|
# rel.id()
|
||||||
|
# for rel in connection.ConnectsStructuralMembers or []
|
||||||
|
# ]
|
||||||
Reference in New Issue
Block a user