Arch: more failsafe area computation

This commit is contained in:
Yorik van Havre
2016-09-07 20:15:42 -03:00
parent 4e096ff963
commit 2977392bbe

View File

@@ -709,8 +709,18 @@ class Component:
import Drawing,Part
pset = []
for f in fset:
pf = Part.Face(Part.Wire(Drawing.project(f,FreeCAD.Vector(0,0,1))[0].Edges))
pset.append(pf)
try:
pf = Part.Face(Part.Wire(Drawing.project(f,FreeCAD.Vector(0,0,1))[0].Edges))
except Part.OCCError:
# error in computing the areas. Better set them to zero than show a wrong value
if obj.HorizontalArea.Value != 0:
print "Error computing areas for ",obj.Label
obj.HorizontalArea = 0
if hasattr(obj,"PerimeterLength"):
if obj.PerimeterLength.Value != 0:
obj.PerimeterLength = 0
else:
pset.append(pf)
if pset:
self.flatarea = pset.pop()
for f in pset: