liaoost 发表于 2008-6-16 16:41:00

VB.net 和Cad 连接问题

<p>&nbsp;请各位高手帮忙指导:<p></p></p><p>为何&nbsp; db = HostApplicationServices.WorkingDatabase 出错呢</p><p><p></p>&nbsp;</p><p></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;">请帮一下</p><p>&nbsp;</p>

liaoost 发表于 2008-6-17 10:31:00

<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;">在前面引用了下面<p></p></p><p>Imports Autodesk.AutoCAD.DatabaseServices<br/>Imports Autodesk.AutoCAD.Runtime<br/>Imports Autodesk.AutoCAD.ApplicationServices<br/>Imports Autodesk.AutoCAD.EditorInput<br/>Imports Autodesk.AutoCAD.Colors<br/>Imports Autodesk.AutoCAD.Geometry<br/>Imports Autodesk.AutoCAD.GraphicsInterface<br/>Imports Autodesk.AutoCAD.PlottingServices<br/>Imports Autodesk.AutoCAD.Windows</p><p>Imports System.Runtime.InteropServices<br/>Imports DBTransMan = Autodesk.AutoCAD.DatabaseServices.TransactionManager</p><p>Imports Autodesk.AutoCAD<br/>Imports Autodesk.AutoCAD.Interop<br/>Imports Autodesk.AutoCAD.Interop.Common<br/>Imports System.IO<br/>Imports System.Math</p><p></p><p>Dim db As Database<br/><font color="#ff0000">db = Application.DocumentManager.MdiActiveDocument.Database</font></p><p><span lang="ZH-CN" style="FONT-FAMILY: SimSun; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN;">无法获得当前活动<font face="新細明體">AutoCAD</font>文档所在的数据库<font face="新細明體">,</font>请还有那边要注意呢<font face="新細明體">.</font></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="ZH-CN" style="FONT-FAMILY: SimSun; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN;">我的软件为<font face="Times New Roman">:Auto Cad 2006 </font>和<font face="Times New Roman">
                                        Visual Basic 2005 Express</font>版</p></span><p><font face="新細明體"></font><p></p></p></span>

liaoost 发表于 2008-6-18 13:11:00

<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="ZH-CN" style="COLOR: black; FONT-FAMILY: 新細明體; mso-bidi-font-family: Tahoma; mso-fareast-language: ZH-CN;">各位高手问题如下,请指导…谢谢<p></p></p></span><p style="MARGIN: 0cm 0cm 0pt;">Imports Autodesk.AutoCAD.DatabaseServices<p></p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;">Imports Autodesk.AutoCAD.Interop<br/>Imports Autodesk.AutoCAD.Interop.Common<p></p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;">Dim _Cad <span style="COLOR: blue;">As Autodesk.AutoCAD.Interop.AcadApplication</span><p></p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;">Cad = <span style="COLOR: blue;">New Autodesk.AutoCAD.Interop.AcadApplication</span><span style="mso-spacerun: yes;">&nbsp; <p></p></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;">Dim Open_Cad_File_0 <span style="COLOR: blue;">As AcadDocument = Cad.Documents.Open("C:\0\0.dwg")</span><p></p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;">Dim db <span style="COLOR: blue;">As Database = HostApplicationServices.WorkingDatabase </span>←并未将对象参考设定为对象的执行个体,无法取得获得当前工作空间的数据库</p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><p></p></p>
页: [1]
查看完整版本: VB.net 和Cad 连接问题