JimYuan's Blog

Sharing the things I learned

0%

AutoCAD_Dev_with_Csharp

Preface

Apparently, we can develop APIs with LISP and .NET . Though I have been checking some articles mentioning the pros and cons for using one another, it is still unclear to me, which scenario suit for which development method. I think I might realize the answer of this question along my development journey. Few weeks ago, I learned some basic LISP, but the materials that I checked wasn’t completed. LISP is the second oldest programming language that still exist, which make the programmer like me a bit hard to catch up easily. Since I spent more time developing in C#, it won’t hurt if I learn a bit how to develop AutoCAD API in .NET framework.

DLLs

  • ACMGD.DLL
  • ACDBGD.DLL
  • ACCOREMGD.DLL

using lines

1
2
3
4
5
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;

Workflow

  1. Create the Class Library(.NET framework)
  2. Add those 3 dlls listed above
  3. Add the using lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;

namespace DrawObject{
public class DrawObject{
[CommandMethod("DrawLine")]
public void DrawLine(){

}
}

}

Reference

https://amdlaboratory.com/amdblog/autocad%E3%81%AEaddin%E3%82%92c%E3%81%A7%E4%BD%9C%E3%82%8B%E6%96%B9%E6%B3%95/