Setting Up Visual Studio

AutoCAD Map 3D .NET API

 
Setting Up Visual Studio
 
 
 

The AutoCAD Map 3D SDK requires Microsoft Visual Studio 2005. To set up a project for a custom application, open the project properties.

NoteThese instructions apply to VB.NET. Setting up a project for C# is slightly different.

On the Application tab, set the application type to Class library.

Add the following references. The DLLs are in the AutoCAD Map 3D installation folder:

  • acdbmgd.dll
  • acmgd.dll
  • ManagedMapApi.dll

acdbmgd.dll contains the following AutoCAD namespaces:

  • Autodesk.AutoCAD.Colors
  • Autodesk.AutoCAD.ComponentModel
  • Autodesk.AutoCAD.DatabaseServices
  • Autodesk.AutoCAD.DatabaseServices.Filters
  • Autodesk.AutoCAD.Geometry
  • Autodesk.AutoCAD.GraphicsInterface
  • Autodesk.AutoCAD.GraphicsSystem
  • Autodesk.AutoCAD.LayerManager
  • Autodesk.AutoCAD.Runtime

acmgd.dll contains the following AutoCAD namespaces:

  • Autodesk.AutoCAD.ApplicationServices
  • Autodesk.AutoCAD.EditorInput
  • Autodesk.AutoCAD.GraphicsSystem
  • Autodesk.AutoCAD.PlottingServices
  • Autodesk.AutoCAD.Publishing
  • Autodesk.AutoCAD.Runtime
  • Autodesk.AutoCAD.Windows
  • Autodesk.AutoCAD.Windows.ToolPalette

ManagedMapApi.dll contains the following AutoCAD Map 3D namespaces:

  • Autodesk.Gis.Map
  • Autodesk.Gis.Map.Annotation
  • Autodesk.Gis.Map.Classification
  • Autodesk.Gis.Map.Constants
  • Autodesk.Gis.Map.DisplayManagement
  • Autodesk.Gis.Map.Filters
  • Autodesk.Gis.Map.ImportExport
  • Autodesk.Gis.Map.MapBook
  • Autodesk.Gis.Map.ObjectData
  • Autodesk.Gis.Map.Project
  • Autodesk.Gis.Map.Query
  • Autodesk.Gis.Map.Topology
  • Autodesk.Gis.Map.Utilities

For each of the references, set the Copy Local property to False. Double-click the reference to open the properties.

Set the reference path to the AutoCAD Map 3D installation directory.

On the Debug tab, set:

  • Start external program: InstallDir\acad.exe, where InstallDir is the installation directory for AutoCAD Map 3D.
  • Working directory: InstallDir\UserDataCache\

Running AutoCAD Map 3D Custom Applications

Every custom application requires at least one subroutine that can be called from AutoCAD Map 3D. Identify this using the CommandMethod attribute. For example, using VB.NET the syntax is:

<CommandMethod("CustomCommand")> _
Public Sub CommandSub()

Using C# the syntax is:

[CommandMethod("CustomCommand")] 
public void CommandSub();

To run a custom application, type the NETLOAD command at the AutoCAD Map 3D command prompt. Browse to the DLL containing the custom application assembly. Open the assembly. This makes any custom commands defined using the CommandMethod attribute available to the AutoCAD Map 3D session.

To execute a command, type the command method at the command prompt. In the example above, this would be

CustomCommand

For more details, refer to the AutoCAD documentation.