- 积分
- 4761
- 明经币
- 个
- 注册时间
- 2008-8-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
Public Class Form1
Dim AutoCADApp As Object
Dim Thisdrawing As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If AutoCADApp Is Nothing Then
If Err.Number <> 0 Then Err.Clear()
AutoCADApp = GetObject(, "AutoCAD.Application")
If Err.Number <> 0 Then
Err.Clear()
Exit Sub
End If
Else
Thisdrawing = AutoCADApp.ActiveDocument()
'创建组
'**************************************************************************
Dim ObjGroup As Object
Dim Objentity() As Object
Dim InserMText As Object
ObjGroup = Thisdrawing.Groups.Add("*")
ReDim Objentity(0 To 3)
'**************************************************************************
Dim pt(0 To 2) As Double
With Thisdrawing.ModelSpace
For i = 0 To 3
pt(0) = 1 : pt(1) = 2 * i : pt(2) = 0
InserMText = .AddText(i, pt, 1)
Objentity(i) = InserMText
Next
ObjGroup.AppendItems(Objentity)
End With
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AutoCADApp = GetObject(, "AutoCAD.Application")
If Err.Number <> 0 Then
Err.Clear()
Exit Sub
End If
End Sub
End Class
运行到这句话就报警ObjGroup.AppendItems(Objentity)
|
|