Converts an angle from a real (double) value to a string.
Supported platforms: Windows only
VBA:
RetVal = AngleToString(Angle, Unit, Precision)
Type: Utility
The object this method applies to.
Access: Input-only
Type: Double
The angle as a double value.
Access: Input-only
Type: AcAngleUnits enum
The unit to which the string will be converted.
Access: Input-only
Type: Long
The precision of the angle. An integer between 0 and 8.
Type: String
The angle as a string.
No additional remarks.
VBA:
Sub Example_AngleToString()
' This example converts a radian value to several different
' strings representing the value in different units.
Dim angAsRad As Double
Dim unit As Integer
Dim precision As Long
Dim angAsString As String
angAsRad = 0.785398163397448
unit = acDegrees
precision = 6
' Convert the radian value to degrees with a precision of 6
angAsString = ThisDrawing.Utility.AngleToString(angAsRad, unit, precision)
MsgBox "0.785398163397448 radians = " & angAsString & " degrees", , "AngleAsString Example"
' Convert the radian value to degrees/Minutes/Seconds with a precision of 6
unit = acDegreeMinuteSeconds
angAsString = ThisDrawing.Utility.AngleToString(angAsRad, unit, precision)
MsgBox "0.785398163397448 radians = " & angAsString, , "AngleAsString Example"
' Convert the radian value to grads with a precision of 6
unit = acGrads
angAsString = ThisDrawing.Utility.AngleToString(angAsRad, unit, precision)
MsgBox "0.785398163397448 radians = " & angAsString, , "AngleAsString Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_AngleToString()
;; This example converts a radian value to several different
;; strings representing the value in different units.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq angAsRad 0.785398163397448
unit acDegrees
precision 6)
;; Convert the radian value to degrees with a precision of 6
(setq angAsString (vla-AngleToString (vla-get-Utility doc) angAsRad unit precision))
(alert (strcat "0.785398163397448 radians = " angAsString))
;; Convert the radian value to degrees/Minutes/Seconds with a precision of 6
(setq unit acDegreeMinuteSeconds)
(setq angAsString (vla-AngleToString (vla-get-Utility doc) angAsRad unit precision))
(alert (strcat "0.785398163397448 radians = " angAsString))
;; Convert the radian value to grads with a precision of 6
(setq unit acGrads)
(setq angAsString (vla-AngleToString (vla-get-Utility doc) angAsRad unit precision))
(alert (strcat "0.785398163397448 radians = " angAsString))
)