From e26dae67aa17515045733863ccea53c0aa38ba67 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 1 Jun 2024 15:11:29 +1000 Subject: [PATCH] Convenience function for calculators to get maximum XY length This is useful for 2D profiles --- src/ifcopenshell-python/ifcopenshell/util/shape.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape.py b/src/ifcopenshell-python/ifcopenshell/util/shape.py index 8780d63920..4b45c013e5 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape.py @@ -117,6 +117,17 @@ def get_z(geometry) -> float: return max(z_values) - min(z_values) +def get_max_xy(geometry) -> float: + """Gets the maximum X or Y length of the geometry + + :param geometry: Geometry output calculated by IfcOpenShell + :type geometry: geometry + :return: The maximum possible value out of the X and Y dimension + :rtype: float + """ + return max(get_x(geometry), get_y(geometry)) + + def get_max_xyz(geometry) -> float: """Gets the maximum X, Y, or Z length of the geometry