简体   繁体   English

尝试使用Autodesk.AutoCAD.DatabaseService从DWG读取数据,我需要引用什么DLL?

[英]Trying to read data from a DWG using Autodesk.AutoCAD.DatabaseService What DLL do I need to reference to?

I have a VB winform project where I am reading data from a table inside a DWG file. 我有一个VB winform项目,我在其中从DWG文件中的表读取数据。 By this method AutoCad needs to be open( making the application slower ). 通过这种方法,需要打开AutoCad( 使应用程序变慢 )。

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. 我发现下面显示的文章可以在其中使用数据库对象( 表示我们的内存中绘图 )的另一种方法,但是我不知道要使用此方法需要引用什么DLL。 The method use on this appraoch is : 此方法使用的方法是:

using Autodesk.AutoCAD.DatabaseServices; 使用Autodesk.AutoCAD.DatabaseServices; --> need to be able to import ->需要能够导入

And also the article is from 2006 and on C#. 这篇文章也来自2006年和C#。 Is there a Better approach now a days ? 现在有更好的方法吗?

Thanks in advance 提前致谢

Breaking it down-A closernLook at the C# code for importing blocks 分解-更仔细地看一下导入块的C#代码

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: 如果创建要在AutoCAD内部加载的.DLL(使用NETLOAD命令或PackageContents.xml / .bundle文件夹),则需要从AutoCAD安装文件夹获得以下引用:

  1. AcMgd.dll AcMgd.dll
  2. AcDbMgd.dll AcDbMgd.dll
  3. AcCoreMgd.dll (this is required on AutoCAD 2013 and newer) AcCoreMgd.dll(在AutoCAD 2013及更高版本上是必需的)

And make sure all the references are set as Copy Local = false, note this is important :-) 并确保所有引用都设置为Copy Local = false,请注意这很重要:-)

You may have problems with .NET version, so make sure that you have: .NET版本可能存在问题,因此请确保您具有:

  • .NET 3.5 for AutoCAD 2010+ 适用于AutoCAD 2010+的.NET 3.5
  • .NET 4.0 for AutoCAD 2012+ 适用于AutoCAD 2012+的.NET 4.0
  • .NET 4.5 for AutoCAD 2015+ 适用于AutoCAD 2015+的.NET 4.5

And if you choose a older version of .NET, the compiler may throw erros, like cannot use the references. 而且,如果您选择的是.NET的旧版本,则编译器可能会抛出错误,就像无法使用引用一样。 If you are starting, please check at http://www.autodesk.com/myfirstautocadplugin 如果您要开始,请访问http://www.autodesk.com/myfirstautocadplugin

Now, if you have a external application (.exe), then you cannot use the above, but only the COM references (also from AutoCAD install folder) 现在,如果您有外部应用程序(.exe),则不能使用上述应用程序,而只能使用COM引用(也来自AutoCAD安装文件夹)

  1. Autodesk.AutoCAD.Interop.dll Autodesk.AutoCAD.Interop.dll
  2. Autodesk.AutoCAD.Interop.Common.dll Autodesk.AutoCAD.Interop.Common.dll

But for these COM interop you have a different data-model and also a different namespace. 但是对于这些COM互操作,您具有不同的数据模型和名称空间。 Also, this is deprecated, meaning no new features to it. 另外,不建议使用此功能,这意味着没有新功能。

  1. AcDbMgd.dll which stands for "AutoCAD Database Managed" and inside of it are the objects for DWG (aka Database) manipulation. AcDbMgd.dll代表“ AutoCAD数据库管理”,其内部是DWG(aka数据库)操作的对象。
  2. AcMgd.dll which stands for "AutoCAD Managed" and inside of it are the objects with which you can get the Database objects of the current active DWG. AcMgd.dll代表“ AutoCAD Managed”,并且在其中是可以用来获取当前活动DWG的Database对象的对象。
  3. Set "Copy Local" to False because AutoCAD carries its own copies of the same DLLs. 将“本地复制”设置为False,因为AutoCAD会携带自己的相同DLL副本。

You can get the DLLS from ObjectArx Libraries which are here . 您可以从此处的 ObjectArx库获取DLLS。 When you install them there will be the dlls you need. 当您安装它们时,将有您需要的dll。

Look at AutoCAD`s Developers Guide examples and explanations for the latest "How to". 查看AutoCAD的开发人员指南示例和最新“操作方法”的说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我需要做什么从C#应用程序引用c ++ dll? - What do I need to do reference a c++ dll from a C# application? 我使用什么using指令用于新添加的dll引用 - What using directive do I use for newly added dll reference 如何使用派生API或Autodesk.forge库C#从DWG文件检索图层列表 - How to retrieve list of layers from dwg file using derivative api or Autodesk.forge library c# 如何使用Forge AutoDesk API从2d .dwg中提取几何位置? - How to extract geometric positions from 2d .dwg using Forge AutoDesk APIs? 为什么我需要引用一个我没有直接使用的dll? - Why do I need to reference a dll which I'm not using directly? 是否可以使用 Autodesk.AutoCAD.Interop 在 AutoCAD 中编辑块属性? - Is it possible to edit block attributes in AutoCAD using Autodesk.AutoCAD.Interop? 如何在不打开文件(C#.NET / AutoCAD)的情况下在.DWG文件的特定层上获取所有实体? - How do I get all the entities on a specific layer in a .DWG file without opening the file (C#.NET/AutoCAD)? 如何使用带有C#的AutoCad API将DWG文件导出到图像? - How to export DWG files to images using AutoCad API with C#? 有没有办法使用C#获取autocad(.dwg)中的所有Polylines? - Is there a way to get all Polylines in autocad (.dwg) using C#? 访问CustomTextParagraphProperties我需要参考什么? - What do I need to reference to access CustomTextParagraphProperties?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM