ActiveX Developer's Guide (ActiveX/VBA)

The ActiveX Developer's guide provides you with an overview of the main topics and workflows for using the AutoCAD ActiveX Object Library and the Microsoft Visual Basic for Applications Integrated Development Environment.



Tutorial: Design the Garden Path



AutoCAD ActiveX Technology

AutoCAD Visual Basic for Applications Interface

AutoCAD ActiveX and VBA Together

Using ActiveX Automation with the Microsoft .NET Framework

Sample Code

Migrating Automation Projects

ActiveX API History

More Information

Getting Started with VBA

Embedded and Global VBA Projects

Organizing Your Projects with the VBA Manager

Handling Your Macros

Editing Your Projects with the VBA IDE

Exercise: An Introduction to VBA

AutoCAD VBA Project Terms

More Information on the VBA IDE

Develop Applications with VBA

Forms in VBA

Handling Errors

Encrypting VBA Code Modules

Running a VBA Macro from a Toolbar or Menu

Automatically Loading a VBA Project

Automatically Running a VBA Macro

Automatically Opening the VBA IDE Whenever a Project Is Loaded

Working in a Zero Document State

Distributing Your Application

Migrating VBA Projects and Other Applications that Use the ActiveX API

VBA Terminology


AutoCAD VBA Commands

AutoCAD VBA Related AutoLISP Functions

Visual LISP and ActiveX/VBA Comparison


Using ActiveX Automation

AutoCAD Object Model

Accessing the Object Hierarchy

Collection Objects

Properties and Methods

Parent Objects

Locating the Type Library

Using Variants in Methods and Properties

Using Other Programming Languages

Controlling the AutoCAD Environment

Opening, Saving, and Closing Drawings

Setting AutoCAD Preferences

Controlling the Application Window

Controlling the Drawing Windows

Resetting Active Objects

Setting and Returning System Variables

Drawing with Precision

Prompting for User Input

Accessing the AutoCAD Command Line

Working with No Documents Open

Importing Other File Formats

Exporting to Other File Formats

Creating and Editing Entities

Creating Objects

Working with Selection Sets

Modifying Objects

Assigning Layers, Colors, and Linetypes to Objects

Saving and Restoring Layer Settings

Adding Text to Drawings

Adding Dimensions and Tolerances

Dimensioning Concepts

Creating Dimensions

Editing Dimensions

Working with Dimension Styles

Dimensioning in Model Space and Paper Space

Creating Leaders and Annotation

Using Geometric Tolerances


Working in Three-Dimensional Space

Specifying 3D Coordinates

Defining a User Coordinate System

Converting Coordinates

Creating 3D Objects

Editing in 3D

Editing 3D Solids

Drawing and Organizational Techniques

Working with Raster Images

Using Blocks and Attributes

Using External References

Assigning and Retrieving Extended Data

Defining and Plotting Layouts

Model Space and Paper Space



Plotting Your Drawing

Registering Events

Events in AutoCAD

Event Handlers

Handling Application Level Events

Handling Document Level Events

Handling Object Level Events


Customize Toolbars and Menus

MenuBar and MenuGroups Collections

Loading Menu Groups

Changing the Menu Bar

Creating and Editing Pull-Down and Shortcut Menus

Creating and Editing Toolbars

Creating Macros

Creating Status-Line Help for Menu Items and Toolbar Items

Adding Entries to the Right-Click Menu

Interacting with Other Applications and Windows APIs

Interacting with Visual LISP Applications

Interacting with Other Windows Applications

Accessing Windows APIs from VBA