0% found this document useful (0 votes)
77 views

AutoCAD NET Basics 8

This document discusses the basics of creating an AutoCAD .NET add-in. It explains that three namespaces - ApplicationServices, DatabaseServices, and DrawingServices - are needed to write AutoCAD add-ins in .NET. It also describes using an attribute to tell AutoCAD to run a subroutine when a command is entered, and how to configure the project's debug settings to launch AutoCAD and load the add-in when debugging.

Uploaded by

estudiemos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

AutoCAD NET Basics 8

This document discusses the basics of creating an AutoCAD .NET add-in. It explains that three namespaces - ApplicationServices, DatabaseServices, and DrawingServices - are needed to write AutoCAD add-ins in .NET. It also describes using an attribute to tell AutoCAD to run a subroutine when a command is entered, and how to configure the project's debug settings to launch AutoCAD and load the add-in when debugging.

Uploaded by

estudiemos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

DE205-4: AutoCAD® .

NET Basics

Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Hello
World from VB.NET!")

There are several other Autodesk.AutoCAD namespaces, but these are the three you’ll need in
just about every AutoCAD add-in you write. (In this example, DatabaseServices is not strictly
necessary).

<CommandMethod("HelloWorld")> is an attribute. This is telling AutoCAD to run the


subroutine MyMethod when the user types HELLOWORLD on the command line. The rest of
the code should be self-explanatory.

That’s all the code we need. But before we can test our first AutoCAD add-in we have to set one
more project setting. Double-click again on My Project in the Solution Explorer; select the
Debug tab; set the Start Action to Start external program; and enter the location of the AutoCAD
executable – the default location is C:\Program Files\AutoCAD 2009\acad.exe. This is telling
Visual Studio that you’re going to load your DLL into the AutoCAD process space to debug it5.

Now we’re ready to run our add-in. Hit F5 to start debugging, and AutoCAD will launch. Type
NETLOAD on the command line and hit ENTER. In the NETLOAD file select dialog, navigate to
the location of your compiled .NET assembly DLL. This should be in this location, unless you
changed your default project settings:

5
The AutoCAD .NET API can only be used from inside the AutoCAD process space. You can’t use
admgd.dll and acdbmgd.dll in a standalone executable. (But see the section on RealDWG at the end of
this document).

You might also like