我在VS2005中可以进行基于com的二次开发吗?引用过2007对象库后怎么还会提示AutoCAD.AcadApplication为未知类型。
例如: Dim AcadApp As AutoCAD.AcadApplication
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call 连接AutoCAD()
End Sub
Sub 连接AutoCAD()
On Error Resume Next
AcadApp = GetObject(, "Autodesk.AcadApplication")
If Err.Number Then
Err.Clear()
AcadApp = CreateObject("Autodesk.AcadApplication")
If Err.Number Then
MsgBox(Err.Number)
Exit Sub
End If
End If
AcadApp.Visible = True '界面可视
AppActivate(AcadApp.Caption) '显示AutoCAD界面
End Sub
End Class
错误 1 未定义类型“AutoCAD.AcadApplication”。
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
引用这两个类库
就可以看见com对象和提示了
可以直接定义
Dim acadApp As AcadApplication
Dim acadDoc As AcadDocument
用acadDoc来代替thisdrawing