AutoCAD VBA Programming: Tools and Techniques

Utility Object Functions

Now let's look at some more useful programmer functions that can be found inside the document object. These methods are associated with the Utility object of a document. The Utility object houses the functions and does not contain any data properties of interest.

To get to the utility functions, you'll access the Utility property of the current drawing, ThisDrawing. The functions in the utility object include user input via the graphics system as well as conversion of data not available in VBA. These functions will seem like old favorites for AutoLISP programmers, as they are almost identical in both languages. For those programmers just learning AutoCAD and VBA, these functions allow direct access to the AutoCAD interface for point selection, command line input (instead of using forms), and for converting AutoCAD data from one format to another.

Because AutoCAD is an interactive CAD system, all programming interfaces for the system must be able to communicate with the AutoCAD input and output system directly. The Utility object's methods provide the tools needed to talk to the user through the traditional AutoCAD interface methodologies from VBA. That is, the user can select a point, pick an object, or type in a response to a question appearing in the command line area of the display.

The functions shown in the table below are for converting data from one format to another. Most of the conversion utilities deal with angles and points in ways that normal BASIC does not.

Function

What...

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.