If AutoCAD is running, the GetObject function will retrieve the current AutoCAD Application object. When running multiple sessions of AutoCAD, the GetObject function will return the first instance of AutoCAD in the Windows Running Object Table. See the Microsoft Visual Basic documentation for the Running Object Table (ROT) and the GetObject function (for more information about verifying the session returned by GetObject).
我的问题是如何在running multiple sessions of AutoCAD时得到当前的 AutoCAD
而不是the first instance of AutoCAD in the Windows Running Object Table
还请各位帮忙指点迷津,我先谢谢大家了!!!
我的VB调用AutoCAD 方法如下
Function GetAcadApp() Dim AcadApp As Object '定义一个对象 On Error Resume Next Set GetAcadApp = GetObject(, "AutoCAD.Application") If Err Then '如果没有一个AutoCAD副本在运行 Err.Clear Set GetAcadApp = CreateObject("AutoCAD.Application") AcadApp.Visable = True '启动一个AutoCAD副本并设为可见 If Err Then MsgBox Err.Description '如果失败,给出错误提示 Exit Function End If End If End Function |