CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

AngleToString Method (ActiveX)

2023-1-4 11:53| 发布者: admin| 查看: 508| 评论: 0|来自: AutoCAD

摘要: 将角度从实数(双精度)值转换为字符串。

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

支持的平台:仅窗口

签名

工 务 局:

RetVal = AngleToString(Angle, Unit, Precision)
对象

类型:实用工具

此方法适用的对象。

角度

访问:仅输入

类型:

作为双精度值的角度。

单位

访问:仅输入

类型:枚举AcAngleUnits

字符串将转换为的单位。

  • acDegrees
  • acDegreeMinuteSeconds
  • acGrads
  • acRadians
精度

访问:仅输入

类型:

角度的精度。介于 0 和 8 之间的整数。

返回值(RetVal)

类型:字符串

作为字符串的角度。

言论

没有额外的评论。

例子

工 务 局:

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

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 05:23

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部