AngleToString メソッド(ActiveX)

角度の実数値(倍精度浮動小数点数型)を文字列値に変換します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

RetVal = AngleToString(Angle, Unit, Precision)
object

タイプ: Utility

このメソッドが適用されるオブジェクト。

Angle

アクセス: 入力のみ

タイプ: 倍精度浮動小数点数型

角度の倍精度浮動小数点数値。

Unit

アクセス: 入力のみ

タイプ: acAngleUnits 列挙型

文字列の変換先の単位。

  • acDegrees
  • acDegreeMinuteSeconds
  • acGrads
  • acRadians
Precision

アクセス: 入力のみ

タイプ: 長整数型

角度の精度。0 から 8 までの整数。

戻り値(RetVal)

タイプ: 文字列

角度の文字列値。

注意

追加の注意はありません。

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))
)