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






Windows & Linux

Description

Method to set unit preferences.

Syntax

[Visual Basic .NET]
Public Sub SetCurrentUnit( _
    ByVal Dimension As String, _
    ByVal UnitAbbrv As String _
) As 
[C#]
public void SetCurrentUnit(
    string Dimension,
    string UnitAbbrv
);
[Managed C++]
public: void SetCurrentUnit(
    String __gc ^ Dimension,
    String __gc ^ UnitAbbrv
);
[Java]
public void 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.

See Also

Example

[Visual Basic .NET]
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#]
// DistanceUnit
root.UnitPreferences.SetCurrentUnit("Distance", "m");
Set a current unit preference
[Visual Basic .NET]
' DistanceUnit
root.UnitPreferences.SetCurrentUnit("Distance", "m")
© 2019 Analytical Graphics, Inc. All Rights Reserved.