From 95b2a41e782cd4a85a6ee2eb206c33e169c1abbc Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Thu, 8 Jan 2026 21:55:45 +0100 Subject: [PATCH] BIM: fix crazy edge issue with area calculation Fixes #26777. The code uses a TechDraw function that considers overly long edges (> ca. 10m) 'crazy'. We need to temporarily change a parameter. --- src/Mod/BIM/ArchComponent.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Mod/BIM/ArchComponent.py b/src/Mod/BIM/ArchComponent.py index d20f4176fd..f753ba3934 100644 --- a/src/Mod/BIM/ArchComponent.py +++ b/src/Mod/BIM/ArchComponent.py @@ -1460,6 +1460,15 @@ class AreaCalculator: import TechDraw import DraftGeomUtils + # In TechDraw edges longer than 9999.9 (ca. 10m) are considered 'crazy'. + # See also Draft/draftobjects/hatch.py. + param_grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/TechDraw/debug") + if "allowCrazyEdge" not in param_grp.GetBools(): + old_allow_crazy_edge = None + else: + old_allow_crazy_edge = param_grp.GetBool("allowCrazyEdge") + param_grp.SetBool("allowCrazyEdge", True) + direction = FreeCAD.Vector(0, 0, 1) projectedFaces = [] for face in horizontalAreaFaces: @@ -1497,6 +1506,11 @@ class AreaCalculator: self.resetAreas() return + if old_allow_crazy_edge is None: + param_grp.RemBool("allowCrazyEdge") + else: + param_grp.SetBool("allowCrazyEdge", old_allow_crazy_edge) + if projectedFaces: fusedFace = projectedFaces.pop() for face in projectedFaces: