VBA Preview
in IntelliCAD 98 |
||
| Article Frank Zander explores some of the working and non-working parts of
IntelliCAD's Preview VBA and shows how to create a small program using IntelliCAD's
working VBA code. . |
VBA has fired the
curiosity of many IntelliCAD users. In Part I, Frank Zander explores some of the working
and non-working parts of IntelliCAD's Preview VBA. For the adventurous, in Part II he shows how to create a small 'rubber-stamp' program in
IntelliCAD's working VBA environment What
is VBA anyway? The preview edition of IntelliCAD 98s VBA is a limited subset of the available Objects, Methods and Properties. All of the IntelliCAD Objects, Methods and Properties are accessible to the VBA Object Browser by pressing F2 from within the VBA IDE. The Objects are, for the most part, stubbed out and are not currently live. This will all be live in a future release. Why use VBA when LISP is so well supported in IntelliCAD? Speed Ease-of-use Universality The VBA interface
To create a push button only requires a selection of the button control in the Toolbox and drawing/placing the control on a Form. It is very easy to create a Form that looks the way it will be used as a program. Buttons to push, Text boxes for entry, Option lists, etc., are a breeze to create, size and change. The ability to rapidly create a prototype interface for a new program is stunning to say the least. Also, the resulting Form can be saved and imported into any Windows VBA-enabled program. How to setup IntelliCAD for VBA
After you have done some work on your project it's a very good idea to save your project. IntelliCAD will not prompt you to save changes to a project when closing IntelliCAD. I learned this lesson the hard way. Luckily I only lost about a half of an hour of programming. Save your program/project often and definitely save your project before you exit IntelliCAD! To load an existing VBA project into IntelliCAD:
From the pull down menu select Tools > Visual Basic (Preview) > Load Project or at the command prompt type VBALOAD. IntelliCAD loads IntelliCAD VBA Project (*.vbi) and/or AutoCAD r14 VBA Project (*.dvb) files (see Figure 3). Also IntelliCAD can load multiple projects for editing at the same time. AutoCAD R14.01 can open only one at a time. It looks like, again, IntelliCAD understands Multiple Document Interface (MDI) better than Autodesk. Opening multiple drawings in IntelliCAD (MDI) makes editing drawings very productive. Opening multiple Projects for cutting and pasting code between projects makes programming remarkably productive. This is a very welcome innovation in IntelliCAD. Sample shipping VBI projects (for cutting and pasting code) can be located (using the typical/default IntelliCAD install) at: C:\Program Files\IntelliCAD\Api\Vb\ Describing objects in VBA The VBA preview in IntelliCAD did not work as I had hoped or expected; the lack of documentation for the preview VBA in IntelliCAD made it a struggle to create the "rubber stamp" project. I was extremely fortunate to find and use the Mtext object. I had no luck whatsoever in getting the Text object to create text within an IntelliCAD drawing. Possibly, I missed something. The preview VBA in IntelliCAD for using Forms works
wonderfully. The documentation for Forms in the IntelliCAD help-system is extensive and
well thought out. Every object (button, textbox, combobox, etc.) on a Form becomes a
sub-object of the Form. For example, the TextBox1 on UserForm1 is described as: To set the text information in TextBox1 on UserForm1
to display the current drawing name with the path, use the following code: Easy! For the curious owners of IntelliCAD, a picture of the IntelliCAD VBA Object model can be found in the file directory C:\Program Files\IntelliCAD\Api\Vb\ IcadObjectModel.jpg. Licking your lips for more VBA in IntelliCAD? Then proceed without delay to Part II where Frank Zander shows how to create a working program with VBA. This article was originally published in Technical Design Solutions |
|
Copyright © 1998-2001 DBM & others | Disclaimer | Privacy | Re-publication | Trademarks | Webmaster | Home |