From d55a2915898b06b6b4fdcc5106db8de015e5be89 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 27 Dec 2024 18:20:53 +0500 Subject: [PATCH] get_top_area to calculate area for the roof #5899 --- src/ifc5d/ifc5d/IFC4QtoBaseQuantities.json | 4 ++-- src/ifc5d/ifc5d/qto.py | 5 +++++ src/ifcopenshell-python/ifcopenshell/util/shape.py | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ifc5d/ifc5d/IFC4QtoBaseQuantities.json b/src/ifc5d/ifc5d/IFC4QtoBaseQuantities.json index 64b69884ec..dfe870bbe2 100644 --- a/src/ifc5d/ifc5d/IFC4QtoBaseQuantities.json +++ b/src/ifc5d/ifc5d/IFC4QtoBaseQuantities.json @@ -484,8 +484,8 @@ }, "IfcRoof": { "Qto_RoofBaseQuantities": { - "GrossArea": null, - "NetArea": null, + "GrossArea": "gross_get_top_area", + "NetArea": "net_get_top_area", "ProjectedArea": null } }, diff --git a/src/ifc5d/ifc5d/qto.py b/src/ifc5d/ifc5d/qto.py index c9681e356f..eefa182054 100644 --- a/src/ifc5d/ifc5d/qto.py +++ b/src/ifc5d/ifc5d/qto.py @@ -145,6 +145,11 @@ class IfcOpenShell: "Side area", "The side (non-projected) are of the shape as seen from the local Y-axis", ), + "get_top_area": Function( + "IfcAreaMeasure", + "Top area", + "The total surface area deviating by no more than 45 degrees from the local Z+ axis.", + ), # IfcVolumeMeasure "get_volume": Function("IfcVolumeMeasure", "Volume", "Calculates the volume of a manifold shape"), } diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape.py b/src/ifcopenshell-python/ifcopenshell/util/shape.py index 71e9db1614..c99f479000 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape.py @@ -532,6 +532,10 @@ def get_max_side_area(geometry: ShapeType) -> float: return max(get_side_area(geometry, axis="X"), get_side_area(geometry, axis="Y"), get_side_area(geometry, axis="Z")) +def get_top_area(geometry: ShapeType) -> float: + return get_side_area(geometry, axis="Z", angle=45) + + def get_footprint_area( geometry: ShapeType, axis: AXIS_LITERAL = "Z",