Exemplo n.º 1
0
    def _execute(self, context):
        obj = context.active_object
        props = obj.BIMStructuralProperties

        file = IfcStore.get_file()
        connection = file.by_id(self.connection)
        condition = connection.AppliedCondition

        attributes = {}
        for attribute in props.boundary_condition_attributes:
            if attribute.is_null:
                attributes[attribute.name] = {"value": None, "type": "null"}
            elif attribute.data_type == "string":
                attributes[attribute.name] = {"value": attribute.string_value, "type": "string"}
            elif attribute.enum_value == "IfcBoolean":
                attributes[attribute.name] = {"value": attribute.bool_value, "type": attribute.enum_value}
            else:
                attributes[attribute.name] = {"value": attribute.float_value, "type": attribute.enum_value}

        ifcopenshell.api.run(
            "structural.edit_structural_boundary_condition", file, **{"condition": condition, "attributes": attributes}
        )
        if connection.is_a("IfcRelConnectsStructuralMember"):
            Data.load(IfcStore.get_file(), connection.RelatedStructuralConnection.id())
        else:
            Data.load(IfcStore.get_file(), connection.id())
        bpy.ops.bim.disable_editing_structural_boundary_condition()
        return {"FINISHED"}
Exemplo n.º 2
0
 def execute(self, context):
     self.file = IfcStore.get_file()
     ifcopenshell.api.run(
         "structural.remove_structural_load_group", self.file, load_group=self.file.by_id(self.load_group)
     )
     Data.load(self.file)
     return {"FINISHED"}
Exemplo n.º 3
0
    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"}
Exemplo n.º 4
0
 def _execute(self, context):
     result = ifcopenshell.api.run(
         "structural.add_structural_load", IfcStore.get_file(), name="New Load", ifc_class=self.ifc_class
     )
     Data.load(IfcStore.get_file())
     bpy.ops.bim.load_structural_loads()
     bpy.ops.bim.enable_editing_structural_load(structural_load=result.id())
     return {"FINISHED"}
Exemplo n.º 5
0
 def _execute(self, context):
     file = IfcStore.get_file()
     connection = file.by_id(self.connection)
     ifcopenshell.api.run("structural.remove_structural_boundary_condition", file, **{"connection": connection})
     if connection.is_a("IfcRelConnectsStructuralMember"):
         Data.load(IfcStore.get_file(), connection.RelatedStructuralConnection.id())
     else:
         Data.load(IfcStore.get_file(), connection.id())
     return {"FINISHED"}
Exemplo n.º 6
0
    def draw(self, context):
        self.oprops = context.active_object.BIMObjectProperties
        self.props = context.active_object.BIMStructuralProperties
        if self.oprops.ifc_definition_id not in Data.connections:
            Data.load(IfcStore.get_file(), self.oprops.ifc_definition_id)

        applied_condition_id = Data.connections[
            self.oprops.ifc_definition_id]["AppliedCondition"]
        draw_boundary_condition_ui(self.layout, applied_condition_id,
                                   self.oprops.ifc_definition_id, self.props)
Exemplo n.º 7
0
    def draw(self, context):
        self.props = context.scene.BIMStructuralProperties

        if not Data.is_loaded:
            Data.load(IfcStore.get_file())

        row = self.layout.row()
        row.operator("bim.add_structural_load_case", icon="ADD")

        for load_case_id, load_case in Data.load_cases.items():
            self.draw_load_case_ui(load_case_id, load_case)
Exemplo n.º 8
0
 def _execute(self, context):
     props = context.scene.BIMStructuralProperties
     self.file = IfcStore.get_file()
     ifcopenshell.api.run(
         "structural.remove_structural_load",
         self.file,
         **{"structural_load": self.file.by_id(self.structural_load)},
     )
     Data.load(IfcStore.get_file())
     bpy.ops.bim.load_structural_loads()
     return {"FINISHED"}
