Alright I messed about with this a bit. Here is the code I used for testing.
Dim Height As Double = tank_id
Dim Width As Double = tank_height
Dim HeightString As String = CStr(Height)
Dim WidthString As String = CStr(Width)
Dim HeightParam As Inventor.Parameter = ThisApplication.ActiveDocument.componentDefinition.Parameters.Item("tank_id")
Dim WidthParam As Inventor.Parameter = ThisApplication.ActiveDocument.componentDefinition.Parameters.Item("tank_height")
HeightParam.Precision = 3 'I wish this worked to control the decimals displayed from either the expression or value.
WidthParam.Precision = 3
Dim HeightSubString As String() = HeightParam.Expression.Split(" "c)
Dim WidthSubString As String() = WidthParam.Expression.Split(" "c)
Logger.Info("Height blue value: " & tank_id & " Height double: " & Height & " Height String: " & HeightString & " Height param expression: " & HeightParam.Expression & " Height param value direct: " & HeightParam.Value / 2.54 & " Height substring: " & HeightSubString(0))
Logger.Info("Width blue value: " & tank_height & " Widdth double: " & Width & " Width String: " & WidthString & " Width param expression: " & WidthParam.Expression & " Width param value direct: " & HeightParam.Value / 2.54 & " Width substring: " & WidthSubString(0))
Log result:
INFO| Height blue value: 120.5 Height double: 120.5 Height String: 120 Height param expression: 120.50 in Height param value direct: 120.5 Height substring: 120.50
INFO| Width blue value: 120.5 Width double: 120.5 Width String: 120 Width param expression: 120.50 in Width param value direct: 120.5 Width substring: 120.50
It looks like the expression will contain exactly what you're looking for, the downside is it also contains the unit value. This is where I then split the strings to remove the "in" unit.
Watch there be line a single line solution one of these wizards has used.