Understanding Project Management

AutoCAD Land Desktop ActiveX & VBA

Understanding Project Management


Land Desktop projects are used to organize drawing files, support data files, and settings that are associated with each job you work on. Just as the ActiveDrawing is central to the AutoCAD application object, the Land Desktop application object exposes the ActiveProject. Through the project object, you can access Coordinate Geometry, Plan Alignment, Digital Terrain, Parcels, Profile, Cross Section and Superelevation data and preferences.

To create a new project, use the Projects.Add method, supplying a prototype name from the Prototypes collection and a project name for the new project. To create the first project-based drawing for the new project, use the Document.NewProjectBased method, specifying the drawing template name, the project name, and the new drawing name. This will switch the desktop to the newly created project and drawing.

The Projects collection is updated whenever the ProjectPath property is changed. This allows you search for projects at various paths. To access folders on a network, you must first map the drive. Note that you are limited to the FileLocks and Drawings collections for any Project that is not the ActiveProject . To access the CogoPoints, PointGroups, DescriptionKeyFiles, Alignments, Surfaces, Parcels, Profiles, CrossSections and Superelevations you must be in the project currently loaded into AutoCAD Land Desktop.

Extensions to AutoCAD objects

The Land Desktop object model extends many AutoCAD ActiveX objects by adding properties and methods. This includes the Application, Documents, Document, DatabasePreferences, PreferencesUser, PreferencesFile, and the Utility objects. This enhancement is automatically available when you navigate from the AeccApplication object to other objects in the model.

The Documents collection supports the management of multiple drawings (MDI) in the AutoCAD environment. Since AutoCAD Land Desktop works on a single drawing at a time (SDI), the Documents object is ancillary. You can get the first (and only) document from the Document collection, but it is generally more convenient to use the AeccApplication.ActiveDrawing method. Also, note that the Documents.Add and Documents.New methods are not available in SDI mode.

The Document object adds two important methods - OpenProjectBased and NewProjectBased. Use these methods to open and create project-based drawings, respectively. Both methods accept an optional Project name to allow you to switch from one project to another. Note that the Document.Open and Document.New methods do not support projects and will return an error if invoked.

The DatabasePreferences object represents settings that are saved on a pre-drawing (or document) basis. This includes base settings for Architecture and Civil Engineering, as well as AutoCAD Land Desktop specific settings. These settings can be loaded and saved to an external setup profile.

The PreferencesUser and PreferencesFiles objects store user and application level settings, respectively. The PreferencesUser settings control overrides to AutoCAD behavior and the most recently used project and drawings. It also allows a default drawing setup profile to be applied to new drawings, so that the user is not prompted for settings. The PreferencesFiles object exposes the paths used by AutoCAD Land Desktop.

The Utility object adds methods that convert an Easting and Northing to an AutoCAD X and Y and back using the geodetic base point and north rotation for the drawing.

Project-owned objects

In addition to providing access to Coordinate Geometry, Plan Alignments, Parcels,Terrain Modeling, Profiles, Cross Sections, and Superelevations, the Project object exposes the Drawings and FileLocks collection.

The Drawings collection is similar to the Documents collection, except that it represents AutoCAD drawing files in a local or remote folder (directory). These files may or may not be loaded into the application. You can use the Projects and Drawings collections to browse any Land Desktop project on a local or mapped remote drive. For convenience, you can use the Drawings.Open method to switch to the parent project and open the drawing as the ActiveDocument (similar to the Document.OpenProjectBased method).

The FileLocks collection exposes multi-user project locks.

Using Collections

The object model contains simple objects and collections of objects. For some collections, if you change the value of a property, the collection will be rebuilt. You need to refresh your objects to see the effect of this change. For example:

Dim projects As AeccProjects

Set projects = AeccApplication.Projects


' Get the first project in the collection

Dim project As AeccProject

Set project = projects(0)


' Change the project path

projects.Path = "c:\projects2"


' Project is a valid object, but no longer represents

' the first item in the projects collection

' refresh project

Set project = projects(0)

Changing the Active Project

When a drawing is opened from a different project, the AeccApplication.ActiveProject object and AeccApplication.Projects collection are released. For this reason, it is a good idea to get these objects as needed instead of holding on to them for the duration of your application.

Notifications for changes to drawing settings

The settings exposed by the DatabasePreferences object are stored in the AcDbDictionary named "AEC_VARS". The "AEC_VARS_DWG_SETUP" key returns an AecDbVarsDwgSetup object that stores the base settings for Architecture and Civil Engineering. The "AEC_VARS_CIVILSETUP" key returns an AcDbVarsCivilSetup object stores the AutoCAD Land Desktop specific settings.

To receive events when drawing settings are changed, implement an event handler in a class module, declare an object of type AcadObject with events, and assign the desired dictionary object to the handler in your code module or form.