Exemplo n.º 9
0
 def _execute(self, context):
     props = context.scene.BIMStructuralProperties
     attributes = blenderbim.bim.helper.export_attributes(props.load_case_attributes)
     self.file = IfcStore.get_file()
     ifcopenshell.api.run(
         "structural.edit_structural_load_case",
         self.file,
         **{"load_case": self.file.by_id(props.active_load_case_id), "attributes": attributes},
     )
     Data.load(IfcStore.get_file())
     bpy.ops.bim.disable_editing_structural_load_case()
     return {"FINISHED"}
Exemplo n.º 10
0
 def execute(self, context):
     self.file = IfcStore.get_file()
     ifcopenshell.api.run(
         "aggregate.unassign_object",
         self.file,
         **{
             "relating_object": self.file.by_id(self.work_plan),
             "product": self.file.by_id(self.load_case),
         },
     )
     Data.load(IfcStore.get_file())
     return {"FINISHED"}
Exemplo n.º 11
0
    def draw(self, context):
        self.oprops = context.active_object.BIMObjectProperties
        self.props = context.active_object.BIMStructuralProperties
        if self.oprops.ifc_definition_id not in Data.connections:
            Data.load(IfcStore.get_file(), self.oprops.ifc_definition_id)

        rel_ids = Data.connections[
            self.oprops.ifc_definition_id]["ConnectsStructuralMembers"]

        row = self.layout.row(align=True)
        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 #{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="CANCEL")
                row.enabled = self.props.active_boundary_condition != rel[
                    "AppliedCondition"]
                self.draw_editable_ui(context, self.layout, rel)
            elif self.props.active_connects_structural_member:
                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
                op = row.operator("bim.remove_structural_connection_condition",
                                  text="",
                                  icon="X")
                op.connects_structural_member = rel_id
Exemplo n.º 12
0
 def _execute(self, context):
     obj = 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"}
Exemplo n.º 13
0
    def draw(self, context):
        if not Data.is_loaded:
            Data.load(IfcStore.get_file())
        self.props = context.scene.BIMStructuralProperties

        row = self.layout.row(align=True)
        row.label(text="{} Structural Loads Found".format(
            len(Data.structural_loads)),
                  icon="ANIM_DATA")
        if self.props.is_editing_loads:
            row.operator(
                "bim.toggle_filter_structural_loads",
                text="FILTER - OFF"
                if not self.props.filtered_structural_loads else "FILTER - ON",
                icon="FILTER",
            )
            row.operator("bim.disable_structural_load_editing_ui",
                         text="",
                         icon="SCREEN_BACK")

            row = self.layout.row(align=True)
            row.prop(self.props, "structural_load_types", text="")
            row.operator(
                "bim.add_structural_load", text="",
                icon="ADD").ifc_class = self.props.structural_load_types
        else:
            row.operator("bim.load_structural_loads",
                         text="",
                         icon="GREASEPENCIL")

        if self.props.is_editing_loads:
            self.layout.template_list(
                "BIM_UL_structural_loads",
                "",
                self.props,
                "structural_loads",
                self.props,
                "active_structural_load_index",
            )

        if self.props.active_structural_load_id:
            blenderbim.bim.helper.draw_attributes(
                self.props.structural_load_attributes, self.layout)
Exemplo n.º 14
0
    def _execute(self, context):
        self.props = context.scene.BIMStructuralProperties
        self.file = IfcStore.get_file()
        for obj in context.selected_objects:
            if not obj.BIMObjectProperties.ifc_definition_id:
                continue
            element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
            applied_load_class = self.props.applicable_structural_load_types

            allowed_load_classes = {
                "IfcStructuralPointConnection": [
                    "IfcStructuralLoadTemperature",
                    "IfcStructuralLoadSingleForce",
                    "IfcStructuralLoadSingleDisplacement",
                ],
                "IfcStructuralCurveMember": ["IfcStructuralLoadTemperature", "IfcStructuralLoadLinearForce"],
                "IfcStructuralSurfaceMember": ["IfcStructuralLoadTemperature", "IfcStructuralLoadPlanarForce"],
            }

            applicable_activity_class = {
                "IfcStructuralPointConnection": "IfcStructuralPointAction",
                "IfcStructuralCurveMember": "IfcStructuralLinearAction",
                "IfcStructuralSurfaceMember": "IfcStructuralPlanarAction",
            }

            if applied_load_class not in allowed_load_classes[element.is_a()]:
                continue

            ifc_class = applicable_activity_class[element.is_a()]

            activity = ifcopenshell.api.run(
                "structural.add_structural_activity",
                self.file,
                ifc_class=ifc_class,
                applied_load=self.file.by_id(int(self.props.applicable_structural_loads)),
                structural_member=element,
            )
            ifcopenshell.api.run(
                "group.assign_group", self.file, product=activity, group=self.file.by_id(self.load_group)
            )
        Data.load(IfcStore.get_file())
        bpy.ops.bim.enable_editing_structural_load_group_activities(load_group=self.load_group)
        return {"FINISHED"}
