Hydrostatics Command Scripting Reference
Orca3D's hydrostatics command can be scripted using Rhino's command scripting, and also using RhinoScript. Below the syntax of the command scripting is given, followed by an example RhinoScript that uses the OrcaHydrostatics command to compute and report the hydrostatics of a hull that is created with a hull wizard.
Command Name: OrcaHydrostatics
Notes:
| 1. | Must have one or more surface/polysurface/mesh objects selected |
| 2. | Lists of values use standard Orca3D list syntax; e.g. 0,10,…,180 |
| 3. | The decimal separator must be a dot "." and the list separator must be the comma "," |
Command Options:
Description – a string description of the hydrostatics analysis
LoadCases – define the loading condition options for the hydrostatics analysis
SinkageOptions – define the sinkage options for the hydrostatics analysis
SpecifySinkage – a list of sinkage values for the analysis; a loading condition and subsequent hydrostatics computation will be performed for each sinkage value listed
SpecifyWeight– a list of weight values for the analysis; a loading condition and subsequent hydrostatics computation will be performed for each weight value listed
TrimOptions – define the trim options for the hydrostatics analysis
SpecifyTrim– a list of trim values for the analysis; a loading condition and subsequent hydrostatics computation will be performed for each trim value listed
SpecifyLCG– a list of LCG values for the analysis; a loading condition and subsequent hydrostatics computation will be performed for each LCG value listed
HeelOptions – define the heel options for the hydrostatics analysis
SpecifyHeel– a list of heel values for the analysis; a loading condition and subsequent hydrostatics computation will be performed for each heel value listed
SpecifyTCG– a list of TCG values for the analysis; a loading condition and subsequent hydrostatics computation will be performed for each TCG value listed
VCG – a list of vertical VCG coordinate values for the analysis; a loading condition and subsequent hydrostatics computation will be performed for each VCG value listed; VCG values are optional for analyses where a fixed trim angle or heel angle is specified; if entered in these optional cases, they will be used to compute GM
Mirror – Yes if the selected geometry must be mirrored about the centerplane for the hydrostatics analysis
TransformModel – Yes if the selected geometry is to be transformed to the resultant flotation plane; otherwise No (this option cannot be Yes if AddPlane=Yes)
AddPlane – Yes if a plane surface should be added for each loading condition; otherwise No (this option cannot be Yes if TransformModel=Yes)
InitialHeight – a floating point value defining the vertical coordinate at which to start the flotation plane iteration; this value is only meaningful for free float computations
RightingArms – define the righting arm options for the hydrostatics analysis
Compute – Yes to compute righting arm(s) at specified heel angle(s); otherwise No
HeelAngles – a sorted list of comma-separated heel angles at which to compute righting arms
WriteToCSV - Yes to export a comma-separated-value (CSV) file containing the output from the hydrostatics calculation
Enter CSV filename <Hydrostatics.csv>
Sample Macro: (note that copying and pasting this sample into Rhino may not work, since some characters may not be correctly copied)
-_New n
-_DocumentProperties u u e n enter enter
-_OrcaCreateSailboat LengthOnDeck 10 BeamOnDeck 3 TransomBeamRatio 0.9 StemDeckHeight 1 TransomDeckHeight 0.9 TransomHeight 0 Draft 0.5 StemRake 20 TransomRake 10 SheerHeightRatio 0.9 SheerHeightPos 0.5 DeckBeamPos 0.5 DraftPos 0.5 SectionFullnessFactor 0 BilgeTurnFactor 0.5 ForefootShape 0.5 NumberRows 6 NumberCols 7 enter
-_SelAll
-_OrcaHydrostatics Mirror=Yes Description "Sample Sailboat Hydrostatics Macro" WriteToCSV=Yes "hydrostatics.csv" enter
Sample Script: (note that copying and pasting this sample into Rhino may not work, since some characters may not be correctly copied; a copy is located in the Sample Data subfolder of the Orca3D installation folder (normally C:\Program Files\Orca3D\Sample Data)
'--------------------------------------------------------------------------------
' Sample script demonstrating Orca3D hydrostatics
' Created By: Larry Leibman, DRS Defense Solutions Advanced Technology Center
' Date: 5/31/2011
' Revision: 1.2
'--------------------------------------------------------------------------------
Option Explicit
' Start a new model, Set document properties, create a sailboat hull
Rhino.Command "-_New n"
Rhino.Command "-_DocumentProperties u u e n enter enter"
Rhino.Command "-_OrcaCreateSailboat LengthOnDeck 10 BeamOnDeck 3 TransomBeamRatio 0.9 StemDeckHeight 1 TransomDeckHeight 0.9 TransomHeight 0" + _
" Draft 0.5 StemRake 20 TransomRake 10 SheerHeightRatio 0.9 SheerHeightPos 0.5 DeckBeamPos 0.5 DraftPos 0.5" + _
" Deadrise 0 Flare 0 SectionTightness 0.5 ForefootShape 0.5 NumberRows 6 NumberCols 7 enter"
' Select model geometry
Call SelectModelGeometry
' Create sections
Rhino.Command "-_OrcaSections Stations Add 0,.5,...,10.5 enter enter enter"
' Re-Select all surface, polysurface And mesh objects
Call SelectModelGeometry
' Compute hydrostatics
Rhino.Command "-_OrcaHydrostatics Mirror=Yes Description ""Sample Hydrostatics Upright"" " + _
"LoadCase SinkageOptions SpecifySinkage 0.15 TrimOptions SpecifyTrim 0 HeelOptions SpecifyHeel 0 VCG 0" + _
" enter RightingArms Compute=No HeelAngles 0,10,...,180 enter enter"
'Rhino.Command "-_OrcaHydrostatics Description ""Sample Hydrostatics Free-Float with Righting Arms"" " + _
' "LoadCases SinkageOptions SpecifyWeight 6400 TrimOptions SpecifyLCG 5 HeelOptions SpecifyTCG 0 VCG 0 enter " + _
' "RightingArms Compute=Yes HeelAngles 0,5,...,180 enter Mirror=Yes TransformModel=No AddPlane=Yes InitialHeight=0.25 enter"
'Rhino.Command "-_OrcaHydrostatics Description ""Initial Hydrostatics"" LoadCases SinkageOptions SpecifyWeight 6400" + _
' " TrimOptions SpecifyLCG 5 HeelOptions SpecifyTCG 0 VCG 0 enter RightingArms Compute=No HeelAngles 0,5,...,180" + _
' " enter Mirror=Yes TransformModel=No AddPlane=No InitialHeight=0.25 enter"
' Retrieve
On Error Resume Next
Dim orcaPlugIn
Set orcaPlugIn = Rhino.GetPluginObject("Orca3D")
Dim hydrostaticsList
If Not IsNull(orcaPlugIn) Then
hydrostaticsList = orcaPlugIn.MostRecentStabilityResults
End If
' Print hydrostatics
Dim output,i
Dim hydrostatics, hydrostaticsArray
output = ""
If hydrostaticsList <> Nothing And IsArray(hydrostaticsList) Then
For Each hydrostatics In hydrostaticsList
output = output & VbCrLf + VbCrLf + HydrostaticsString(hydrostatics)
Next
End If
Rhino.TextOut output
'----------------------------------------------------------------------------
' Subroutine to select all surfaces, polysurfaces, and meshes in the model
'----------------------------------------------------------------------------
Sub SelectModelGeometry()
' Select all surface, polysurface And mesh objects
Rhino.Command "-_SelSrf"
Rhino.Command "-_SelPolySrf"
Rhino.Command "-_SelMesh"
End Sub
'------------------------------------------------------------------------------------
' Function to retrieve a string representation of hydrostatics results.
'------------------------------------------------------------------------------------
Function HydrostaticsString(hydrostatics)
HydrostaticsString = CStr(hydrostatics.AnalysisDescription) + VbCrLf + _
CStr(hydrostatics.When) + VbCrLf + _
"Lwl = " + CStr(hydrostatics.Lwl) + VbCrLf + _
"Bwl = " + CStr(hydrostatics.Bwl) + VbCrLf + _
"Draft = " + CStr(hydrostatics.Draft) + VbCrLf + _
"Loa = " + CStr(hydrostatics.Loa) + VbCrLf + _
"Boa = " + CStr(hydrostatics.Boa) + VbCrLf + _
"Depth = " + CStr(hydrostatics.Depth) + VbCrLf + _
"LCB = " + CStr(hydrostatics.LCB) + VbCrLf + _
"TCB = " + CStr(hydrostatics.TCB) + VbCrLf + _
"VCB = " + CStr(hydrostatics.VCB) + VbCrLf + _
"LCF = " + CStr(hydrostatics.LCF) + VbCrLf + _
"TCF = " + CStr(hydrostatics.TCF) + VbCrLf + _
"VCF = " + CStr(hydrostatics.VCF) + VbCrLf + _
"Displacement = " + CStr(hydrostatics.Displacement) + VbCrLf + _
"Volume = " + CStr(hydrostatics.Volume) + VbCrLf + _
"Wet Area = " + CStr(hydrostatics.WetArea) + VbCrLf + _
"Sinkage = " + CStr(hydrostatics.Sinkage) + VbCrLf + _
"Trim = " + CStr(hydrostatics.Trim) + VbCrLf + _
"List = " + CStr(hydrostatics.List) + VbCrLf + _
"Cb = " + CStr(hydrostatics.Cb) + VbCrLf + _
"Cx = " + CStr(hydrostatics.Cx) + VbCrLf + _
"Cp = " + CStr(hydrostatics.Cp) + VbCrLf + _
"Cvp = " + CStr(hydrostatics.Cvp) + VbCrLf + _
"Cwp = " + CStr(hydrostatics.Cwp) + VbCrLf + _
"Cws = " + CStr(hydrostatics.Cws)
End Function