Arch: Lowered tolerance of planar profiles for Arch structures

This commit is contained in:
Yorik van Havre
2018-12-27 12:29:03 -02:00
parent 407dc25dba
commit f3a44bed80
2 changed files with 4 additions and 4 deletions

View File

@@ -620,7 +620,7 @@ class _Structure(ArchComponent.Component):
if obj.Base.Shape.Solids:
return None
elif obj.Base.Shape.Faces:
if not DraftGeomUtils.isCoplanar(obj.Base.Shape.Faces):
if not DraftGeomUtils.isCoplanar(obj.Base.Shape.Faces,tolerance=0.01):
return None
else:
base,placement = self.rebase(obj.Base.Shape)

View File

@@ -1384,8 +1384,8 @@ def findClosestCircle(point,circles):
closest = c
return closest
def isCoplanar(faces):
"checks if all faces in the given list are coplanar"
def isCoplanar(faces,tolerance=0):
"isCoplanar(faces,[tolerance]): checks if all faces in the given list are coplanar. Tolerance is the max deviation to be considered coplanar"
if len(faces) < 2:
return True
base =faces[0].normalAt(0,0)
@@ -1393,7 +1393,7 @@ def isCoplanar(faces):
for v in faces[i].Vertexes:
chord = v.Point.sub(faces[0].Vertexes[0].Point)
dist = DraftVecUtils.project(chord,base)
if round(dist.Length,precision()) > 0:
if round(dist.Length,precision()) > tolerance:
return False
return True