Exemplo n.º 15
0
    def draw(self, context):
        if not Data.is_loaded:
            Data.load(IfcStore.get_file())
        self.props = context.scene.BIMStructuralProperties

        row = self.layout.row(align=True)
        row.label(text="{} Boundary Conditions Found".format(
            len(Data.boundary_conditions)),
                  icon="CON_TRACKTO")
        if self.props.is_editing_boundary_conditions:
            row.operator(
                "bim.toggle_filter_boundary_conditions",
                text="FILTER - OFF" if
                not self.props.filtered_boundary_conditions else "FILTER - ON",
                icon="FILTER",
            )
            row.operator("bim.disable_boundary_condition_editing_ui",
                         text="",
                         icon="SCREEN_BACK")

            row = self.layout.row(align=True)
            row.prop(self.props, "boundary_condition_types", text="")
            row.operator(
                "bim.add_boundary_condition", text="",
                icon="ADD").ifc_class = self.props.boundary_condition_types
        else:
            row.operator("bim.load_boundary_conditions",
                         text="",
                         icon="GREASEPENCIL")

        if self.props.is_editing_boundary_conditions:
            self.layout.template_list(
                "BIM_UL_boundary_conditions",
                "",
                self.props,
                "boundary_conditions",
                self.props,
                "active_boundary_condition_index",
            )

        if self.props.active_boundary_condition_id:
            draw_boundary_condition_editable_ui(self.layout, self.props)
Exemplo n.º 16
0
 def _execute(self, context):
     props = context.scene.BIMStructuralProperties
     self.file = IfcStore.get_file()
     # attributes = blenderbim.bim.helper.export_attributes(props.boundary_condition_attributes)
     attributes = {}
     for attribute in props.boundary_condition_attributes:
         if attribute.is_null:
             attributes[attribute.name] = {"value": None, "type": "null"}
         elif attribute.data_type == "string":
             attributes[attribute.name] = {"value": attribute.string_value, "type": "string"}
         elif attribute.enum_value == "IfcBoolean":
             attributes[attribute.name] = {"value": attribute.bool_value, "type": attribute.enum_value}
         else:
             attributes[attribute.name] = {"value": attribute.float_value, "type": attribute.enum_value}
     ifcopenshell.api.run(
         "structural.edit_structural_boundary_condition",
         self.file,
         **{"condition": self.file.by_id(props.active_boundary_condition_id), "attributes": attributes},
     )
     Data.load(IfcStore.get_file())
     bpy.ops.bim.load_boundary_conditions()
     return {"FINISHED"}
Exemplo n.º 17
0
 def _execute(self, context):
     self.file = IfcStore.get_file()
     load_group = ifcopenshell.api.run("structural.add_structural_load_group", self.file)
     ifcopenshell.api.run("group.assign_group", self.file, product=load_group, group=self.file.by_id(self.load_case))
     Data.load(IfcStore.get_file())
     return {"FINISHED"}
Exemplo n.º 18
0
 def _execute(self, context):
     ifcopenshell.api.run("structural.add_structural_load_case", IfcStore.get_file())
     Data.load(IfcStore.get_file())
     return {"FINISHED"}