toosimple 发表于 2005-10-21 09:00:00

求助vb简单问题

我想在vb中直接控制autocad画图,请问我该如何把vb与cad连接上呢???

alin 发表于 2005-10-21 09:17:00

<P>Use the&nbsp;Help files....</P>
<P>In 2004</P>
<P class=body>The following code example uses the Clear and Description properties of Err. If your coding environment does not support these properties, you will need to modify the example appropriately: </P><PRE class=prog_in_0>Sub Ch2_ConnectToAcad()</PRE><PRE class=prog_in_0>    Dim acadApp As AcadApplication</PRE><PRE class=prog_in_0>    On Error Resume Next</PRE><PRE class=prog_in_0>    </PRE><PRE class=prog_in_0>    Set acadApp = GetObject(, "AutoCAD.Application.16")</PRE><PRE class=prog_in_0>    If Err Then</PRE><PRE class=prog_in_0>      Err.Clear</PRE><PRE class=prog_in_0>      Set acadApp = CreateObject("AutoCAD.Application.16")</PRE><PRE class=prog_in_0>      If Err Then</PRE><PRE class=prog_in_0>            MsgBox Err.Description</PRE><PRE class=prog_in_0>            Exit Sub</PRE><PRE class=prog_in_0>      End If</PRE><PRE class=prog_in_0>    End If</PRE><PRE class=prog_in_0>    MsgBox "Now running " + acadApp.Name + _</PRE><PRE class=prog_in_0>         " version " + acadApp.Version</PRE><PRE class=prog_in_end_0>End Sub</PRE>
<P class=body>Next, set the document variable to the Document object in the AutoCAD application. The Document object is returned by the ActiveDocument property of the Application object. </P><PRE class=prog_in_0>Dim acadDoc as AcadDocument</PRE><PRE class=prog_in_end_0>Set acadDoc = acadApp.ActiveDocument</PRE>
<P class=body>From this point on, use the acadDoc variable to reference the current AutoCAD drawing. </P>
<P>
<TABLE class=FooterTable cellSpacing=0 cellPadding=4 width="100%" border=0>
<TBODY>
<TR vAlign=top>
<TD>&nbsp;</TD>
<TD align=right>&nbsp;</TD></TR></TBODY></TABLE></P>

toosimple 发表于 2005-10-23 20:35:00

thankyou

wangjd 发表于 2005-11-3 12:31:00

<P>我需要VB打开AutoCAD的详细程序</P>

mjtppf 发表于 2005-11-3 16:51:00

<P>已经很详细了</P>
页: [1]
查看完整版本: 求助vb简单问题