- •Foreword
- •Preface
- •Is This Book for You?
- •How This Book Is Organized
- •How to Use This Book
- •Doing the Exercises
- •Conventions Used in This Book
- •What the Icons Mean
- •About the CD-ROM
- •Other Information
- •Contacting the Author
- •Acknowledgments
- •Contents at a Glance
- •Contents
- •Getting Acquainted with AutoCAD and AutoCAD LT
- •Starting AutoCAD and AutoCAD LT
- •Creating a New Drawing
- •Using the AutoCAD and AutoCAD LT Interface
- •Creating Your First Drawing
- •Saving a Drawing
- •Summary
- •Creating a New Drawing from a Template
- •Working with Templates
- •Opening a Drawing with Default Settings
- •Opening an Existing Drawing
- •Using an Existing Drawing as a Prototype
- •Saving a Drawing Under a New Name
- •Summary
- •The Command Line
- •Command Techniques
- •Of Mice and Pucks
- •Getting Help
- •Summary
- •Typing Coordinates
- •Displaying Coordinates
- •Picking Coordinates on the Screen
- •Locating Points
- •Summary
- •Unit Types
- •Drawing Limits
- •Understanding Scales
- •Inserting a Title Block
- •Common Setup Options
- •The MVSETUP Command
- •Summary
- •Using the LINE Command
- •Drawing Rectangles
- •Drawing Polygons
- •Creating Construction Lines
- •Creating Rays
- •Summary
- •Drawing Circles
- •Drawing Arcs
- •Creating Ellipses and Elliptical Arcs
- •Making Donuts
- •Placing Points
- •Summary
- •Panning
- •The ZOOM Command
- •Aerial View
- •Named Views
- •Tiled Viewports
- •Snap Rotation
- •User Coordinate Systems
- •Isometric Drawing
- •Summary
- •Editing a Drawing
- •Selecting Objects
- •Summary
- •Copying and Moving Objects
- •Using Construction Commands
- •Creating a Revision Cloud
- •Hiding Objects with a Wipeout
- •Double-Clicking to Edit Objects
- •Grips
- •Editing with the Properties Palette
- •Selection Filters
- •Groups
- •Summary
- •Working with Layers
- •Changing Object Color, Linetype, and Lineweight
- •Working with Linetype Scales
- •Importing Layers and Linetypes from Other Drawings
- •Matching Properties
- •Summary
- •Drawing-Level Information
- •Object-Level Information
- •Measurement Commands
- •AutoCAD’s Calculator
- •Summary
- •Creating Single-Line Text
- •Understanding Text Styles
- •Creating Multiline Text
- •Creating Tables
- •Inserting Fields
- •Managing Text
- •Finding Text in Your Drawing
- •Checking Your Spelling
- •Summary
- •Working with Dimensions
- •Drawing Linear Dimensions
- •Drawing Aligned Dimensions
- •Creating Baseline and Continued Dimensions
- •Dimensioning Arcs and Circles
- •Dimensioning Angles
- •Creating Ordinate Dimensions
- •Drawing Leaders
- •Using Quick Dimension
- •Editing Dimensions
- •Summary
- •Understanding Dimension Styles
- •Defining a New Dimension Style
- •Changing Dimension Styles
- •Creating Geometric Tolerances
- •Summary
- •Creating and Editing Polylines
- •Drawing and Editing Splines
- •Creating Regions
- •Creating Boundaries
- •Creating Hatches
- •Creating and Editing Multilines
- •Creating Dlines
- •Using the SKETCH Command
- •Digitizing Drawings with the TABLET Command
- •Summary
- •Preparing a Drawing for Plotting or Printing
- •Creating a Layout in Paper Space
- •Working with Plot Styles
- •Plotting a Drawing
- •Summary
- •Combining Objects into Blocks
- •Inserting Blocks and Files into Drawings
- •Managing Blocks
- •Using Windows Features
- •Working with Attributes
- •Summary
- •Understanding External References
- •Editing an Xref within Your Drawing
- •Controlling Xref Display
- •Managing Xrefs
- •Summary
- •Preparing for Database Connectivity
- •Connecting to Your Database
- •Linking Data to Drawing Objects
- •Creating Labels
- •Querying with the Query Editor
- •Working with Query Files
- •Summary
- •Working with 3D Coordinates
- •Using Elevation and Thickness
- •Working with the User Coordinate System
- •Summary
- •Working with the Standard Viewpoints
- •Using DDVPOINT
- •Working with the Tripod and Compass
- •Getting a Quick Plan View
- •Shading Your Drawing
- •Using 3D Orbit
- •Using Tiled Viewports
- •Defining a Perspective View
- •Laying Out 3D Drawings
- •Summary
- •Drawing Surfaces with 3DFACE
- •Drawing Surfaces with PFACE
- •Creating Polygon Meshes with 3DMESH
- •Drawing Standard 3D Shapes
- •Drawing a Revolved Surface
- •Drawing an Extruded Surface
- •Drawing Ruled Surfaces
- •Drawing Edge Surfaces
- •Summary
- •Drawing Standard Shapes
- •Creating Extruded Solids
- •Drawing Revolved Solids
- •Creating Complex Solids
- •Sectioning and Slicing Solids
- •Using Editing Commands in 3D
- •Editing Solids
- •Listing Solid Properties
- •Summary
- •Understanding Rendering
- •Creating Lights
- •Creating Scenes
- •Working with Materials
- •Using Backgrounds
- •Doing the Final Render
- •Summary
- •Accessing Drawing Components with the DesignCenter
- •Accessing Drawing Content with Tool Palettes
- •Setting Standards for Drawings
- •Organizing Your Drawings
- •Working with Sheet Sets
- •Maintaining Security
- •Keeping Track of Referenced Files
- •Handling Errors and Crashes
- •Managing Drawings from Prior Releases
- •Summary
- •Importing and Exporting Other File Formats
- •Working with Raster Images
- •Pasting, Linking, and Embedding Objects
- •Summary
- •Sending Drawings
- •Opening Drawings from the Web
- •Creating Object Hyperlinks
- •Publishing Drawings
- •Summary
- •Working with Customizable Files
- •Creating Keyboard Shortcuts for Commands
- •Customizing Toolbars
- •Customizing Tool Palettes
- •Summary
- •Creating Macros with Script Files
- •Creating Slide Shows
- •Creating Slide Libraries
- •Summary
- •Creating Linetypes
- •Creating Hatch Patterns
- •Summary
- •Creating Shapes
- •Creating Fonts
- •Summary
- •Working with Menu Files
- •Customizing a Menu
- •Summary
- •Introducing Visual LISP
- •Getting Help in Visual LISP
- •Working with AutoLISP Expressions
- •Using AutoLISP on the Command Line
- •Creating AutoLISP Files
- •Summary
- •Creating Variables
- •Working with AutoCAD Commands
- •Working with Lists
- •Setting Conditions
- •Managing Drawing Objects
- •Getting Input from the User
- •Putting on the Finishing Touches
- •Summary
- •Understanding Local and Global Variables
- •Working with Visual LISP ActiveX Functions
- •Debugging Code
- •Summary
- •Starting to Work with VBA
- •Writing VBA Code
- •Getting User Input
- •Creating Dialog Boxes
- •Modifying Objects
- •Debugging and Trapping Errors
- •Moving to Advanced Programming
- •A Final Word
- •Installing AutoCAD and AutoCAD LT
- •Configuring AutoCAD
- •Starting AutoCAD Your Way
- •Configuring a Plotter
- •System Requirements
- •Using the CD with Microsoft Windows
- •What’s on the CD
- •Troubleshooting
- •Index
Chapter 33 Customizing Menus 981
The code osmode 1 sets an endpoint object snap; osmode 7 sets object snaps for endpoint, midpoint, and center.
5.Save the file as ab5.mnu in your Support folder or another folder in the support-file search path. Minimize Notepad.
6.Open a new drawing using the acad.dwt or aclt.dwt template. Choose Zoom All from the Zoom flyout on the Standard toolbar. Choose Tools Customize Menus. On the Menu Groups tab, make sure that the Replace All check box is not checked. In the File Name text box, type ab5.mnu and click Load. Click Yes at the message warning you about overwriting toolbar changes. The menu file loads.
7.Choose the Menu Bar tab. Choose Window on the Menu Bar list and click Insert to insert the partial menu to the left of the Window menu. Click Close.
8.Choose Tools Customize Keyboard. From the Menu Group list, choose AB5. From the Commands drop-down list, choose 4 Circles.
9.Click the Press New Shortcut Key text box. Press F12. Click Assign and then click Close to close the dialog box.
10.Press Ctrl+up arrow (the up arrow on your keyboard). The snap changes to 1. Press Ctrl+down arrow. The snap changes to 0.25. (If the cursor doesn’t snap to the setting, you have PolarSnap on. Right-click SNAP on the status bar and choose Grid Snap On.)
11.Right-click OSNAP and choose Settings. In the Drafting Settings dialog box, uncheck all object snap modes and click OK.
12.Draw a line and a circle. Start the LINE command. At the Specify first point: prompt, press Ctrl+E. Pick either endpoint of the line. At the Specify next point or [Undo]: prompt, point to the circle and verify that you can’t find its Center object snap.
13.Press Ctrl+8 (on the keyboard). Now pick the circle’s Center object snap and end the LINE command.
14.Press F12. The 4 Circles menu item executes, drawing four circles.
15.Choose Tools Customize Menus to unload the AB5 menu group.
Don’t save your drawing.
Summary
In this chapter, you read about how to customize the menu to suit your situation and speed up your everyday work. Menu customization is very powerful. When you start customizing your menus, you suddenly find yourself thinking of new ways to use this option. The result will be a major improvement in the way AutoCAD or AutoCAD LT serves your needs.
This chapter ends Part VI, “Customizing AutoCAD and AutoCAD LT.” Part VII challenges you to go further in your customization of AutoCAD by starting to program with AutoLISP and Visual Basic for Applications.
|
|
|
Programming
AutoCAD
Part VII invites you to go the distance and start programming AutoCAD with AutoLISP, Visual LISP, and Visual Basic for Applications (VBA). AutoLISP is a powerful programming language that lets you quickly create your own commands and routines tai-
lored to your needs. Visual LISP adds an easy-to-use interface to AutoLISP programming.
VBA is a programming language that is supported by many Windows applications. You can create programs and dialog boxes for AutoCAD with VBA. Using ActiveX, which lets you access other Windows applications, you can write programs that integrate AutoCAD with other applications.
Unfortunately, AutoCAD LT doesn’t support either AutoLISP or VBA. Therefore, this entire part applies only to AutoCAD.
P A R T
VII
In This Part
Chapter 34
Understanding AutoLISP
and Visual LISP Basics
Chapter 35
Exploring AutoLISP
Further
Chapter 36
Exploring Advanced
AutoLISP Topics
Chapter 37
Programming with
Visual Basic for
Applications
Understanding
AutoLISP and
Visual LISP Basics
AutoLISP is a programming language that can substantially enhance your productivity by automating often-used or repeti-
tive tasks. AutoLISP provides a glimpse into the inner workings of AutoCAD and can serve as an excellent stepping stone to learning more-advanced automation methods, such as ObjectARX and VBA. An AutoLISP routine gives you complete control of its interaction with the user and what it does after it’s loaded.
AutoCAD LT doesn’t support AutoLISP, unfortunately.
You can type AutoLISP expressions on the command line in response to prompts, or you can save your code to a file that you can load and use when needed. AutoLISP offers wide and varied possibilities for shortcuts. Best of all, you can customize AutoLISP to any level of complexity.
AutoLISP intimidates many AutoCAD users, but this fear is unwarranted. The many benefits of AutoLISP well justify the initial time you invest to learn this rich and full-featured programming language.
You can also find a tremendous number of AutoLISP routines. Many CAD Web sites offer huge libraries of AutoLISP routines as free downloads. (For more details, see Bonus Chapter 2 on the CD.) Every office with more than a trivial number of AutoCAD workstations has probably created at least one AutoLISP routine to expedite some common task.
Many of the commands you already use in AutoCAD are in AutoLISP routines, including 3DARRAY, MVSETUP, AI_BOX, and others. You can often get examples of how to handle complex problems by reviewing these applications.
LISP stands for List Processing, and as you’ll see in the next chapter, the understanding of lists is crucial to using AutoLISP.
Most AutoLISP routines define a command name, which you then type at the command line to run the routine. Some routines include a dialog box to help you choose options and specifications.
34C H A P T E R
In This Chapter
Understanding AutoLISP programming and the Visual LISP environment
Working with the
Visual LISP interface
Getting help in
Visual LISP
Creating your own
AutoLISP expressions
Using AutoLISP on the command line