Converts an angle as a string to a real (double) value.
Supported platforms: Windows only
VBA:
RetVal = AngleToReal(Angle, Unit)
Type: Utility
The object this method applies to.
Access: Input-only
Type: String
The angle as a string value.
Access: Input-only
Type: AcAngleUnits enum
The unit to which the string will be converted.
Type: Double
The angle as a real number.
No additional remarks.
VBA:
Sub Example_AngleToReal() ' This example passes several different strings representing ' an angle in different units to be converted to radians. Dim angAsStr As String Dim unit As Integer Dim angAsReal As Double ' Convert the angle given in degrees unit to a real angAsStr = "45" unit = acDegrees angAsReal = ThisDrawing.Utility.AngleToReal(angAsStr, unit) MsgBox "45 degrees converts to " & angAsReal & " radians.", , "AngleAsReal Example" ' Convert the angle given in degrees/minutes/seconds unit to Radians angAsStr = "45d0' 0""" unit = acDegreeMinuteSeconds angAsReal = ThisDrawing.Utility.AngleToReal(angAsStr, unit) MsgBox "45 degrees, 0 minutes, 0 seconds converts to " & angAsReal & " radians.", , "AngleAsReal Example" ' Convert the angle given in grads unit to Radians angAsStr = "50" unit = acGrads angAsReal = ThisDrawing.Utility.AngleToReal(angAsStr, unit) MsgBox "50 grads converts to " & angAsReal & " radians.", , "AngleAsReal Example" End Sub
Visual LISP:
(vl-load-com) (defun c:Example_AngleToReal() ;; This example passes several different strings representing ;; an angle in different units to be converted to radians. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Convert the angle given in degrees unit to a real (setq angAsStr "45" unit acDegrees angAsReal (vla-AngleToReal (vla-get-Utility doc) angAsStr unit)) (alert (strcat "45 degrees converts to " (rtos angAsReal 2) " radians.")) ;; Convert the angle given in degrees/minutes/seconds unit to Radians (setq angAsStr "45d0' 0\"" unit acDegreeMinuteSeconds angAsReal (vla-AngleToReal (vla-get-Utility doc) angAsStr unit)) (alert (strcat "45 degrees, 0 minutes, 0 seconds converts to " (rtos angAsReal 2) " radians.")) ;; Convert the angle given in grads unit to Radians (setq angAsStr "50" unit acGrads angAsReal (vla-AngleToReal (vla-get-Utility doc) angAsStr unit)) (alert (strcat "50 grads converts to " (rtos angAsReal 2) " radians.")) )