STK UtilSend comments on this topic.
ConvertQuantity Method (IAgConversionUtility)
See Also
DimensionName
FromUnit
ToUnit
FromValue
Windows





Windows & Linux

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
);
[Unmanaged C++]
public: HRESULT ConvertQuantity(
    BSTR DimensionName,
    BSTR FromUnit,
    BSTR ToUnit,
    double FromValue,
    double * pToValue
);
[Java]
public double convertQuantity(
    String DimensionName,
    String FromUnit,
    String ToUnit,
    double FromValue
);
[Python - STK API ]
def ConvertQuantity(self, DimensionName:str, FromUnit:str, ToUnit:str, FromValue:float) -> float:

Parameters

DimensionName
FromUnit
ToUnit
FromValue

See Also

Example

Convert a quantity unit to another unit
[C#]
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]
Dim converter As IAgConversionUtility = root.ConversionUtility

' Old value in miles, new value in km
Dim newValue As Double = converter.ConvertQuantity("DistanceUnit", "mi", "km", 1)
© 2024 Analytical Graphics, Inc. All Rights Reserved.