尝试使用 Autodesk.AutoCAD.DatabaseService 从 DWG 读取数据我需要引用什么 DLL? [英] Trying to read data from a DWG using Autodesk.AutoCAD.DatabaseService What DLL do I need to reference to?
问题描述
我有一个 VB winform 项目,我正在从 DWG 文件中的表中读取数据.通过这种方法需要打开 AutoCad(使应用程序变慢).
I have a VB winform project where I am reading data from a table inside a DWG file. By this method AutoCad needs to be open(making the application slower).
我发现下面的文章显示您可以使用不同的方法来使用数据库对象(代表我们的内存中绘图)但我不知道我需要引用什么 DLL能够使用这种方法.这个appraoch使用的方法是:
I found the article show below where you can use a different approach where you use a Database object(represent our in-memory drawing) But I don't know what DLL do I need to reference to be able to use this method. The method use on this appraoch is :
使用 Autodesk.AutoCAD.DatabaseServices; -->需要能够导入
还有这篇文章来自 2006 年,关于 C#.现在有更好的方法吗?
And also the article is from 2006 and on C#. Is there a Better approach now a days ?
提前致谢
推荐答案
如果您创建了一个在 AutoCAD 中加载的 .DLL(使用 NETLOAD 命令或使用 PackageContents.xml/.bundle 文件夹),那么您需要以下引用来自AutoCAD 安装文件夹:
If you create a .DLL that you load inside AutoCAD (with NETLOAD command or with PackageContents.xml/.bundle folder), then you need the following references from AutoCAD install folder:
- AcMgd.dll
- AcDbMgd.dll
- AcCoreMgd.dll(AutoCAD 2013 及更高版本需要此文件)
并确保所有引用都设置为 Copy Local = false,注意这很重要:-)
And make sure all the references are set as Copy Local = false, note this is important :-)
.NET 版本可能存在问题,因此请确保:
You may have problems with .NET version, so make sure that you have:
- 适用于 AutoCAD 2010+ 的 .NET 3.5
- 适用于 AutoCAD 2012+ 的 .NET 4.0
- 适用于 AutoCAD 2015+ 的 .NET 4.5
如果你选择旧版本的 .NET,编译器可能会抛出错误,比如不能使用引用.如果您正在开始,请查看 http://www.autodesk.com/myfirstautocadplugin
And if you choose a older version of .NET, the compiler may throw erros, like cannot use the references. If you are starting, please check at http://www.autodesk.com/myfirstautocadplugin
现在,如果您有外部应用程序 (.exe),则不能使用上述应用程序,而仅 COM 引用(也来自 AutoCAD 安装文件夹)
Now, if you have a external application (.exe), then you cannot use the above, but only the COM references (also from AutoCAD install folder)
- Autodesk.AutoCAD.Interop.dll
- Autodesk.AutoCAD.Interop.Common.dll
但是对于这些 COM 互操作,您有不同的数据模型和不同的命名空间.此外,这已被弃用,这意味着它没有新功能.
But for these COM interop you have a different data-model and also a different namespace. Also, this is deprecated, meaning no new features to it.
这篇关于尝试使用 Autodesk.AutoCAD.DatabaseService 从 DWG 读取数据我需要引用什么 DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!