Bugfixes in Draft Upgrade

This commit is contained in:
Yorik van Havre
2012-03-29 11:57:18 -03:00
parent fd36956061
commit 7b97498f00
2 changed files with 30 additions and 4 deletions

View File

@@ -911,6 +911,20 @@ def isCoplanar(faces):
return False
return True
def isPlanar(shape):
"checks if the given shape is planar"
if len(shape.Vertexes) <= 3:
return True
pts = [v.Point for v in shape.Vertexes[0:3]]
bt = Part.Face(Part.makePolygon(pts+[pts[0]]))
n = bt.normalAt(0,0)
for p in shape.Vertexes[3:]:
pv = p.Point.sub(pts[0])
rv = fcvec.project(pv,n)
if not fcvec.isNull(rv):
return False
return True
def findWires(edges):
'''finds connected edges in the list, and returns a list of lists containing edges
that can be connected'''