AGI STK Util 11Send comments on this topic.
GetCurrentUnitAbbrv Method (IAgUnitPrefsDimCollection)
See Also  Example
IndexOrDimName
The index or dimension name
Windows






Windows & Linux

Description

Returns the Current Unit for a Dimension.

Syntax

[Visual Basic .NET]
Public Function GetCurrentUnitAbbrv( _
   ByVal IndexOrDimName As System.Object _
) As String
[C#]
public string GetCurrentUnitAbbrv(
   System.Object IndexOrDimName
);
[Managed C++]
public: String __gc ^ GetCurrentUnitAbbrv(
   VARIANT IndexOrDimName
);
[Java]
public String getCurrentUnitAbbrv(
   Variant IndexOrDimName
);
[Unmanaged C++]
public: HRESULT GetCurrentUnitAbbrv(
   VARIANT IndexOrDimName,
   BSTR * ReturnValue
);

Parameters

IndexOrDimName
The index or dimension name

Return Type

Returns the current unit abbreviation for the given index.

Example

[Visual Basic .NET]Copy Code
Dim oSTK As Object
Dim oStkObjectRoot As AGI.STKObjects.AgStkObjectRoot
Dim distanceUnit As String

Dim oType As Type = Type.GetTypeFromProgID("STK.Application")
oSTK = Activator.CreateInstance(oType)

oStkObjectRoot = oSTK.GetType().InvokeMember( _
                                        "Personality2", _
                                        System.Reflection.BindingFlags.GetProperty, _
                                        Nothing, _
                                        oSTK, _
                                        Nothing)

distanceUnit = oStkObjectRoot.UnitPreferences.GetCurrentUnitAbbrv("DistanceUnit")

MessageBox.Show(distanceUnit)

oStkObjectRoot = Nothing
oSTK = Nothing
Get a current unit preference
[C#]Copy Code
// DistanceUnit 
string dimensionName = "Distance"
string unitAbbreviation = root.UnitPreferences.GetCurrentUnitAbbrv(dimensionName); 
 

Get a current unit preference
[Visual Basic .NET]Copy Code
' DistanceUnit
Dim dimensionName As String = "Distance"
Dim unitAbbreviation As String = root.UnitPreferences.GetCurrentUnitAbbrv(dimensionName)

See Also

© 2018 Analytical Graphics, Inc. All Rights Reserved.