(self, connection: ios.entity_instance)
| 419 | return data |
| 420 | |
| 421 | def parse_connection(self, connection: ios.entity_instance): |
| 422 | data = {k: v for k, v in connection.get_info().items() if k in self.connection_keys} |
| 423 | |
| 424 | data["ObjectType"] = ifcopenshell.util.element.get_predefined_type(connection) |
| 425 | data["ref_id"] = self.get_ref_id(connection) |
| 426 | representation = ifcopenshell.util.representation.get_representation(connection, self.get_context()) |
| 427 | repr_item = representation.Items[0] |
| 428 | data["geometry_type"] = representation.RepresentationType |
| 429 | data["geometry"] = self.parse_representation(representation) |
| 430 | |
| 431 | if connection.is_a("IfcStructuralPointConnection"): |
| 432 | if connection.ConditionCoordinateSystem is not None: |
| 433 | placement = ifcopenshell.util.placement.get_axis2placement(connection.ConditionCoordinateSystem) |
| 434 | else: |
| 435 | placement = np.eye(4) |
| 436 | for i, v in enumerate(placement[:3]): |
| 437 | v[3] = data["geometry"][i] |
| 438 | |
| 439 | if connection.is_a("IfcStructuralCurveConnection"): |
| 440 | placement = ifcopenshell.util.placement.a2p( |
| 441 | data["geometry"][0], |
| 442 | connection.Axis.DirectionRatios, |
| 443 | [c2 - c1 for c1, c2 in zip(data["geometry"][0], data["geometry"][1])], |
| 444 | ) |
| 445 | |
| 446 | elif connection.is_a("IfcStructuralSurfaceConnection"): |
| 447 | placement = ifcopenshell.util.placement.get_axis2placement(repr_item.FaceSurface.Position) |
| 448 | |
| 449 | origin, orientation = self.parse_transformation_matrix(placement) |
| 450 | data["origin"] = origin |
| 451 | data["orientation"] = orientation |
| 452 | if connection.is_a("IfcStructuralSurfaceConnection") and not repr_item.SameSense: |
| 453 | data["orientation"] *= -1 |
| 454 | |
| 455 | data["appliedCondition"] = self.parse_applied_condition(connection.AppliedCondition, data["geometry_type"]) |
| 456 | return data |
| 457 | |
| 458 | def parse_element_connections(self, element: dict, connections: list[dict]): |
| 459 | ifc_element = self.file.by_id(element["id"]) |
no test coverage detected