AngleToReal 方法 (ActiveX)
将角度转换为字符串,转换为实数(双精度)值。 支持的平台:仅限 Windows 签名VBA: RetVal = AngleToReal(Angle, Unit)
返回值 (RetVal)类型:双 作为实数的角度。 言论没有其他评论。 例子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 可视化 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.")) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 11:59
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.