- 积分
- 329
- 明经币
- 个
- 注册时间
- 2017-10-25
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
代码运行后,不能停止循环,按ESC也不行。
Public Sub CreateXH()
On Error Resume Next
Dim color As New AcadAcCmColor '设置颜色
color.ColorIndex = acGreen
Dim pt1 As Variant
Dim pt2(0 To 2) As Double
Dim textObj As AcadText
Dim num As Long
Dim i As Long
Dim height As Double
Dim radius As Double
Dim ptMin As Variant
Dim ptMax As Variant
Dim objCircle As AcadCircle
radius = 5
height = 5
num = 1
If KeyCode = vbKeyEscape Then
Exit Sub
End If
For num = num To 99999
If KeyCode = vbKeyEscape Then
Exit Sub
End If
pt1 = ThisDrawing.Utility.GetPoint(, "请指定点:")
Set textObj = ThisDrawing.ModelSpace.AddText(num, pt1, height)
textObj.TrueColor = color
textObj.GetBoundingBox ptMin, ptMax
pt2(0) = (ptMin(0) + ptMax(0)) / 2
pt2(1) = (ptMin(1) + ptMax(1)) / 2
pt2(2) = (ptMin(2) + ptMax(2)) / 2
Set objCircle = ThisDrawing.ModelSpace.AddCircle(pt2, radius)
objCircle.TrueColor = color
textObj.Update
Next
End Sub
|
|