首先打开vsto,创建窗体,添加一个按钮,双击按钮录入代码:
Public Class Form1Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.ClickDim cad As Objectcad = CreateObject("autocad.Application")cad.Visible = Truecad.documents.Addcad.application.documents.Open("D:\ZD\你的文件.dwg")End Sub
End Class
由下图可见,已打开默认cad版本: