Skip to content

Commit

Permalink
Fixed box generation for small draft values
Browse files Browse the repository at this point in the history
  • Loading branch information
sanguinariojoe authored and wwmayer committed Jul 13, 2014
1 parent aa1c957 commit 3194d47
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Mod/Ship/shipHydrostatics/Tools.py
Expand Up @@ -216,8 +216,11 @@ def wettedArea(shape, draft, trim):
# Create the "sea" box
L = xmax - xmin
B = bbox.YMax - bbox.YMin
p = Vector(-1.5*L, -1.5*B, bbox.ZMin - 1.0)
box = Part.makeBox(3.0*L, 3.0*B, - bbox.ZMin + 1.0, p)
p = Vector(-1.5 * L, -1.5 * B, bbox.ZMin - 1.0)
try:
box = Part.makeBox(3.0 * L, 3.0 * B, - bbox.ZMin + 1.0, p)
except:
return 0.0

for f in shape.Faces:
try:
Expand Down Expand Up @@ -274,8 +277,11 @@ def FloatingArea(ship, draft, trim):
# Create the "sea" box
L = xmax - xmin
B = bbox.YMax - bbox.YMin
p = Vector(-1.5*L, -1.5*B, bbox.ZMin - 1.0)
box = Part.makeBox(3.0*L, 3.0*B, - bbox.ZMin + 1.0, p)
p = Vector(-1.5 * L, -1.5 * B, bbox.ZMin - 1.0)
try:
box = Part.makeBox(3.0 * L, 3.0 * B, - bbox.ZMin + 1.0, p)
except:
return [area, cf]

maxX = bbox.XMin / Units.Metre.Value
minX = bbox.XMax / Units.Metre.Value
Expand Down Expand Up @@ -368,8 +374,11 @@ def mainFrameCoeff(ship, draft):
# Create the "sea" box
L = xmax - xmin
B = bbox.YMax - bbox.YMin
p = Vector(-1.5*L, -1.5*B, bbox.ZMin - 1.0)
box = Part.makeBox(1.5*L + x, 3.0*B, - bbox.ZMin + 1.0, p)
p = Vector(-1.5 * L, -1.5 * B, bbox.ZMin - 1.0)
try:
box = Part.makeBox(1.5 * L, 3.0 * B, - bbox.ZMin + 1.0, p)
except:
return cm

maxY = bbox.YMin / Units.Metre.Value
minY = bbox.YMax / Units.Metre.Value
Expand Down

0 comments on commit 3194d47

Please sign in to comment.