AGI STK Util 11 Send comments on this topic.
SetCurrentUnit Method (IAgUnitPrefsDimCollection)
See Also  Example
Dimension
The dimension to set the current unit.
UnitAbbrv
The unit abbreviation to set the current dimension's unit to.





Description

Method to set unit preferences.

Syntax

[Visual Basic .NET]
Public Sub SetCurrentUnit( _
   ByVal Dimension As String, _
   ByVal UnitAbbrv As String _
) 

[C#]
public void SetCurrentUnit(
string Dimension,
string UnitAbbrv
);

[Managed C++]
public: void SetCurrentUnit(
String __gc ^ Dimension,
String __gc ^ UnitAbbrv
);

[Java]
public  setCurrentUnit(
String Dimension,
String UnitAbbrv
);

[Unmanaged C++]
public: HRESULT SetCurrentUnit(
BSTR Dimension,
BSTR UnitAbbrv
);

Parameters

Dimension
The dimension to set the current unit.
UnitAbbrv
The unit abbreviation to set the current dimension's unit to.

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)

oStkObjectRoot.UnitPreferences.SetCurrentUnit("DistanceUnit", "m")

oStkObjectRoot = Nothing
oSTK = Nothing
Set a current unit preference
[C#] Copy Code
// DistanceUnit 
root.UnitPreferences.SetCurrentUnit("Distance""m"); 
 

Set a current unit preference
[Visual Basic .NET] Copy Code
' DistanceUnit
root.UnitPreferences.SetCurrentUnit("Distance", "m")

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1