(self, model: ios.entity_instance)
| 710 | return np.round(comb_factors, 4) |
| 711 | |
| 712 | def parse_model(self, model: ios.entity_instance): |
| 713 | data = {"model": {k: v for k, v in model.get_info().items() if k in self.model_keys}} |
| 714 | |
| 715 | data["model"]["ObjectType"] = ifcopenshell.util.element.get_predefined_type(model) |
| 716 | if model.LoadedBy: |
| 717 | data["model"]["LoadedBy"] = [item.Name for item in model.LoadedBy] |
| 718 | if model.HasResults: |
| 719 | data["model"]["HasResults"] = [item.Name for item in model.HasResults] |
| 720 | data["model"]["ref_id"] = self.get_ref_id(model) |
| 721 | placement = ifcopenshell.util.placement.get_local_placement(model.SharedPlacement) |
| 722 | origin, orientation = self.parse_transformation_matrix(placement) |
| 723 | data["model"]["origin"] = origin |
| 724 | data["model"]["orientation"] = orientation |
| 725 | |
| 726 | # elements and connections |
| 727 | elements = [self.parse_element(element) for element in self.get_elements(model=model)] |
| 728 | connections = [self.parse_connection(connection) for connection in self.get_connections(model=model)] |
| 729 | for element in elements: |
| 730 | element["connections"] = self.parse_element_connections(element, connections=connections) |
| 731 | |
| 732 | # loads, laod cases and laod combinations |
| 733 | load_cases = self.get_load_cases(model=model) |
| 734 | load_case_ids = [load_case.id() for load_case in load_cases] |
| 735 | load_groups = self.get_load_groups(model=model) |
| 736 | load_group_ids = [load_group.id() for load_group in load_groups] |
| 737 | for element in elements + connections: |
| 738 | element["loads"] = self.parse_element_loads( |
| 739 | element=element, |
| 740 | load_group_ids=load_group_ids, |
| 741 | load_cases=load_cases, |
| 742 | ) |
| 743 | load_combinations = self.get_load_combinations(model=model) |
| 744 | if len(load_combinations): |
| 745 | self.parse_combination_loads(elements + connections, load_combinations, load_case_ids) |
| 746 | |
| 747 | data["load_cases"] = [load_case.get_info() for load_case in load_cases] |
| 748 | data["load_combinations"] = [load_combination.get_info() for load_combination in load_combinations] |
| 749 | for combination in data["load_combinations"]: |
| 750 | combination["factors"] = self.get_combination_factors(self.file.by_id(combination["id"]), load_case_ids) |
| 751 | combination["load_cases"] = [ |
| 752 | item.Name |
| 753 | for item in ifcopenshell.util.element.get_grouped_by(self.file.by_id(combination["id"])) |
| 754 | if item.is_a("IfcStructuralLoadCase") |
| 755 | ] |
| 756 | |
| 757 | # materials and profiles |
| 758 | materials = set([item["material"] for item in elements]) |
| 759 | materialdb = dict( |
| 760 | zip([self.get_ref_id(mat) for mat in materials], [self.parse_material(mat) for mat in materials]) |
| 761 | ) |
| 762 | for _, material in materialdb.items(): |
| 763 | material["related_elements"] = [ |
| 764 | item["ref_id"] for item in elements if material["id"] == item["material"].id() |
| 765 | ] |
| 766 | |
| 767 | profiles = set([item["profile"] for item in elements if item["geometry_type"] == "Edge"]) |
| 768 | profiledb = dict( |
| 769 | zip([self.get_ref_id(prof) for prof in profiles], [self.parse_profile(prof) for prof in profiles]) |
no test coverage detected