AutoCAD VBA Programming: Tools and Techniques

Document Object Methods

From the document object, all other objects inside a drawing are accessed. For example, if you were interested in getting to the layer table, you would use the ThisDrawing.Layers property to obtain the link to the layer.collection object. The individual layer names and their respective properties are each found inside the layer collection.

The following is a partial list of methods that you can access with the document object. File accessing and global drawing settings are the primary activities that take place within these methods.

Method

What it does

Activate

Makes This Drawing the current document when in multiple document mode.

Close

Closes the drawing.

Export Import

Outputs and inputs drawing information in DXF, WMF, BMP, SAT, or EPS type files. These file formats are used by other applications for storing graphic data.

GetVariable SetVariable

Retrieve or set the value of a specified AutoCAD system variable.

HandleToObject

Converts a handle (string) into an object reference. When you're reading handles from an external database and want to locate the associated object, you will use this function extensively.

LoadShapeFile

Loads a shape file into the current drawing. Shape files are used in custom linetypes and as a possible substitute for blocks. This method loads the entire shape file for access by other commands.

New

Starts a new drawing based on a template drawing in single document mode. For multiple document mode, the Add method should be used from the documents collection.

Open

Opens an existing drawing in single document...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Computer-Aided Design (CAD) Services
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.