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 application. Each DLL file defines different namespaces which are used to organize the components of the libraries based on functionality.
The main DLL files of the AutoCAD .NET API that you will frequently use are:
- AcCoreMgd.dll. Use when working within the editor, publishing and plotting, and defining commands and functions that can be called from AutoLISP.
- AcDbMgd.dll. Use when working with objects stored in a drawing file.
- AcMgd.dll. Use when working with the application and user interface.
- AcCui.dll. Use when working with customization files.
Reference an 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.
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 (or executable file) that is generated when building the project. Since the referenced files already ship with the product, creating copies of the referenced DLL files can cause unexpected results when you load your assembly file.
An assembly file is the source code from an Intermediate Language (IL) based program and is executed by invoking the .NET runtime; called the CLR, Common Language Runtime. The CLR compiles an assembly into native code right before it is executed by the operating system or another application. The process of compiling at runtime just before execution is often referred to as Just-In-Time (JIT) compiling. You can pre-compile an assembly using NGEN to create a native executable. Using NGEN can make your assembly more secure since it cannot be viewed using an IL disassembler.
Location of AutoCAD .NET API DLL Files
The AutoCAD .NET API DLL files can be located at <drive>:\Program Files\Autodesk\<release> or as part of the latest ObjectARX SDK which can be downloaded from http://www.objectarx.com or the Autodesk Developer Network (ADN) website (http://www.autodesk.com/adn).
After the ObjectARX SDK is installed, the DLL files can be found in the inc folder under the main install folder.
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 or the AutoCAD-based program.
Procedures
To download and install the latest ObjectARX SDK
- Launch your default Internet browser application and browse to http://www.objectarx.com.
- On the Web page, click License & Download.
- Fill in the required fields and select ObjectARX for AutoCAD <release>. Click Submit.
- On the Download page, click Download Now to use the Download Manager or click Standard Download Method to use the default download method of your Internet browser.
- Click Save or the option used to save the file to your local drive.
- Specify a location to download the ObjectARX SDK package file.
- Once the package file is downloaded, browse to the location you saved it to and double-click it.
The install wizard is displayed.
- In the ObjectARX <Release> dialog box, specify a new install location or leave the default install location. Click Install.
The install wizard closes after it is finished if no problems were encountered.
To install the Managed .NET project wizard
- Launch your default Internet browser application and browse to http://www.autodesk.com/developautocad.
- Download and unzip the <release> .NET Wizards.zip file.
- After browsing to the location of the unzipped files, double-click the <release> dotNET Wizards.msi file.
- In the AutoCAD .NET Wizards dialog box, click Next.
- On the Select Installation Folder page, click Browse to specify a new installation location for the wizard or leave the default location. Click Next.
- Click Next again to confirm installation of the wizard.
- Click Close to close the installer.
To reference an AutoCAD .NET API DLL
- In Microsoft Visual Studio, click View menu Solution Explorer to display the Solution Explorer if it is not already displayed.
- In the Solution Explorer, on the toolbar along the top, click Show All Files.
- Right-click the References node and click Add Reference.
- In the Add Reference dialog box, Browse tab, select the DLL file that contains the library you want to use and click OK.
- In the Solution Explorer, click the plus sign to the left the References node to expand it.
- Select the referenced library from the References node.
- Right-click over the selected reference and click Properties.
- In the Properties window, click the Copy Local field and select False from the drop-down list.