ngeqt521 发表于 2007-1-20 12:44:00

[求助]在VB程序中怎样做才能调用CAD2007

本帖最后由 作者 于 2007-1-20 12:45:02 编辑 <br /><br /> <p>如下语句可调用CAD2004以下版本,怎样才可调用CAD2007, help me</p><p>-------------------------------------------------------------------------------------------------------------------</p><p>Option Explicit<br/>Dim DotCAD As AcadApplication</p><p>Private Sub Command1_Click()</p><p>Dim L As Double<br/>Dim w As Double<br/>Dim a As Double<br/>Dim b As Double<br/>Dim Dmin As Double<br/>Dim Dmax As Double</p><p>L = Me.Text1(0)<br/>w = Me.Text1(3)<br/>a = Me.Text1(1)<br/>Dmin = Me.Text1(2)<br/>b = Me.Text1(4)<br/>Dmax = Me.Text1(5)</p><p>Dim returnpnt As Variant<br/>AppActivate DotCAD.Caption<br/>returnpnt = DotCAD.ActiveDocument.Utility.GetPoint(, "插入点:")</p><p>......(程序略过)<br/>Private Sub Form_Load()<br/>On Error Resume Next<br/>&nbsp;Set DotCAD = GetObject(, "AutoCAD.Application")<br/>&nbsp;If Err Then<br/>&nbsp;Err.Clear<br/>&nbsp;Set DotCAD = CreateObject("AutoCAD.Application")<br/>&nbsp;If Err Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox ("please install AutoCAD2004")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Unload Me<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Sub<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>DotCAD.WindowState = acMax<br/></p>

ngeqt521 发表于 2007-1-25 09:54:00

<p>问题已解决,谢谢明经的兄弟支持我.</p>

wyj7485 发表于 2007-1-25 10:13:00

怎么解决的啊,让大家也学学

ngeqt521 发表于 2007-1-29 08:50:00

<p>如上程序并未指定AUTO CAD版本,只要在工程-----&gt;引用内引用ATUO CAD2007就行了,把原来的乱码引用项不钩选就OK,</p><p>If Err Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox ("please install AutoCAD2004")</p><p>这个调用错误信息窗可以改为2007,不改也行,就这样弄好了,大哥们不要吐我口水哟!<br/></p>

wyj7485 发表于 2007-1-29 09:00:00

那如果同时装了多个cad版本呢,引用中只有高版本的,要引用低版本的就成问题了

ngeqt521 发表于 2007-2-3 11:58:00

<p>这是个问题,企待高手,</p>

StartMe 发表于 2007-2-3 23:45:00

wyj7485发表于2007-1-29 9:00:00static/image/common/back.gif那如果同时装了多个cad版本呢,引用中只有高版本的,要引用低版本的就成问题了

<p></p>2000-2002为同一引用,2004-2006为一个,2007单独一个,作三个版本的程序,程序中判断CAD版本后自启动相适应于CAD版本的那个程序,我是这么做的。
页: [1]
查看完整版本: [求助]在VB程序中怎样做才能调用CAD2007