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.
This commit is contained in:
Roy-043
2026-01-08 21:55:45 +01:00
committed by Chris Hennes
parent 06d490fa4d
commit 95b2a41e78

View File

@@ -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: