AutoLISP & VisualLISP
DCL-Dialog Control Language
Inventor API
SolidWorks API
SolidEdge API


AutoCAD Customization
SolidWorks VBA
SolidEdge VBA


AutoCAD 3D Press-Pull


AutoCAD Customization
CAD Customization
SolidWorks Customization


Articles > AutoCAD.Net API

AutoCAD.Net API programming using VB.Net, C#.Net, AutoCAD Customization using Net


You can program AutoCAD using VB.Net/C#.Net using following methos:

1. Using ObjectARX managed wrapper classes
2. Using AutoCAD COM APIs
3. Using combination of both

If you are currently using AutoCAD VBA then you can use AutoCAD COM APIs to start AutoCAD programming using .Net immediately.

Procedure to use AutoCAD COM API with .Net is explained below:

- Start Microsoft Visual Studio 2005
- Create a new Class Library project in VB.Net
- Add reference to AutoCAD Type Library (acax17enu.tlb), AutoCAD / ObjectDBX Common Type Library (axdb17enu.tlb), acdbmgd.dll and acmgd.dll.
- Type the following code (This code creates a line)


Imports Autodesk.AutoCAD.Runtime

Public Class Class1
    <'CommandMethod("MyLine")> _
     Public Shared Sub CreateLine()

         Dim AcadApp As Autodesk.AutoCAD.Interop.AcadApplication
         Dim acaddoc As Autodesk.AutoCAD.Interop.AcadDocument
         Dim pt As Object
         Dim pt1 As Object

         AcadApp = GetObject(, "Autocad.Application")
         acaddoc = AcadApp.ActiveDocument

         pt = acaddoc.Utility.GetPoint(, "Pick point:")
         pt1 = acaddoc.Utility.GetPoint(pt, "Pick second point:")

         acaddoc.ModelSpace.AddLine(pt, pt1)

     End Sub
End Class

- Build Solutions
- Start AutoCAD
- Give NetLoad command
- Select dll file created by above application
- Once the loading is completed you can give MyLine command to take the trial of above program.





       Download above project files

       Other AutoCAD.Net Downloads

       View videos on AutoCAD.Net API Training Session


Related links:


       Read articles on AutoCAD customization, AutoLISP, VisualLISP, AutoCAD VBA

       Learn AutoCAD Customization using AutoLISP & VisualLISP, DCL, AutoCAD VBA, AutoCAD.Net, ObjectARX

       Learn other CAD Customization tools such as SolidWorks API, SolidEdge API, Inventor API


Copyright 2008-2011 CADDsoft Solutions, all rights reserved
Privacy Policy