Overview

AutoCAD Map 3D .NET API

 
Overview
 
 
 

An AutoCAD Map 3D session represents the active state of the Map 3D application.

Most of the classes for working with the session are defined in the Autodesk.Gis.Map namespace.

There is a single instance of the Map application, available through the Application property of the abstract class

Autodesk.Gis.Map.HostMapApplicationServices

This returns a MapApplication object that represents the entire application. It has some read-only properties that provide access to objects in the session. One of the main properties is Projects.

Projects returns a collection of all open projects, a ProjectCollection object in the Autodesk.Gis.Map.Project namespace. A project is represented by a ProjectModel object. A project is the container for a Map 3D drawing and all its associated objects. Nearly all interaction with a drawing begins with a project.

ActiveProject returns the ProjectModel for the currently active project.

NoteFor historical reasons, the API uses the term project where the user interface will normally use map or drawing.

For example, the following gets the current project:

Dim mapApp As MapApplication
mapApp = HostMapApplicationServices.Application
Dim activeProj As Project.ProjectModel
activeProj = mapApp.ActiveProject

The following processes all open projects:

Dim mapApp As MapApplication
mapApp = HostMapApplicationServices.Application
Dim projList As Project.ProjectCollection
projList = mapApp.Projects
For Each project As Project.ProjectModel In projList
    ' Process projects
Next
NoteMany of the examples in this guide assume that mapApp and activeProj have already been defined as in the example above.

A project is closely related to an AutoCAD drawing. In AutoCAD Map 3D, opening a drawing automatically creates a new project. You cannot instantiate a new project directly.

MapApplication.GetDocument() returns the AutoCAD document associated with a project. Conversely, Project.ProjectCollection.GetProject() returns the ProjectModel for an AutoCAD document.

For example, the following diagram shows a session that has three open projects. The first project refers to external drawings in its drawing set. Any one of the projects could be active at one time. Each project has a corresponding AutoCAD drawing.

Additional Project Properties

ProjectModel objects have many properties that provide access to different aspects of the drawing. For example, the DrawingSet property gets the drawing set for the project.

Some of the important project properties are:

  • Annotations
  • Database
  • DrawingSet
  • ODTables
  • Topologies

For more details about the various properties, refer to the appropriate chapters in this guide.

AutoCAD Database

The ProjectModel.Database property returns a reference to the AutoCAD database. This is necessary for many AutoCAD operations.

Project Options

The ProjectModel.Options property returns a reference to the project’s options.