- UID
- 309615
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-8-17
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我刚学vb,各位大虾请帮忙,错在哪了!!!!!!!
代码:
Public Sub 坐标标注()
Dim acadApp As AcadApplication
Dim i As Integer
Dim pt(0 To 3) As Double
Dim actext As AcadText
Dim acpoint As AcadPoint
Dim text As String
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
If Err Then
MsgBox Err.Description
Exit Sub
End If
acadApp.Visible = True
End If
' ÔËÐб¾¹ý³ÌÇ°£¬ÇëÏÈÑ¡¶¨ÐèÒª´¦ÀíµÄ×ø±êÊý¾Ý
With ActiveWindow.RangeSelection
For i = 1 To .Rows.Count
pt(0) = .Cells(i, 1)
pt(1) = .Cells(i, 2)
pt(2) = 0
text = pt(0) & "," & pt(1) & "," & pt(2)
' Set actext = acadApp.ActiveDocument.ModelSpace.Addtext(text, pt, 2)
Set acpoint = acadApp.ActiveDocument.ModelSpace.AddPoint(pt, 5)
Next
End With
End Sub |
|