diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 216b86b957..09db2c5f4f 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -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) diff --git a/src/Mod/Draft/DraftGeomUtils.py b/src/Mod/Draft/DraftGeomUtils.py index 289339e388..d6c36f8c72 100755 --- a/src/Mod/Draft/DraftGeomUtils.py +++ b/src/Mod/Draft/DraftGeomUtils.py @@ -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