在 VB.NET 中导入 Autodesk.AutoCAD
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19894814/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Importing Autodesk.AutoCAD in VB.NET
提问by shad0w_wa1k3r
For my project, I need to generate CAD drawing (almost a blueprint of a tank) through my VB.NET application. The app takes in some user input & based on this, it generates the geometry of the tank.
对于我的项目,我需要通过我的 VB.NET 应用程序生成 CAD 绘图(几乎是一个坦克的蓝图)。该应用程序接收一些用户输入并基于此生成坦克的几何形状。
I am using Microsoft Visual Studio Professional 2012 & coding in the VB.NET language.
我正在使用 Microsoft Visual Studio Professional 2012 和 VB.NET 语言编码。
I have browsed through a lot of AutoCAD documentation but could not find exactly how & where are the modules hidden, for me to add them into my code.
我浏览了很多 AutoCAD 文档,但无法找到模块的确切隐藏方式和位置,以便我将它们添加到我的代码中。
I stumbled accross one particular documentwhich is where I found how to add the relevant files as reference to my VB solution. However, after adding some particular files I could then do Imports AutoCAD, but all the docs show that I must use Autodesk.AutoCAD. On inspection of the available modules/methods of the Imports AutoCADI can see that it isn't complete as needed for the application development.
我偶然发现了一个特定的文档,在该文档中我找到了如何添加相关文件作为对我的 VB 解决方案的参考。但是,在添加了一些特定文件后,我可以执行Imports AutoCAD,但所有文档都表明我必须使用Autodesk.AutoCAD. 在检查可用模块/方法时,Imports AutoCAD我可以看到它没有满足应用程序开发的需要。
Can somebody please guide me as to how could I find or go about adding correct reference files to my VS solution to get full functionality from the AutoCAD modules? Thanks!
有人可以指导我如何找到或将正确的参考文件添加到我的 VS 解决方案中以从 AutoCAD 模块中获得全部功能吗?谢谢!
回答by Trae Moore
I posted this quite some time ago. It contains the information that you need
我很久以前发布过这个。它包含您需要的信息
How to close a file in Autocad using C# keeping acad.exe running?
如何使用 C# 关闭 Autocad 中的文件以保持 acad.exe 运行?
You can also download any of the AutoCAD .NET API's from here:
您还可以从这里下载任何 AutoCAD .NET API:
http://usa.autodesk.com/adsk/servlet/index?id=1911627&siteID=123112
http://usa.autodesk.com/adsk/servlet/index?id=1911627&siteID=123112
Just in case someone else need the help.
以防万一其他人需要帮助。
- Download the appropriate AutoCAD .NET API using the aforementioned link.
- Put them in a location of your choosing.
- 使用上述链接下载适当的 AutoCAD .NET API。
- 将它们放在您选择的位置。
general:
一般的:
on the appropriate project in your visual studio's solution, right click -> Add Reference.
在 Visual Studio 解决方案中的相应项目上,右键单击 -> 添加引用。
select Browse on left, click the browse button and go to the path where you saved the ObjectARX download.
选择左侧的浏览,单击浏览按钮并转到保存 ObjectARX 下载的路径。
Inprocess:
过程中:
Navigate to the inc directory and
select the AcDbMgd.dlland AcMgd.dllthen click add.
导航到 inc 目录并选择AcDbMgd.dll,AcMgd.dll然后单击添加。
For these make sure to set the copy local property to false.
对于这些,请确保将复制本地属性设置为 false。
Interop:
互操作:
Navigate to the appropriate directory: inc-win32 or inc-x64 depending on your processor.
select the Autodesk.AutoCAD.Interop.Common.dlland Autodesk.AutoCAD.Interop.dllthen click add.
导航到适当的目录:inc-win32 或 inc-x64,具体取决于您的处理器。选择Autodesk.AutoCAD.Interop.Common.dll,Autodesk.AutoCAD.Interop.dll然后单击添加。
and unless you have an interest in the AutoCAD interface don't worry about the AcCui.dll
除非您对 AutoCAD 界面感兴趣,否则不要担心 AcCui.dll
Hope this helps some one out :)
希望这可以帮助一些人:)
回答by shad0w_wa1k3r
So, looking up more & more documentation led me to stumble across this
因此,查找越来越多的文档让我偶然发现了这一点
I found the dlls by simple file search for respective dlls metioned below in my local AutoCAD 2014 installation folder (C:\Program Files\Autodesk\AutoCAD 2014)
我在本地 AutoCAD 2014 安装文件夹(C:\Program Files\Autodesk\AutoCAD 2014)中通过简单的文件搜索找到了下面提到的各个 dll 的 dll
As per the documentation, following dlls are important ones -
根据文档,以下 dll 是重要的 -
- AcCui.dll
- acdbmgd.dll
- acmgd.dll
- Autodesk.AutoCAD.Interop.dll
- Autodesk.AutoCAD.Interop.Common.dll
- 数据库文件
- 文件管理器
- acmgd.dll
- Autodesk.AutoCAD.Interop.dll
- Autodesk.AutoCAD.Interop.Common.dll
The credit for the last 2 dlls goes to Trae Moore.
最后 2 个 dll 的功劳归功于 Trae Moore。
How to add references to the dlls was mentioned in the documentation link.
文档链接中提到了如何添加对 dll 的引用。

