Components of the AutoCAD .NET API
AutoCAD .NET API组件
The AutoCAD .NET API is made up of different DLL files that contain a wide range of classes, structures, methods, and events that provide access to objects in a drawing file or the AutoCAD application. Each DLL file defines different namespaces which are used to organize the components of the libraries based on functionality.
AutoCAD .NET API由不同的DLL文件组成,这些DLL文件包含有大量的类、结构、方法及事件,用于访问图形文件对象或AutoCAD程序对象。每个DLL文件定义了不同的命名空间,按功能组织API组件。
The three main DLL files of the AutoCAD .NET API that you will frequently use are:
常用的AutoCAD .NET API的三个主要DLL文件是:
·
AcDbMgd.dll. Use when working with objects in a drawing file. 用于处理图形文件对象;
·
AcMgd.dll. Use when working with the AutoCAD application. 用于处理AutoCAD应用程序;
·
AcCui.dll. Use when working with customization files. 用于处理自定义文件;
Use an AutoCAD .NET API DLL 引用AutoCAD .NET API DLL文件
Before classes, structures, methods, and events found in one of the AutoCAD .NET API related DLLs can be used, you must reference the DLL to a project. After a DLL is referenced to a project, you can utilize the namespaces and the components in the DLL file in your project.
使用AutoCAD .NET API相关DLL文件里提供的类、结构、方法及事件之前,必须在你的VisualStudio工程中引用相应的DLL文件。完成引用后,你就可以在工程中使用该DLL文件里定义的命名空间和API组件。
Once a AutoCAD .NET API DLL is referenced, you must set the Copy Local property of the referenced DLL to False. The Copy Local property determines if Microsoft Visual Studio creates a copy of the referenced DLL file and places it in the same directory as the assembly file of the project when it is built. Since the referenced files already ship with AutoCAD, creating copies of referenced DLL files can cause unexpected results when you load your assembly file in AutoCAD.
一旦引用了AutoCAD .NET API DLL文件,应将该引用的“复制本地”属性设置为False(设置方法:解决方案资源管理器->右键该引用->属性->复制本地->选False)。“复制本地”属性确定当Microsoft Visual Studio编译工程时是否创建一个引用文件的副本并将它放在与工程的程序集文件相同的目录下。
由于AutoCAD安装目录里包含有相同文件名的DLL文件,
因此,如果创建了引用文件副本,当加载程序集文件到AutoCAD中时可能会引发意想不到的结果。
Location of AutoCAD .NET API DLL files 定位AutoCAD .NET API DLL文件
The AutoCAD .NET API DLL files can be located at <drive>:/Program Files/AutoCAD 2012 or as part of the AutoCAD 2012 ObjectARX SDK which can be downloaded from http://www.objectarx.com or the Autodesk Developer Network Web site (http://www.autodesk.com/adn). After the ObjectARX SDK is installed, the DLL files can be found in the inc-win32 and inc-x64 folders under the main install folder.
安装ObjectARX SDK开发包后,可以在主安装目录下的inc目录下找到AutoCAD .NET API DLL文件。
Note The DLLs in the ObjectARX SDK are simplified versions of the same files that ship with AutoCAD, as they do not contain dependencies on the AutoCAD user interface. It is recommended that you download and install the ObjectARX SDK, and then reference the DLL files that come with the SDK instead of those that are found in the install directory of AutoCAD 2012.
ObjectARX SDK开发包里的.NET API DLL文件是AutoCAD软件包里相应DLL文件的简化版本,不包含AutoCAD用户界面相关内容。推荐下载并安装ObjectARX SDK开发包,在工程中引用开发包里的DLL文件,而不引用AutoCAD2012安装目录里的文件。