AGI STK Util 11 Send comments on this topic.
IAgQuantity Interface





Description

Provides helper methods for a quantity.

Public Methods

Public Method Add Adds the value from the IAgQuantity interface to this interface. Returns a new IAgQuantity. The dimensions must be similar.
Public Method ConvertToUnit Changes the value in this quantity to the specified unit.
Public Method DivideQty Divides the value from the IAgQuantity interface to this interface. The dimensions must be similar.
Public Method MultiplyQty Multiplies the value from the IAgQuantity interface to this interface. Returns a new IAgQuantity. The dimensions must be similar.
Public Method Subtract Subtracts the value from the IAgQuantity interface to this interface. Returns a new IAgQuantity. The dimensions must be similar.

Public Properties

Public Property Dimension Gets the name of the dimension
Public Property Unit The current Unit abbreviation.
Public Property Value The current value.

Example

Calculate quantity addition (with IAgQuantity)
[C#] Copy Code
// Create a quantity representing a 3.1 mile/ 5 km fun run race 
IAgQuantity  race3mi = root.ConversionUtility.NewQuantity("Distance""mi"3.1); 
IAgQuantity  race5km = root.ConversionUtility.NewQuantity("Distance""km"5); 
 
// Add the two 3.1 mile/ 5 km runs 
IAgQuantity race10km = race5km.Add(race3mi); 
Console.Write("The {0} {1} race is also called a ", race10km.Value, race10km.Unit); 
 
// Convert 10k run to 6.2 mile run internally within the quantity 
race10km.ConvertToUnit("mi"); 
Console.WriteLine("{0} {1} race", race10km.Value, race10km.Unit); 
 

Calculate quantity addition (with IAgQuantity)
[Visual Basic .NET] Copy Code
' Create a quantity representing a 3.1 mile/ 5 km fun run race
Dim race3mi As IAgQuantity = root.ConversionUtility.NewQuantity("Distance", "mi", 3.1)
Dim race5km As IAgQuantity = root.ConversionUtility.NewQuantity("Distance", "km", 5)

' Add the two 3.1 mile/ 5 km runs
Dim race10km As IAgQuantity = race5km.Add(race3mi)
Console.Write("The {0} {1} race is also called a ", race10km.Value, race10km.Unit)

' Convert 10k run to 6.2 mile run internally within the quantity
race10km.ConvertToUnit("mi")
Console.WriteLine("{0} {1} race", race10km.Value, race10km.Unit)

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1