(self, element: dict, connections: list[dict])
| 456 | return data |
| 457 | |
| 458 | def parse_element_connections(self, element: dict, connections: list[dict]): |
| 459 | ifc_element = self.file.by_id(element["id"]) |
| 460 | connection_ids = [c["id"] for c in connections] |
| 461 | rels = [rel for rel in ifc_element.ConnectedBy if rel.RelatedStructuralConnection.id() in connection_ids] |
| 462 | |
| 463 | data = [dict() for _ in rels] |
| 464 | for i, rel in enumerate(rels): |
| 465 | data[i]["ref_id"] = self.get_ref_id(rel) |
| 466 | data[i]["related_connection"] = self.get_ref_id(rel.RelatedStructuralConnection) |
| 467 | data[i]["relating_element"] = self.get_ref_id(rel.RelatingStructuralMember) |
| 468 | |
| 469 | if rel.ConditionCoordinateSystem is None: |
| 470 | data[i]["orientation"] = element["orientation"] |
| 471 | else: |
| 472 | placement = ifcopenshell.util.placement.get_axis2placement(rel.ConditionCoordinateSystem) |
| 473 | _, orientation = self.parse_transformation_matrix(placement) |
| 474 | data[i]["orientation"] = element["orientation"].dot(orientation) |
| 475 | |
| 476 | conn_repr = ifcopenshell.util.representation.get_representation( |
| 477 | rel.RelatedStructuralConnection, self.get_context() |
| 478 | ) |
| 479 | data[i]["geometry_type"] = conn_repr.RepresentationType |
| 480 | data[i]["appliedCondition"] = self.parse_applied_condition( |
| 481 | rel.AppliedCondition, data[i]["geometry_type"], should_fix_condition=True |
| 482 | ) |
| 483 | |
| 484 | if rel.is_a("IfcRelConnectsWithEccentricity") and rel.RelatedStructuralConnection.is_a( |
| 485 | "IfcStructuralPointConnection" |
| 486 | ): |
| 487 | point_on_element = rel.ConnectionConstraint.PointOnRelatingElement.Coordinates |
| 488 | element_length = round( |
| 489 | np.linalg.norm(np.array(element["geometry"][0]) - np.array(element["geometry"][1])), 6 |
| 490 | ) |
| 491 | x_local = min(max(0.0, point_on_element[0]), element_length) |
| 492 | point_on_element = ( |
| 493 | np.array(element["geometry"][0]) |
| 494 | + (np.array(element["geometry"][1]) - np.array(element["geometry"][0])) * x_local / element_length |
| 495 | ) |
| 496 | point_on_element = np.round(point_on_element, 6) |
| 497 | data[i]["eccentricity"] = {"point_on_element": point_on_element} |
| 498 | else: |
| 499 | data[i]["eccentricity"] = ( |
| 500 | rel.ConnectionConstraint.get_info(recursive=True) |
| 501 | if rel.is_a("IfcRelConnectsWithEccentricity") |
| 502 | else None |
| 503 | ) |
| 504 | |
| 505 | return data |
| 506 | |
| 507 | def parse_element_loads( |
| 508 | self, |
no test coverage detected