Cadalyst - September 2008 - (Page 46) hottipharry By Bill Kramer VBA Hints for Customizing AutoCAD Harry shares some Visual Basic favorites as well as this month’s top tip for making custom linetype. H arry smiled as he handed over a couple of tips. “Got these cool VBA examples that are just what some of your readers wanted. Little rough on the edges but still good. Hope they help.” And with that, he was out the door. Tip 3007: Integrated Database Integrated Database is a rather complex VBA example program for producing a material list with an integrated Microsoft Access database. The tip serves more as a useful example for study by VBA students than as a utility you can put right to work. Supplied by Andrew Maser and written according to in-house standards at McBride Engineering, it demonstrates quite a few VBA features, such as how to interface with an Access database and how to automate the creation of a bill of materials for cost estimation. Tip 3006: Script Manager Let’s start with the VBA tips. Script Manager by Ed Jobe is a VBA-based utility to manage and run script files in a custom folder. Before you can use this tip, you will need to load it into AutoCAD’s VBA editor (use VBAman to load the file, then VBAide to edit it) and change the starting and personal folder paths. Module 1 contains a brief description of the edits required to make this work for your setup. After you make the needed changes, this routine, which is launched by LISP macros in supplied examples, will present a dialog box of the script files available to run. You can edit, rename, run, or delete existing scripts or create a new script to run in Notepad. This utility is a great example for those just learning VBA, and it’s quite useful if you have a library of scripts to manage. tects who create all the layers needed for the American Institute of Architects standards according to the 1997 AIA CAD Layer Guidelines. The utility creates a long list of layers with linetypes and colors. Layers are created only if they don’t already exist in the drawing, thus the utility will not interfere with the use of prototype drawings. To use this utility, simply load the LISP code and type AIALayers2009 at the AutoCAD Command line. (Note that a separate download file, AIALayers.LSP, is included for pre-AutoCAD 2009 compatibility.) Tip 3008: Rename Layouts Rename Layouts from James Sturgess is a neat little AutoLISP routine for naming layouts based on a text or an attribute selection within a drawing. After you load the LISP code, select the layout tab you want to modify to make it current and type NLay. You will be asked to select a text or an attribute object. The layout is renamed to the value in the text string. Tip 3011: Create Custom Linetype This month’s top tip by Ron Perez is Create Custom Linetype, which automates the steps needed to make a custom linetype with embedded characters. Load the LISP code and type MakeLT to start it. You will be asked to supply a string to be embedded in the linetype. Type in the characters and select Enter. A temporary linetype file definition is created and loaded into the current drawing. All you need to do now is relate it to a layer name, and it is ready to go. This is a nice timesaver for those who make custom linetypes, and it’s well deserving of this month’s top tip prize! If you have a tip you’d like to contribute, Harry has some very nice T-shirts to trade for your code. Maybe your code will be selected as a top tip — an honor not everyone can boast — and Harry will throw in an extra $100. Cadalyst contributing editor Bill Kramer has been programming AutoCAD solutions, writing magazine articles and books, and teaching CAD/CAM/CAE customization for more than 20 years. Bill wrote the first article about AutoLISP in Cadalyst back in 1986. www.cadalyst.com cadalyst September 2008 www.cadalyst.com cadalyst August Tip 3009: Duct Transition Shawn Evjen submitted Duct Transition, an expert drafting utility that skillfully creates the transition element graphic between two different duct sizes given just a few selections. Load the LISP code and type Duct_Trans when you are ready to draw a transition section. First, select one edge of the existing duct (end point). Next, pick a point toward the opposite side (perpendicular to the ductrun direction). Last, enter the initial duct size (default is the distance between the two points just described) and the ending duct size. A transitional element (drawn using polylines on the current layer) is the automatic result. Get the Code! Download Harry’s code at Cadalyst’s new CAD Tips site, www.cadalyst.com/ cadtips. Search for the tip of your choice by tip number or keyword. Downloads are free, provided as is without warranty or support. Tips included in “Hot Tip Harry” are tested with AutoCAD 2008, unless otherwise noted. Review tip submission guidelines at www.cadalyst.com/ tips and then submit your AutoCAD tip to harry@cadalyst.com. Authors of all published tips will receive a Cadalyst T-shirt. The author of Harry’s Top Tip each month will win a $100 cash prize, and all published authors will be entered in the Hot Tip Harry 2008 Hot Code Contest random drawing for a chance to win a trip to Autodesk University 2008. Tip 3010: AIA Standard Layers Michael Stachulak provided AIA Standard Layers, a must-have utility for archi- 46 http://www.cadalyst.com/cadtips http://www.cadalyst.com/cadtips http://www.cadalyst.com/tips http://www.cadalyst.com/tips http://www.cadalyst.com
Table of Contents Feed for the Digital Edition of Cadalyst - September 2008 Cadalyst - September 2008 Contents Editor's Window Cad Central Tech Trends: Genie Out of the Bottle Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects Cadalyst Labs Reviews: AutoCAD 2009 — General-Purpose CAD Software Cadalyst Labs Reviews: AecBatchStylesEditor 2009 — CAD Standards Management Software for AEC Cad manager: Synchronize CAD Files over a Wide Area MCAD Modeling: Is 2D Drawing Doomed? Plm Strategies: More Bang for Your Truck Aec Insight: Works and Plays Well with Others Cad Cartoon Issue Indexes Hot Tip Harry: VBA Hints for Customizing AutoCAD Cadalyst - September 2008 Cadalyst - September 2008 - Cadalyst - September 2008 (Page Cover1) Cadalyst - September 2008 - Cadalyst - September 2008 (Page Cover2) Cadalyst - September 2008 - Contents (Page 3) Cadalyst - September 2008 - Contents (Page 4) Cadalyst - September 2008 - Contents (Page 5) Cadalyst - September 2008 - Editor's Window (Page 6) Cadalyst - September 2008 - Editor's Window (Page 7) Cadalyst - September 2008 - Editor's Window (Page 8) Cadalyst - September 2008 - Editor's Window (Page 9) Cadalyst - September 2008 - Cad Central (Page 10) Cadalyst - September 2008 - Cad Central (Page 11) Cadalyst - September 2008 - Cad Central (Page 12) Cadalyst - September 2008 - Cad Central (Page 13) Cadalyst - September 2008 - Tech Trends: Genie Out of the Bottle (Page 14) Cadalyst - September 2008 - Tech Trends: Genie Out of the Bottle (Page 15) Cadalyst - September 2008 - Tech Trends: Genie Out of the Bottle (Page 16) Cadalyst - September 2008 - Tech Trends: Genie Out of the Bottle (Page 17) Cadalyst - September 2008 - Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects (Page 18) Cadalyst - September 2008 - Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects (Page 19) Cadalyst - September 2008 - Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects (Page 20) Cadalyst - September 2008 - Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects (Page 21) Cadalyst - September 2008 - Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects (Page 22) Cadalyst - September 2008 - Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects (Page 23) Cadalyst - September 2008 - Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects (Page 24) Cadalyst - September 2008 - Cadalyst Labs Reviews: Big Tools for Big Jobs — Wide-Format Scanners and Printers Make Small Work of Large Projects (Page 25) Cadalyst - September 2008 - Cadalyst Labs Reviews: AutoCAD 2009 — General-Purpose CAD Software (Page 26) Cadalyst - September 2008 - Cadalyst Labs Reviews: AutoCAD 2009 — General-Purpose CAD Software (Page 27) Cadalyst - September 2008 - Cadalyst Labs Reviews: AutoCAD 2009 — General-Purpose CAD Software (Page 28) Cadalyst - September 2008 - Cadalyst Labs Reviews: AutoCAD 2009 — General-Purpose CAD Software (Page 29) Cadalyst - September 2008 - Cadalyst Labs Reviews: AecBatchStylesEditor 2009 — CAD Standards Management Software for AEC (Page 30) Cadalyst - September 2008 - Cadalyst Labs Reviews: AecBatchStylesEditor 2009 — CAD Standards Management Software for AEC (Page 31) Cadalyst - September 2008 - Cad manager: Synchronize CAD Files over a Wide Area (Page 32) Cadalyst - September 2008 - Cad manager: Synchronize CAD Files over a Wide Area (Page 33) Cadalyst - September 2008 - Cad manager: Synchronize CAD Files over a Wide Area (Page 34) Cadalyst - September 2008 - Cad manager: Synchronize CAD Files over a Wide Area (Page 35) Cadalyst - September 2008 - MCAD Modeling: Is 2D Drawing Doomed? (Page 36) Cadalyst - September 2008 - MCAD Modeling: Is 2D Drawing Doomed? (Page 37) Cadalyst - September 2008 - Plm Strategies: More Bang for Your Truck (Page 38) Cadalyst - September 2008 - Plm Strategies: More Bang for Your Truck (Page 39) Cadalyst - September 2008 - Aec Insight: Works and Plays Well with Others (Page 40) Cadalyst - September 2008 - Aec Insight: Works and Plays Well with Others (Page 41) Cadalyst - September 2008 - Issue Indexes (Page 42) Cadalyst - September 2008 - Issue Indexes (Page 43) Cadalyst - September 2008 - Issue Indexes (Page 44) Cadalyst - September 2008 - Issue Indexes (Page 45) Cadalyst - September 2008 - Hot Tip Harry: VBA Hints for Customizing AutoCAD (Page 46) Cadalyst - September 2008 - Hot Tip Harry: VBA Hints for Customizing AutoCAD (Page Cover3) Cadalyst - September 2008 - Hot Tip Harry: VBA Hints for Customizing AutoCAD (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.