Development Guide

CAD Plugin Development

Learn how to develop plugins for AutoCAD using C# and .NET Framework with our comprehensive guide.

Getting Started with AutoCAD Plugin Development

Developing plugins for AutoCAD allows you to extend the functionality of the software and automate repetitive tasks. This guide will walk you through setting up your development environment and creating your first AutoCAD plugin.

Important Note

This guide provides a general approach for AutoCAD plugin development. Adjust paths and references based on your AutoCAD version. Depending on the version of AutoCAD you are using, you may need to choose the appropriate .NET Framework version.

1 Create the Project

  1. Open Visual Studio
  2. Create New Project
  3. Select Class Library (.NET Framework)
  4. Name it anything you want
  5. Click Create

2 Rename the Default Class

  1. Once the project loads
  2. Rename the default class file
    • Example: Class1.csMyAutoCADPlugin.cs
  3. Also rename the class name inside the file to match

3 Add AutoCAD References

  1. Right-click ReferencesAdd Reference
  2. Browse to your AutoCAD installation directory (typically):
    C:\Program Files\Autodesk\AutoCAD YYYY
    (where YYYY is your AutoCAD version year)
  3. Add these DLLs:
    • acdbmgd.dll
    • acmgd.dll
    • accoremgd.dll
  4. Click OK
  5. Set copy local to false

4 Set Platform to x64

  1. From the top menu:
    Build → Configuration Manager
  2. Under Active Solution Platform:
    • Click New
    • Select or create x64
  3. Close Configuration Manager

5 Update Project Build Settings

  1. Right-click the projectProperties
  2. Go to Build
  3. Set:
    • Configuration: Debug
    • Platform: x64

6 Set Debugging AutoCAD EXE

  1. In Project Properties
  2. Go to Debug
  3. Set Start external program:
    C:\Program Files\Autodesk\AutoCAD 2017\acad.exe

Note: Manual Plugin Loading

Sometimes AutoCAD may not load the DLL automatically during debugging. You might need to manually copy it to the plugins folder.

To Test the Plugin:

  1. Build the project
  2. Manually copy the generated .dll file from:
    bin\x64\Debug\
  3. Paste it into your AutoCAD plugins directory:
    C:\Program Files\Autodesk\AutoCAD YYYY\Plugins
  4. Start AutoCAD and test the plugin
  5. You can try to add the following command in post-build (Properties → Build Event → Post-build). [Need to run VS as administrator to use this method]
    xcopy /Y /R "$(TargetPath)" "C:\Program Files\Autodesk\AutoCAD YYYY\Plugins"

💡 Tip: Sometimes you might need to copy the DLL manually to the Plugins folder for the plugin to work properly.

✅ Final Reminders

  • Platform must be x64
  • References must match AutoCAD version
  • DLL must be copied manually to Plugins folder
  • AutoCAD will not load it otherwise

Sample Code

using Autodesk.AutoCAD.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.ApplicationServices;
using System.Reflection;

namespace HelloWorldAutoCAD
{
    public class HelloWorldCommand : IExtensionApplication
    {
        public void Initialize() { }

        public void Terminate() { }

        [CommandMethod("HELLO", CommandFlags.Session)]
        public static void HelloCommand()
        {
            Application.ShowAlertDialog("Hello World from AutoCAD!");
        }
    }
}

This sample code creates a command called "HELLO" that shows a message dialog when executed in AutoCAD.

Need Help with Plugin Development?

Professional CAD/BIM plugin development services to accelerate your automation goals.