AutoCAD & Civil 3D Add-in Development with .NET Core Templates

<?xml encoding=”UTF-8″>By Madhukar Moogala

 Developing AutoCAD and Civil 3D add-ins requires setting up boilerplate code, managing dependencies, and ensuring     compatibility with the latest .NET versions. To simplify this process, we created a .NET Core-based project template     that allows developers to quickly scaffold AutoCAD and Civil 3D add-ins using a single CLI instruction.   

How to Use the Template


set "AcadDir=C:Program FilesAutodeskAutoCAD 2025"
dotnet new civil --rootNamespace=CivilCmd -o TestCivilProject
cd TestCivilProject
dotnet restore
dotnet build

This command generates a Civil 3D add-in project with the specified root namespace and output directory.

What’s Inside the Template?

  1. A pre-configured .csproj file targeting .NET Core/.NET 8.0 for AutoCAD 2025+ compatibility.
  2. An implementation of IExtensionApplication for AutoCAD commands.
  3. A sample command class with a simple Civil 3D API example.

Extending the Template

The template is designed to be easily extensible. You can add new commands, implement new interfaces, and reference
external libraries as needed. The template also includes a sample command class that demonstrates how to interact
with the Civil 3D API.

  1. Additional dependencies (e.g., Newtonsoft.Json, AutoCAD NuGet packages).
  2. Unit tests using xUnit or NUnit.
  3. Logging mechanisms like Serilog.


GitHub
View on GitHub


Comments

One response to “AutoCAD & Civil 3D Add-in Development with .NET Core Templates”

  1. Very detailed instructions.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading