Document Object (ActiveX)

An AutoCAD drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadDocument

Object Inheritance
Object
   AcadDatabase
      AcadDocument
Create Using

VBA

Documents.Add
Documents.Open
Document.New
Access Via

VBA

Documents.Item
Application.ActiveDocument

Members

These members are part of this object:

Remarks

The active document (AutoCAD drawing) can be accessed using ThisDrawing in VBA, or through the ActiveDocument property in VB. Because AutoCAD works with only one document at a time, and that document represents one database, the active document can be thought of as the current database as well as the current document.

Certain objects in the drawing establish the format, location, or style that new objects being added to the drawing will adopt. These objects include the DimensionStyle, TextStyle, Linetype, Viewport, and Layer objects. A drawing may contain many of these types of objects, but only one may be active at a time. For example, there may be several linetypes available in a drawing, but only one, designated as the active one, will be used when creating a new entity. The Document object contains the references to these active objects. To set an existing object as the active object, use the properties listed below.

The Document object also contains a property (or link) for all the collections. From these collections, you can iterate through every object in the drawing.

To access drawing properties such as Title , Subject, Author, and Keywords , the AcadSummaryInfo interface, accessible as a property of the Document object, must be used.

To create or open a Document object, use the Open method.

Using Paper Space and Model Space
From the Document object, you control the model space and paper space settings. By default, a drawing is opened in the model space, with the tiled viewport setting. Use the ActiveSpace property, MSpace property, and the Display method to control the model space and paper space settings. See the PViewport object for more information about using these properties and methods.
Resetting Active Objects
Changes to most active objects, such as the active layer and active linetype, are displayed immediately. However, several objects must be reset for changes to appear. These objects are the active text style, active UCS, and the active viewport. To reset the objects, simply call the ActiveTextStyle, ActiveUCS, or ActiveViewport property, using the updated object.

Release Information

Releases: AutoCAD 2000 and later