To start API programming for AutoCAD, some softwares needs to be installed.
1. Prerequisites:
Visual Studio:
Install the latest version of Visual Studio. The Community Edition is free and sufficient for this purpose.
AutoCAD .NET API:
Ensure you have the AutoCAD .NET API installed. This can be found in the AutoCAD ObjectARX SDK. ObjectARX for 2024 version can be downloaded from Autodesk Platform Services Website.
2. Create a New Project:
- Open Visual Studio.
- Go to File > New > Project.
- Choose Class Library (.NET Framework) as the project type but check if it is VB based.
- Name your project and choose a location to save it.
3. Add References:
- Right-click on the References node in the Solution Explorer.
- Choose Add Reference.
- Browse to the location where the AutoCAD .NET assemblies are located (typically in the AutoCAD installation directory under ./inc).
- Add references to following files. The files are usually present in folder (C:\Program Files\Autodesk\AutoCAD 20XX\)
- AcMgd.dll (This is the main AutoCAD Managed DLL that provides access to the core AutoCAD functionality.)
- AcDbMgd.dll (This DLL is responsible for database operations in AutoCAD, including working with drawing objects.)
- AcCoreMgd.dll (This DLL provides access to core AutoCAD services and application initialization.)
In some cases, additional references may be required for some special functions. The additional references are not necessarily to be added to our project. These are following:
- AcCui.dll (If you're working with custom user interfaces (e.g., ribbon tabs), you'll need it.)
- AcWindows.dll (This DLL is needed for Windows-specific functionality within AutoCAD)
For AutoCAD Civil 3D, additional references are required.
- AeccDbMgd.dll (This DLL provides access to the AutoCAD Civil 3D database and objects. It's specific to Civil 3D)
- AecBaseMgd.dll (It facilitates database operations and interactions with AEC-specific objects and data within the drawing)
- AeccPressurePipesMgd.dll (It provides access to networks and pressure pipe networks)
4. Write Your Code:
In the default class file, add the following imports:












