求助,如何用vb控制cad画纵断面图?
求助,如何用vb控制cad画纵断面图?
Dim acadApp as object,acadDoc as object Sub Main() ConnectToCAD2004 Set acadDoc = acadApp.Documents.Add Sub Private Function ConnectToCAD2004() As Boolean '连接AUTO CAD 2004 On Error Resume Next Set acadApp = GetObject(, "autocad.application.16") '获得当前运行CAD程序控制 If Err Then '出现错误,即CAD并为启动 Err.Clear Set acadApp = CreateObject("autocad.application.16") '创建CAD对象,获得控制权。 注意16对不同CAD版本不同 If Err Then ConnectToCAD2004 = False '失败 MsgBox "连接Auto CAD 没有成功!" & vbNewLine & "请确认安装的版本。或手动打开Auto CAD,然后点击连接按钮。" _ & vbNewLine & vbNewLine & Err.Description, vbInformation, AppName Exit Function End If End If ConnectToCAD2004 = True acadApp.Visible = True End Function
[此贴子已经被作者于2016-5-15 12:07编辑过]