CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2018 开发者帮助

AngleToReal 方法 (ActiveX)

2024-5-18 16:53| 发布者: admin| 查看: 74| 评论: 0|原作者: admin|来自: AutoCAD

AngleToReal 方法 (ActiveX)

将角度转换为字符串,转换为实数(双精度)值。

支持的平台:仅限 Windows

签名

VBA:

RetVal = AngleToReal(Angle, Unit)
对象

类型: 实用程序

此方法应用到的对象。

角度

访问:仅输入

类型:字符串

以字符串值表示的角度。

单位

访问:仅输入

类型:枚举AcAngleUnits

字符串将转换为的单位。

  • acDegrees
  • acDegreeMinuteSeconds
  • acGrads
  • acRadians

返回值 (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."))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-15 11:59

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部