关于计算点和值 (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
|