# How can I get the DEPTH value of hull in Maxsurf Modeler?

I want to get the Depth value of the vessel. How do I get it in Maxsurf Modeler?

Note: I tried setting a ridiculously large DWL value as Reference and obtaining the Immersed Depth value from Hydrostatics. But this is not providing the actual depth of the vessel.

Parents
Children
• Ah - automation makes it trickier still!

One method would be to look at the control point locations, this may be indicative however it won't be accurate because:

- The control points don't lie on the surface

- The surfaces may be trimmed

Alternatively (and it would be slow) you could adjust the Frame of Reference DWL and calculate the hydrostatics. You could iterate on the lower bound at which the TpC is non-zero, and the upper bound where TpC is non-zero. The distance in between would be the hull depth.

Code to look at the difference between the highest and lowest CP would be:

==============

Dim msApp As New BentleyModeler.Application

Sub CalculateDistanceBetweenHighestAndLowestCP()

tIn = VBA.Timer

a = GetDepth

tOut = VBA.Timer

Debug.Print a & " :: time taken = " & tOut - tIn

End Sub

Function GetDepth() As Double

Dim ss As Surface
Dim rowCount As Long
Dim colCount As Long
Dim coord(1 To 3) As Double

Dim hMax As Double
Dim hMin As Double

hMax = -10000 'initialise these variables to be far beyond the model
hMin = 10000

For Each ss In msApp.Design.Surfaces

'if you only want the visible surfaces (to exclude SS etc then you could add a line about;
'If ss.Visible = True Then

ss.ControlPointLimits rowCount, colCount

For r = 1 To rowCount
For c = 1 To colCount

ss.GetControlPoint r, c, coord(1), coord(2), coord(3)

If coord(3) > hMax Then
hMax = coord(3)
End If

If coord(3) < hMin Then
hMin = coord(3)
End If

Next
Next

Next

Depth = hMax - hMin

GetDepth = Depth

End Function

Answer Verified By: Rounak Niloy

• Hi James,
This might be an effective approach to solve my problem. I will incorporate this one.

Thanks