Repository: FreeCAD/FreeCAD
File: src/Mod/BIM/ArchComponent.py (Python)

Code before:
        if math.isclose(angle, 0, abs_tol=0.0005):
            return True
        return math.isclose(angle, math.pi, abs_tol=0.0005)

    def compute(self):
        """Compute the vertical area, horizontal area, and perimeter length.

        This method performs the following steps:
        1. Identifies the object's vertical and horizontal faces.
        2. Computes the total vertical area by adding areas of all vertical faces.
        3. Projects horizontal faces onto the XY plane and computes their total horizontal area.
        4. Computes the perimeter length of the horizontal area.

        The computed values are assigned to the object's properties:
        - VerticalArea
        - HorizontalArea
        - PerimeterLength
        """
        if self.isShapeInvalid() or self.tooManyFaces():
            self.resetAreas()
            return

        verticalArea = 0
        horizontalAreaFaces = []

        # Compute vertical area and collect horizontal faces
        for i, face in enumerate(self.obj.Shape.Faces, start=1):
            if self.isFaceVertical(face, face_index=i):
                verticalArea += face.Area
            else:
                horizontalAreaFaces.append(face)

        # Update vertical area
        if hasattr(self.obj, "VerticalArea") and self.obj.VerticalArea.Value != verticalArea:
            self.obj.VerticalArea = verticalArea

        # Compute horizontal area and perimeter length
        if horizontalAreaFaces and hasattr(self.obj, "HorizontalArea"):
            self._computeHorizontalAreaAndPerimeter(horizontalAreaFaces)

    def _computeHorizontalAreaAndPerimeter(self, horizontalAreaFaces):
        """Compute the horizontal area and perimeter length.

        Projects the given faces onto the XY plane, fuses them, and calculates:
        - The total horizontal area.
        - The perimeter length of the fused horizontal area.

        Parameters
        ----------
        horizontalAreaFaces: list of Part.Face
            The faces to process.

Review comment (suggestion):
```suggestion
        # Compute vertical area and collect faces to be projected for the horizontal area
```
Keep the old comment. All non-vertical faces are processed for the horizontal area calculation.

Code after:
        if math.isclose(angle, 0, abs_tol=0.0005):
            return True
        return math.isclose(angle, math.pi, abs_tol=0.0005)

    def compute(self):
        """Compute the vertical area, horizontal area, and perimeter length.

        This method performs the following steps:
        1. Identifies the object's vertical and horizontal faces.
        2. Computes the total vertical area by adding areas of all vertical faces.
        3. Projects horizontal faces onto the XY plane and computes their total horizontal area.
        4. Computes the perimeter length of the horizontal area.

        The computed values are assigned to the object's properties:
        - VerticalArea
        - HorizontalArea
        - PerimeterLength
        """
        if self.isShapeInvalid() or self.tooManyFaces():
            self.resetAreas()
            return

        verticalArea = 0
        horizontalAreaFaces = []

        # Compute vertical area and collect faces to be projected for the horizontal area
        for i, face in enumerate(self.obj.Shape.Faces, start=1):
            if self.isFaceVertical(face, face_index=i):
                verticalArea += face.Area
            else:
                horizontalAreaFaces.append(face)

        # Update vertical area
        if hasattr(self.obj, "VerticalArea") and self.obj.VerticalArea.Value != verticalArea:
            self.obj.VerticalArea = verticalArea

        # Compute horizontal area and perimeter length
        if horizontalAreaFaces and hasattr(self.obj, "HorizontalArea"):
            self._computeHorizontalAreaAndPerimeter(horizontalAreaFaces)

    def _computeHorizontalAreaAndPerimeter(self, horizontalAreaFaces):
        """Compute the horizontal area and perimeter length.

        Projects the given faces onto the XY plane, fuses them, and calculates:
        - The total horizontal area.
        - The perimeter length of the fused horizontal area.

        Parameters
        ----------
        horizontalAreaFaces: list of Part.Face
            The faces to process.