Скачать книгу

how Lee approached programming solutions for AutoCAD. VBA made it much easier to communicate with external databases and other applications that supported VBA. It transformed the way information could be moved between project management and manufacturing systems.

      Not being content with VBA, in 1999 Lee attended his first Autodesk University and began to learn ObjectARX®. Autodesk University had a lasting impression on him. In 2001, he started helping as a lab assistant. He began presenting on customizing and programming AutoCAD at the event in 2004. Along the way he learned how to use the AutoCAD Managed.NET API.

      In 2005, Lee decided cubicle life was no longer for him, so he ventured off into the CAD industry as an independent consultant and programmer with his own company, HyperPics, LLC. After he spent a couple of years as a consultant, Autodesk invited him to work on the AutoCAD team; he has been on the AutoCAD team since 2007. For most of his career at Autodesk, Lee has worked primarily on the customization and end-user documentation. Recently, he has been working on the AutoLISP, VBA, ObjectARX,.NET, and JavaScript programming documentation.

      In addition to working on documentation, Lee has been involved as a technical editor or author for various editions of AutoCAD and AutoCAD LT Bible, AutoCAD for Dummies, AutoCAD & AutoCAD LT All-in-One Desk Reference for Dummies, AutoCAD 3D Modeling Workbook for Dummies, and Mastering AutoCAD for Mac. He has also written white papers on customization for Autodesk and a variety of articles on customization and programming for AUGIWorld, published by AUGI®.

      Introduction

      Welcome to AutoCAD Platform Customization: User Interface, AutoLISP, VBA, and Beyond. Have you ever thought about customizing AutoCAD only to think it is not for you because you're not a programmer? If so, you are not alone, as there are many people that connect customization with programming. However, customization is not the same as programming, but programming can be considered a form of customization.

      While using one of the supported programming languages can be useful in implementing custom workflows and new commands, there are many simpler ways to increase your drafting efficiency in a shorter period of time. AutoCAD supports a wide range of customization features that you can learn and begin to leverage in minutes, which can led to improved CAD standards and a decrease in the amount of time it takes to complete a task.

      I, like many others, even yourself most likely, have customized AutoCAD without even realizing it. Have you ever created a new layer, text style, or block? Chances are pretty great that you have created one or more of those items before. You might have even stored those items in a drawing template (DWT) file so they would be available each time a new drawing was created. While you might not have thought about these as forms of customization, they are indeed a few of the basic drawing customization features that can be used to enhance the out-of-box AutoCAD experience.

      Drawing customization affects the appearance of and settings in a drawing file or drawing template (DWT) file, and should form the cornerstone of your company's CAD standards. Often when people think of customization though, they commonly think of application customization, which contains the support files that AutoCAD uses as well as the tools in the application's user interface. Application customization is not dependent on which drawing is currently open, but which user profile or workspace might be current.

      About This Book

      The AutoCAD Platform Customization: User Interface, AutoLISP, VBA, and Beyond book covers many of the customization and programming features that can be found in AutoCAD on Windows and Mac OS X. This book covers most of the customization features available along with two of the easier to learn programming languages that AutoCAD supports. If any of the following are true, this book will be useful to you:

      • Want to learn about which customization and programming options are available in AutoCAD.

      • Want to customize the user interface or support files, such as linetypes and hatch patterns, that AutoCAD utilizes.

      • Want to automate repetitive tasks.

      • Want to create and manage CAD standards for your company.

      • Want to learn how to create custom programs with AutoLISP or Visual Basic for Applications (VBA).

      Customization in AutoCAD

      Customization is one of the feature areas that sets AutoCAD apart from many other CAD programs. Even though the product can be used out of the box, configuring the user interface and modifying the support files that come with the product can greatly improve your productivity. By customizing AutoCAD, you can streamline product workflows and create new ones that are a better fit with the way your company works. These workflows might range from importing layers and styles into a drawing to the extraction of drawing-based information into a spreadsheet or database.

      Not all of the customization features require you to learn a new tool or skill set; chances are you might have customized AutoCAD and not even realized it. If you have ever created a layer or a block, you already understand some of the customization features of AutoCAD.

      The following outlines many of the common customization and programming options available:

      Basic

      • Layers

      • Annotation styles (text, dimensions, multileaders, and tables)

      • Layouts

      • Blocks

      • Plot styles

      • Plotters

      • Page setups

      • Materials, visual styles, and render presets

      • Drawing templates

      • Command aliases

      • User profiles (Windows only)

      • Workspaces (Windows only)

      • Desktop icon customization (Windows only)

      • Tool palettes (Windows only)

      Intermediate

      • Scripts

      • User interface (CUIx) and DIESEL

      • Linetypes and hatch patterns

      • Shapes and text styles

      • Action macros (Windows only)

      • Dynamic blocks (Windows only)

      Advanced

      • AutoLISP

      • ObjectARX

      • Visual Basic for Applications (Windows only)

      • ActiveX/COM (Windows only)

      • Database connectivity (Windows only)

      • Sheet Set Manager API (Windows only)

      • CAD Standards plug-ins (Windows only)

      • Transmittal API (Windows only)

      • Managed.NET (Windows only)

      • JavaScript (Windows only)

      AutoLISP in AutoCAD

      AutoLISP is the most popular, and is the original supported programming language for the AutoCAD program. The reason for its popularity with new (and even veteran) programmers is that it is a natural extension of the AutoCAD program. There is no additional software to purchase, and AutoLISP can leverage the commands that Autodesk and third-party developers expose at the Command prompt. For example, with a few simple lines of code you can set a layer current and insert a title block with a specific insertion point, scale, and rotation. The block is then inserted on the layer you specified. To perform the same tasks manually, the end user would have to first set a layer current, choose the block they want to insert, and specify the properties of the block, which in the case of a title block are almost always the same.

      The AutoLISP programming language can be used to:

      • Create custom functions that can be executed from the AutoCAD Command prompt

      • Create

Скачать книгу