V-lines, calculated in GHS, displayed in Rhino3D
A GHS runfile will allow the calculation of the “V-lines” (for example as per regulation DDS-079), including the automatic generation of a Rhino3D script, which will conveniently represent the V-lines (in fact V-planes) into the Rhino3D graphical environment.
A few remarks:
- The run file uses the new “SET-free” variable syntax, so a recent version of GHS is required (v18.30 or more recent recommended): https://www.ghsport.com/cows/186/
- it produced a TXT file containing the Rhino script. This script can simply be copy-pasted into Rhino3D.
- Each Vplane is stored on a separate Rhino layer, which name is automatically inherited from the damage case number in GHS.
- GHS system variable RANDOM is used to compose a random RGB color code for each V-plane being generated in Rhino3D
The GHS runfile is available here below:
` V-Lines as per DDS 079
`NDAR SD 21 Aug 2022
clear | clear all
PROJECT OFF
PROJECT VLINES
REPORT
read ship70.gf1
LBP 0 83F
DRAFT 4
SOLVE WEIGHT LCG
VCG 5
SOLVE
MACRO ROLLBACK
`This run file will calculate the rollback angle based on the full load
`of the vessel using the curve in DDS079.
VARIABLE RB, C0, C1, C2, C3, C4, C5, C6, C7, RB
C0:= 1.4907884252E-32
C1:= 4.9942187703E-27
C2:= -6.8531608058E-22
C3:= 4.986192232E-17
C4:= -2.0937306018E-12
C5:= 5.2762460891E-08
C6:= -8.4876784979E-04
C7:= 13.96008549
`CALCULATES THE ROLLBACK ANGLE FROM A 7TH ORDER POLYNOMIAL
RB:= DISPL^7 * C0 + DISPL^6 * C1 + DISPL^5 * C2 + DISPL^4 * C3 + DISPL^3 * C4 + DISPL^2 * C5 + DISPL * C6 + C7
/
.ROLLBACK
VARIABLE CASENUM
MACRO V-LINES
SET CASENUM = "Damage case Compartment %1"
PART COMP%1.C
TYPE FLOODED
SOLVE
STATUS
HEEL 15
HEEL *+{RB} `Add rollback angle to heel 15deg
FIX HEEL
SOLVE
DEPTH *+1.22
v X1 Y1 Z1 X2 Y2 Z2 X3 Y3 Z3 X4 Y4 Z4
DRLOC8:= {TENDA}
X1:= -{TENDA}
Y1:= 0
Z1:= {DRVALU}
X2:= -{TENDA}
Y2:= {WOA}/2
Z2:= {DRVALU} + {Y2}*tan({HEEL})
DRLOC8:= {TENDF}
X3:= -{TENDF}
Y3:= 0
Z3:= {DRVALU}
X4:= -{TENDF}
Y4:= {WOA}/2
Z4:= {DRVALU} + {Y4}*tan({HEEL})
v RR,GG,BB `Use random variable to create a random RGB color code
RR:=trunc(random*255)
GG:=trunc(random*255)
BB:=trunc(random*255)
`Below set of MESSAGE commands will produce Rhino script: create layer, set layer color, set to current, then create the "V-line" surface + its mirror image.
MESSAGE -_layer New "VLINES::{CASENUM}" enter -_layer color "VLINES::{CASENUM}" {RR},{GG},{BB} -_layer current "VLINES::{CASENUM}" enter
MESSAGE -_srfpt {X1},{Y1},{Z1}
MESSAGE {X2},{Y2},{Z2}
MESSAGE {X4},{Y4},{Z4}
MESSAGE {X3},{Y3},{Z3}
MESSAGE -_sellast enter
MESSAGE -_mirror xaxis enter
MESSAGE
VARY HEEL
TYPE (*) INTACT
/
MESSAGE (REPORT) VLINES-toRhino.TXT
.V-LINES (8 1) 1 `Macro executed 8 times. Dummy parameter %1 initally set to 1, and incrementing up 1.
MESSAGE (REPORT) OFF
REPORT OFF
erase {project}.pf
EDIT VLINES-toRhino.TXT /spawn