Small fixes in Draft tools to work with Arch objects

This commit is contained in:
Yorik van Havre
2012-01-25 15:35:43 -02:00
parent 4920f2adf9
commit cb30344b6e
4 changed files with 45 additions and 30 deletions

View File

@@ -232,13 +232,16 @@ class plane:
def getPlacementFromPoints(points):
"returns a placement from a list of 3 or 4 vectors"
pl = plane()
pl.position = points[0]
pl.u = (points[1].sub(points[0]).normalize())
pl.v = (points[2].sub(points[0]).normalize())
if len(points) == 4:
pl.axis = (points[3].sub(points[0]).normalize())
else:
pl.axis = ((pl.u).cross(pl.v)).normalize()
try:
pl.position = points[0]
pl.u = (points[1].sub(points[0]).normalize())
pl.v = (points[2].sub(points[0]).normalize())
if len(points) == 4:
pl.axis = (points[3].sub(points[0]).normalize())
else:
pl.axis = ((pl.u).cross(pl.v)).normalize()
except:
pass
p = pl.getPlacement()
del pl
return p