Fixed the Center call for Shape objects on rotateAboutCenter, and changed CenterOfMass usage so that it won't fail silently.

This commit is contained in:
Jeremy Wright 2015-08-03 12:06:59 -04:00
parent 14262e744d
commit 6e70ad5e97
3 changed files with 6 additions and 5 deletions

BIN
.coverage

Binary file not shown.

View File

@ -685,7 +685,8 @@ class CQ(object):
endVec = Vector(axisEndPoint) endVec = Vector(axisEndPoint)
def _rot(obj): def _rot(obj):
startPt = obj.Center() # TODO: compute the weighted average instead of using the first solid
startPt = obj.Solids()[0].Center()
endPt = startPt + endVec endPt = startPt + endVec
return obj.rotate(startPt, endPt, angleDegrees) return obj.rotate(startPt, endPt, angleDegrees)

View File

@ -185,10 +185,10 @@ class Shape(object):
return BoundBox(self.wrapped.BoundBox) return BoundBox(self.wrapped.BoundBox)
def Center(self): def Center(self):
try: # try:
return Vector(self.wrapped.CenterOfMass) return Vector(self.wrapped.CenterOfMass)
except: # except:
pass # pass
def Closed(self): def Closed(self):
return self.wrapped.Closed return self.wrapped.Closed