| |
| |
Introduction | |
| |
| |
| |
The AutoCAD VBA Environment | |
| |
| |
AutoCAD Programming Solutions | |
| |
| |
How AutoLISP Differs from VBA | |
| |
| |
Visual BASIC versus Visual BASIC for Applications | |
| |
| |
Essential VBA Vocabulary and Concepts | |
| |
| |
Getting Comfortable with the IDE | |
| |
| |
Starting the VBA IDE | |
| |
| |
What's in the IDE? | |
| |
| |
Developing Applications with VBA inside AutoCad | |
| |
| |
| |
VBA Application Jump-Start | |
| |
| |
Description of the Application | |
| |
| |
Start Your IDE | |
| |
| |
Design the Form | |
| |
| |
First Lines of Program Code | |
| |
| |
Form Properties | |
| |
| |
Add a List Box Control | |
| |
| |
Programming the Starting Sequence | |
| |
| |
Global Variable Declarations | |
| |
| |
Counting Blocks Macro | |
| |
| |
Test Run the Main Macro | |
| |
| |
List Box Reactor Function | |
| |
| |
Test the Program | |
| |
| |
Final Test | |
| |
| |
| |
Understanding the AutoCAD Object-Oriented Database | |
| |
| |
Object-Oriented Programming Introduction | |
| |
| |
What's an Object? | |
| |
| |
The Management Features of Objects | |
| |
| |
Object Concept Example | |
| |
| |
Computer Science Description of Objects | |
| |
| |
How Objects Are Stored in a Computer | |
| |
| |
About Creating New Objects | |
| |
| |
The AutoCAD Object Tree | |
| |
| |
The Document Object | |
| |
| |
Collection Objects | |
| |
| |
The Block Collection Object | |
| |
| |
Entity Objects | |
| |
| |
Learning about Objects in VBA | |
| |
| |
| |
The AutoCAD Object Model | |
| |
| |
Methods, Properties, and Events | |
| |
| |
Exploration of the AutoCAD Object Tree | |
| |
| |
Getting to the Application Object | |
| |
| |
The Application Object | |
| |
| |
Accessing the Document Object in VB | |
| |
| |
The Documents Collection | |
| |
| |
Document Object Methods | |
| |
| |
Document Object Properties | |
| |
| |
Document Object Events | |
| |
| |
Event Programming Example | |
| |
| |
Utility Object Functions | |
| |
| |
Collections of Objects | |
| |
| |
Entity Objects | |
| |
| |
Curved Entity Objects | |
| |
| |
Text Entity Objects | |
| |
| |
Preferences | |
| |
| |
Example Sequence | |
| |
| |
| |
Working with Entity Collection Objects | |
| |
| |
The Collection Object | |
| |
| |
Selection Sets Collection | |
| |
| |
Building a Collection of Entity Objects | |
| |
| |
Accessing Selection Set Members | |
| |
| |
More Selection Set Methods and Properties | |
| |
| |
Selection Set Collection Iterations | |
| |
| |
ModelSpace and PaperSpace Collections | |
| |
| |
Even More Selection Set Methods | |
| |
| |
Filtering the Selection Set | |
| |
| |
Refining the Filters - Numeric Tests | |
| |
| |
String Tests in Filters | |
| |
| |
Combining Multiple Tests | |
| |
| |
Selection Set Maintenance Issues | |
| |
| |
Working with Collections | |
| |
| |
| |
Dawing Tables | |
| |
| |
AutoCAD Drawing Tables | |
| |
| |
Tables Are Collections | |
| |
| |
The Dictionary Collection | |
| |
| |
The DimStyles Collection | |
| |
| |
The Groups Collection | |
| |
| |
Groups versus Dictionaries | |
| |
| |
The Layer Collection | |
| |
| |
The Linetypes Collection | |
| |
| |
The Registered Apps Collection | |
| |
| |
The Text Styles Collection | |
| |
| |
The UCS Collection | |
| |
| |
The Views Collection | |
| |
| |
The View Ports Collection | |
| |
| |
View Port Object | |
| |
| |
The Paper Space View Port Object | |
| |
| |
The Blocks Collection | |
| |
| |
Creating a New Block Definition | |
| |
| |
Reading a Block Definition | |
| |
| |
Working with Attribute Objects in a Block | |
| |
| |
| |
Working with Other Applications | |
| |
| |
Object Models | |
| |
| |
Interface to Microsoft Excel | |
| |
| |
Excel Application 1-Simple Database | |
| |
| |
Link to Excel | |
| |
| |
Variable Declarations | |
| |
| |
Excel Linkage Function | |
| |
| |
Closing the Workbook | |
| |
| |
Searching the Worksheet | |
| |
| |
Another Example Interface to Microsoft Excel | |
| |
| |
Using Handles | |
| |
| |
Object ID versus Handle | |
| |
| |
Linking with Other Applications | |
| |
| |
Storing Data in AutoCAD | |
| |
| |
Dictionary Object | |
| |
| |
Xrecord Objects | |
| |
| |
Accessing a Dictionary | |
| |
| |
Xrecord Contents | |
| |
| |
Reading Xrecords | |
| |
| |
Group Codes in Xrecords | |
| |
| |
Extended Data | |
| |
| |
Simple Xdata Example | |
| |
| |
| |
Managing Multiple Projects | |
| |
| |
Putting Complete Applications Together | |
| |
| |
Loading Projects to Run | |
| |
| |
Embedded Projects | |
| |
| |
Projects on Disk | |
| |
| |
Re-using Code | |
| |
| |
Running a Macro from Another Project | |
| |
| |
Sharing Data between Projects | |
| |
| |
Late and Early Binding in VBA | |
| |
| |
Multiple Projects in Release 14 | |
| |
| |
| |
API Calls from VBA | |
| |
| |
What's an API? | |
| |
| |
The API Viewer | |
| |
| |
INI File Calls | |
| |
| |
How the PrivateProfile String APIs Work | |
| |
| |
Registry Calls | |
| |
| |
The Registry Editor | |
| |
| |
The VBA Registry Functions | |
| |
| |
System Calls | |
| |
| |
Computer Name | |
| |
| |
User's Login Name | |
| |
| |
System and Local Time | |
| |
| |
The Windows Temporary Directory | |
| |
| |
System Environmental Variable | |
| |
| |
Free Disk Space | |
| |
| |
Conclusion | |
| |
| |
| |
VBA Toolbox Routines | |
| |
| |
Definition of Terms | |
| |
| |
Toolbox Overview | |
| |
| |
Acquiring Data Items from a Data String | |
| |
| |
Add Back Slashes Result to a Path String | |
| |
| |
Add Trailing Back Slash to a String Path | |
| |
| |
Convert an Object's Entity Type to English | |
| |
| |
Count the Number of Occurrences of a Delimiter in a String | |
| |
| |
Create a Directory Path | |
| |
| |
Determine the Tense of a Word | |
| |
| |
Display a Fatal Error Message | |
| |
| |
Find a File | |
| |
| |
Find a Line in a List Box Control | |
| |
| |
Find an Application Window | |
| |
| |
Format a Point in a String | |
| |
| |
Get the Current View's Corner Points | |
| |
| |
Get the Extension from a String | |
| |
| |
Get the Left Substring from a String | |
| |
| |
Get the Path from a String | |
| |
| |
Get the Right Substring from a String | |
| |
| |
Pad a String with Spaces | |
| |
| |
Remove a String's Null Terminator | |
| |
| |
Replace all Requested Characters in a String with Another Character | |
| |
| |
Retrieve the System's Windows Directory | |
| |
| |
Show a Progress Spinner | |
| |
| |
Strip an Extension from a String | |
| |
| |
Strip the Path from a String | |
| |
| |
Verify a Control Exists on a Form | |
| |
| |
Verify a File's Existence | |
| |
| |
Verify a Listbox Item Exists | |
| |
| |
| |
VB versus VBA | |
| |
| |
Quick Comparison of VB and VBA | |
| |
| |
Which Language for Which Situation? | |
| |
| |
Differences at the System Level | |
| |
| |
Porting Issues - from VB to VBA | |
| |
| |
Porting Issues - from VBA to VB | |
| |
| |
Attaching Your VB Application to the AutoCAD Object Model | |
| |
| |
VB and VBA Help | |
| |
| |
VB and VBA Help Conclusion | |
| |
| |
| |
Gotcha's and Tips | |
| |
| |
Divergent Data Type Comparison | |
| |
| |
Using Control Keys to Maneuver in VBA | |
| |
| |
Class Modules in VBA | |
| |
| |
The Special Character for Date and Format | |
| |
| |
Named and Optional Arguments | |
| |
| |
Using an Array of Doubles versus a Variant as an Array | |
| |
| |
Passing an Array to an Object's Methods | |
| |
| |
Collections and Procedures | |
| |
| |
Short Circuit Evaluation | |
| |
| |
Accessing Objects on the Same Level as Your Current Object | |
| |
| |
Listbox Columns | |
| |
| |
Multiselect in a Listbox | |
| |
| |
Variable Name Shortcuts | |
| |
| |
Command Line Workaround | |
| |
| |
Passing Forms and Controls as Parameters | |
| |
| |
Multipage Form Controls | |
| |
| |
Conclusion | |
| |
| |
| |
Programming Style | |
| |
| |
Commenting Your Code | |
| |
| |
Keeping Code Concise and Simple | |
| |
| |
Proper Use of Subroutines and Functions | |
| |
| |
Scope, Precedence, and Life of Variables | |
| |
| |
Error Trapping | |
| |
| |
Do You Need to Change Your Programming Style for VBA? | |
| |
| |
Event-Driven versus Procedural-Driven Language | |
| |
| |
The Hungarian Naming Convention | |
| |
| |
Conclusion | |
| |
| |
| |
Class Modules and Objects | |
| |
| |
Not All Objects Are Equal | |
| |
| |
The VBA Class Module | |
| |
| |
Objects Example 1: Extended Data Manipulations | |
| |
| |
Making a Class Module | |
| |
| |
Properties | |
| |
| |
Methods | |
| |
| |
The Extended Data Example Project | |
| |
| |
Extended Data Object Conclusion | |
| |
| |
Objects Example 2: Hole Chart | |
| |
| |
An Object in an Object | |
| |
| |
The Inner Object | |
| |
| |
The Hole Charting Example Project | |
| |
| |
Hole Chart Application Conclusion | |
| |
| |
Creating Your Own Object | |