From 58dc011e3891b001c2aebae86c946e05f256b188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Luis=20Cerc=C3=B3s=20pita?= Date: Sun, 29 Jan 2012 19:43:35 +0100 Subject: [PATCH] Fixed bad bounds calculation when several surfaces have been selected --- src/Mod/Ship/shipCreateShip/TaskPanel.py | 30 +++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/Mod/Ship/shipCreateShip/TaskPanel.py b/src/Mod/Ship/shipCreateShip/TaskPanel.py index ad995a175..e56827df4 100644 --- a/src/Mod/Ship/shipCreateShip/TaskPanel.py +++ b/src/Mod/Ship/shipCreateShip/TaskPanel.py @@ -138,17 +138,29 @@ class TaskPanel: # Get bounds bounds = [0.0, 0.0, 0.0] bbox = self.faces[0].BoundBox - bounds[0] = bbox.XLength - bounds[1] = bbox.YLength - bounds[2] = bbox.ZLength + minX = bbox.XMin + maxX = bbox.XMax + minY = bbox.YMin + maxY = bbox.YMax + minZ = bbox.ZMin + maxZ = bbox.ZMax for i in range(1,len(self.faces)): bbox = self.faces[i].BoundBox - if bounds[0] < bbox.XLength: - bounds[0] = bbox.XLength - if bounds[1] < bbox.YLength: - bounds[1] = bbox.YLength - if bounds[2] < bbox.ZLength: - bounds[2] = bbox.ZLength + if minX > bbox.XMin: + minX = bbox.XMin + if maxX < bbox.XMax: + maxX = bbox.XMax + if minY > bbox.YMin: + 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 self.form.length.setMaximum(bounds[0]) self.form.length.setValue(bounds[0])