Excel function for table of offsets
I have been working with a builder used to read table of offsets on the format 0-0-0+ (foot-inches-eights-plus/minus 1/16th) which make sense for me as well.
I’m using Rhino for modeling the hulls and Orca3D plugin function to generate the table of offset, that is pretty handy. The problem is that Orca3D gives me the offsets as decimals. For instance, its output is 4.966 inches when what I want is 0-4-7+.
I don’t want to convert value per value so I created an excel function to do it for me, you can find it bellow. Feel free to use it at your own risk.
How to use that on Excel?
1) Alt+F11
2) Insert | Module
3) Paste the code bellow, save and close
4) A new function called "Offsets" will be available on excel
Function Offsets(pValue As Double) As String
Dim vSixteen As String
'Retrieve the input value, spect in inches
vInches_input = Round(pValue, 4)
vFeet_db = vInches_input / 12
vFeet_int = Int(vFeet_db)
vInches_db = vInches_input - (vFeet_int * 12)
vInches_int = Int(vInches_db)
vEights_db = (vInches_db - vInches_int) / (1 / 8)
vSixteen_db = vEights_db - Int(vEights_db)
vEights_int = Int(vEights_db)
If vSixteen_db > 0.25 And vSixteen_db <= 0.75 Then
vSixteen = "+"
ElseIf vSixteen_db > 0.75 Then
vEights_int = vEights_int + 1
vSixteen = ""
Else
vSixteen = ""
End If
If vEights_int = 8 Then
''MsgBox vInches_int
vInches_int = vInches_int + 1
''MsgBox vInches_int
vEights_int = 0
If vInches_int = 12 Then
vFeet_int = vFeet_int + 1
vInches_int = 0
End If
End If
Offsets = vFeet_int & "-" & vInches_int & "-" & vEights_int & vSixteen
End Function