Fixed bad bounds calculation when several surfaces have been selected

This commit is contained in:
Jose Luis Cercós pita 2012-01-29 19:43:35 +01:00
parent 70636dfe14
commit 58dc011e38

View File

@ -138,17 +138,29 @@ class TaskPanel:
# Get bounds # Get bounds
bounds = [0.0, 0.0, 0.0] bounds = [0.0, 0.0, 0.0]
bbox = self.faces[0].BoundBox bbox = self.faces[0].BoundBox
bounds[0] = bbox.XLength minX = bbox.XMin
bounds[1] = bbox.YLength maxX = bbox.XMax
bounds[2] = bbox.ZLength minY = bbox.YMin
maxY = bbox.YMax
minZ = bbox.ZMin
maxZ = bbox.ZMax
for i in range(1,len(self.faces)): for i in range(1,len(self.faces)):
bbox = self.faces[i].BoundBox bbox = self.faces[i].BoundBox
if bounds[0] < bbox.XLength: if minX > bbox.XMin:
bounds[0] = bbox.XLength minX = bbox.XMin
if bounds[1] < bbox.YLength: if maxX < bbox.XMax:
bounds[1] = bbox.YLength maxX = bbox.XMax
if bounds[2] < bbox.ZLength: if minY > bbox.YMin:
bounds[2] = bbox.ZLength minY = bbox.YMin
if maxY < bbox.YMax:
maxY = bbox.YMax
if minZ > bbox.ZMin:
minZ = bbox.ZMin
if maxZ < bbox.ZMax:
maxZ = bbox.ZMax
bounds[0] = maxX - minX
bounds[1] = maxY - minY
bounds[2] = maxZ - minZ
# Set UI fields # Set UI fields
self.form.length.setMaximum(bounds[0]) self.form.length.setMaximum(bounds[0])
self.form.length.setValue(bounds[0]) self.form.length.setValue(bounds[0])