AGI STK Util 11 Send comments on this topic.
ConvertQuantity Method (IAgConversionUtility)
See Also  Example
DimensionName
FromUnit
ToUnit
FromValue





Description

Converts the specified quantity value from a given unit to another unit.

Syntax

[Visual Basic .NET]
Public Function ConvertQuantity( _
   ByVal DimensionName As String, _
   ByVal FromUnit As String, _
   ByVal ToUnit As String, _
   ByVal FromValue As Double _
) As Double

[C#]
public double ConvertQuantity(
string DimensionName,
string FromUnit,
string ToUnit,
double FromValue
);

[Managed C++]
public: double ConvertQuantity(
String __gc ^ DimensionName,
String __gc ^ FromUnit,
String __gc ^ ToUnit,
double FromValue
);

[Java]
public double convertQuantity(
String DimensionName,
String FromUnit,
String ToUnit,
double FromValue
);

[Unmanaged C++]
public: HRESULT ConvertQuantity(
BSTR DimensionName,
BSTR FromUnit,
BSTR ToUnit,
double FromValue,
double * ReturnValue
);

Parameters

DimensionName
FromUnit
ToUnit
FromValue

Example

Convert a quantity unit to another unit
[C#] Copy Code
IAgConversionUtility converter = root.ConversionUtility; 
 
// Old value in miles, new value in km 
double newValue = converter.ConvertQuantity("DistanceUnit""mi""km"1.0); 
 

Convert a quantity unit to another unit
[Visual Basic .NET] Copy Code
Dim converter As IAgConversionUtility = root.ConversionUtility

' Old value in miles, new value in km
Dim newValue As Double = converter.ConvertQuantity("DistanceUnit", "mi", "km", 1)

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1