CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2024 开发者帮助

关于计算点和值 (ActiveX)

2024-5-18 19:06| 发布者: admin| 查看: 155| 评论: 0|原作者: admin|来自: AutoCAD

关于计算点和值 (ActiveX)

通过使用对象提供的方法,可以快速解决数学问题或在图形上定位点。Utility

通过对对象使用方法,可以执行以下操作:Utility

  • 使用以下方法求出一条线与 X 轴的角度AngleFromXAxis
  • 使用以下方法将角度转换为字符串实数(双精度)值AngleToReal
  • 使用以下方法将角度从实数(双精度)值转换为字符串AngleToString
  • 使用以下方法将字符串的距离转换为实数(双精度)值DistanceToReal
  • 使用以下方法创建一个包含整数、浮点数、双精度数等数组的变体CreateTypedArray
  • 使用以下方法找到与给定点的指定角度和距离的点PolarPoint
  • 使用以下方法将点从一个坐标系平移到另一个坐标系TranslateCoordinates
  • 查找用户使用该方法输入的两点之间的距离GetDistance

使用 GetDistance 方法查找两点之间的距离

此示例使用该方法获取点坐标,并使用函数显示计算出的距离。GetDistanceMsgBox

AutoLISP
(vl-load-com)
(defun c:Ch3_GetDistanceBetweenTwoPoints()
    (setq acadObj (vlax-get-acad-object)
          doc (vla-get-ActiveDocument acadObj)
          utilityObj (vla-get-Utility doc))

    ;; Return the value entered by user. A prompt is provided.
    (setq returnDist (vla-GetDistance utilityObj nil "\nPick two points: "))
    (alert (strcat "The distance between the two points is: " (rtos returnDist 2)))
)
VBA(仅限 AutoCAD)
Sub Ch3_GetDistanceBetweenTwoPoints()
  Dim returnDist As Double

  ' Return the value entered by user. A prompt is provided.
  returnDist = ThisDrawing.Utility.GetDistance(, "Pick two points: ")
  MsgBox "The distance between the two points is: " & returnDist
End Sub

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2025-3-14 06:03

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部