- 积分
- 82
- 明经币
- 个
- 注册时间
- 2012-3-5
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2012-7-4 12:39:39
|
显示全部楼层
Sub 计算距离()
On Error GoTo NoSelect
With ThisDrawing
Do
Dim a As Variant, b As Variant, charudian As Variant
a = .Utility.GetPoint(, "请选择点A"): b = .Utility.GetPoint(, "请选择点B"):
distance = Int(Abs(Sqr((a(0) - b(0)) ^ 2 + (a(1) - b(1)) ^ 2)) + 1)
charudian = .Utility.GetPoint(, "请选择插入点")
Set txt = .ModelSpace.AddText(distance, charudian, 1.5)
If Abs(a(0) - b(0)) < 1 Then
txt.Rotation = 1.57
ElseIf Abs(a(1) - b(1)) < 1 Then
txt.Rotation = 0
End If
txt.color = acWhite
Loop While err.Number = 0
End With
NoSelect:
err.Clear
End Sub
高手莫笑 菜鸟编程 |
|