Autodesk AutoCAD AutoCAD - 2011 Customization Guide

AutoCAD 2011
Customization Guide
February 2010
©
2010 Autodesk, Inc. All Rights Reserved. Except as otherwise permitted by Autodesk, Inc., this publication, or parts thereof, may not be
reproduced in any form, by any method, for any purpose.
Certain materials included in this publication are reprinted with the permission of the copyright holder.
The following are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and other countries: 3DEC (design/logo), 3December, 3December.com, 3ds Max, Algor, Alias, Alias (swirl design/logo), AliasStudio, Alias|Wavefront (design/logo), ATC, AUGI, AutoCAD, AutoCAD Learning Assistance, AutoCAD LT, AutoCAD Simulator, AutoCAD SQL Extension, AutoCAD SQL Interface, Autodesk, Autodesk Envision, Autodesk Intent, Autodesk Inventor, Autodesk Map, Autodesk MapGuide, Autodesk Streamline, AutoLISP, AutoSnap, AutoSketch, AutoTrack, Backburner, Backdraft, Built with ObjectARX (logo), Burn, Buzzsaw, CAiCE, Civil 3D, Cleaner, Cleaner Central, ClearScale, Colour Warper, Combustion, Communication Specification, Constructware, Content Explorer, Dancing Baby (image), DesignCenter, Design Doctor, Designer's Toolkit, DesignKids, DesignProf, DesignServer, DesignStudio, Design Web Format, Discreet, DWF, DWG, DWG (logo), DWG Extreme, DWG TrueConvert, DWG TrueView, DXF, Ecotect, Exposure, Extending the Design Team, Face Robot, FBX, Fempro, Fire, Flame, Flare, Flint, FMDesktop, Freewheel, GDX Driver, Green Building Studio, Heads-up Design, Heidi, HumanIK, IDEA Server, i-drop, ImageModeler, iMOUT, Incinerator, Inferno, Inventor, Inventor LT, Kaydara, Kaydara (design/logo), Kynapse, Kynogon, LandXplorer, Lustre, MatchMover, Maya, Mechanical Desktop, Moldflow, Moonbox, MotionBuilder, Movimento, MPA, MPA (design/logo), Moldflow Plastics Advisers, MPI, Moldflow Plastics Insight, MPX, MPX (design/logo), Moldflow Plastics Xpert, Mudbox, Multi-Master Editing, Navisworks, ObjectARX, ObjectDBX, Open Reality, Opticore, Opticore Opus, Pipeplus, PolarSnap, PortfolioWall, Powered with Autodesk Technology, Productstream, ProjectPoint, ProMaterials, RasterDWG, RealDWG, Real-time Roto, Recognize, Render Queue, Retimer,Reveal, Revit, Showcase, ShowMotion, SketchBook, Smoke, Softimage, Softimage|XSI (design/logo), Sparks, SteeringWheels, Stitcher, Stone, StudioTools, ToolClip, Topobase, Toxik, TrustedDWG, ViewCube, Visual, Visual LISP, Volo, Vtour, Wire, Wiretap, WiretapCentral, XSI, and XSI (design/logo).
All other brand names, product names or trademarks belong to their respective holders.
Disclaimer
THIS PUBLICATION AND THE INFORMATION CONTAINED HEREIN IS MADE AVAILABLE BY AUTODESK, INC. "AS IS." AUTODESK, INC. DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE REGARDING THESE MATERIALS.
Published by: Autodesk, Inc. 111 McInnis Parkway San Rafael, CA 94903, USA

Contents

Chapter 1 Basic Customization . . . . . . . . . . . . . . . . . . . . . . . . 1
Overview of Customization . . . . . . . . . . . . . . . . . . . . . . . . 1
Organize Program and Support Files . . . . . . . . . . . . . . . . . . . . 4
Overview of File Organization . . . . . . . . . . . . . . . . . . . . 4
Multiple Configurations . . . . . . . . . . . . . . . . . . . . . . . 7
Multiple Drawing Folders . . . . . . . . . . . . . . . . . . . . . . 8
Locate Customized Files . . . . . . . . . . . . . . . . . . . . . . . 10
Locate Data Link Files . . . . . . . . . . . . . . . . . . . . . 10
Locate Plot Style Files . . . . . . . . . . . . . . . . . . . . . 11
Locate Plotter Files . . . . . . . . . . . . . . . . . . . . . . 11
Locate the PMP File . . . . . . . . . . . . . . . . . . . . . . 12
Locate Support Files . . . . . . . . . . . . . . . . . . . . . . 13
Locate Drawing Template Files . . . . . . . . . . . . . . . . 16
Locate Texture Files . . . . . . . . . . . . . . . . . . . . . . 17
Customize a Publish to Web Template . . . . . . . . . . . . . . . . . . 17
Define Custom Commands . . . . . . . . . . . . . . . . . . . . . . . 20
Define External Commands . . . . . . . . . . . . . . . . . . . . . 20
Create Command Aliases . . . . . . . . . . . . . . . . . . . . . . 24
Record and Modify Action Macros . . . . . . . . . . . . . . . . . . . . 25
Overview of Action Macros . . . . . . . . . . . . . . . . . . . . . 25
Work with the Action Recorder . . . . . . . . . . . . . . . . . . . 28
Record an Action Macro . . . . . . . . . . . . . . . . . . . . . . 28
Record an Action Macro with the Action Recorder . . . . . . 29
Action Node Icons . . . . . . . . . . . . . . . . . . . . . . 33
iii
Work with User Interface Elements . . . . . . . . . . . . . . 36
Manage and Modify Action Macros . . . . . . . . . . . . . . . . . 37
Manage Action Macros . . . . . . . . . . . . . . . . . . . . 38
Insert User Messages . . . . . . . . . . . . . . . . . . . . . 41
Pause for User Input . . . . . . . . . . . . . . . . . . . . . . 43
Work with Coordinates . . . . . . . . . . . . . . . . . . . . 44
Insert Base Points . . . . . . . . . . . . . . . . . . . . . . . 46
Work with Object Selections . . . . . . . . . . . . . . . . . 47
Tips for Using the Action Recorder . . . . . . . . . . . . . . . . . 48
Examples of Action Macros . . . . . . . . . . . . . . . . . . . . . 52
Create a New Layer and Draw Objects . . . . . . . . . . . . 52
Insert a Block and Change a Dynamic Property
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Modify Circles with the Properties Palette . . . . . . . . . . 59
Chapter 2 Custom Linetypes . . . . . . . . . . . . . . . . . . . . . . . . . 63
Overview of Linetype Definitions . . . . . . . . . . . . . . . . . . . . . 63
Simple Custom Linetypes . . . . . . . . . . . . . . . . . . . . . . . . . 64
Text in Custom Linetypes . . . . . . . . . . . . . . . . . . . . . . . . . 68
Shapes in Custom Linetypes . . . . . . . . . . . . . . . . . . . . . . . 71
Chapter 3 Custom Hatch Patterns . . . . . . . . . . . . . . . . . . . . . . 75
Overview of Hatch Pattern Definitions . . . . . . . . . . . . . . . . . . 75
Hatch Patterns with Dashed Lines . . . . . . . . . . . . . . . . . . . . 78
Hatch Patterns with Multiple Lines . . . . . . . . . . . . . . . . . . . . 82
Chapter 4 User Interface Customization . . . . . . . . . . . . . . . . . . . 87
Understand User Interface Customization . . . . . . . . . . . . . . . . 87
Overview of the Customization . . . . . . . . . . . . . . . . . . . 87
Use the Customization Environment . . . . . . . . . . . . . . . . 90
Overview of the Customize User Interface (CUI)
Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Work with the Customizations In Pane . . . . . . . . . . . 92
Work with the Command List Pane . . . . . . . . . . . . . 93
Work with the Dynamic Display Pane . . . . . . . . . . . . 95
How Customization Has Changed . . . . . . . . . . . . . . . . . 96
Customization Glossary . . . . . . . . . . . . . . . . . . . . . . 103
Work with the Customize User Interface (CUI) Editor . . . . . . . . . 106
Create a Command . . . . . . . . . . . . . . . . . . . . . . . . 106
Create User Interface Elements . . . . . . . . . . . . . . . . . . 108
Create a Quick Access Toolbar . . . . . . . . . . . . . . . . 108
Customize the Ribbon . . . . . . . . . . . . . . . . . . . . 109
Create a Toolbar . . . . . . . . . . . . . . . . . . . . . . . 113
Create a Pull-Down Menu . . . . . . . . . . . . . . . . . . 114
iv | Contents
Create a Shortcut Menu . . . . . . . . . . . . . . . . . . . 116
Customize Shortcut Key . . . . . . . . . . . . . . . . . . . 117
Create a Double Click Action . . . . . . . . . . . . . . . . 117
Create a Mouse Button . . . . . . . . . . . . . . . . . . . 118
Create and Modify Workspaces . . . . . . . . . . . . . . . . . . 118
Create a Workspace from the User Interface . . . . . . . . 119
Create a Workspace with the CUI Editor . . . . . . . . . . 120
Create and Manage Customization Files . . . . . . . . . . . . . . . . 122
Basics of Customization Files . . . . . . . . . . . . . . . . . . . 122
Create and Load a Partial CUIx File . . . . . . . . . . . . . . . . 127
Create an Enterprise CUIx File . . . . . . . . . . . . . . . . . . . 131
Find and Replace Commands and Text in a CUIx File . . . . . . 135
Customize Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Overview of Commands . . . . . . . . . . . . . . . . . . . . . . 142
Create, Edit, and Reuse Commands . . . . . . . . . . . . . . . . 144
Create Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Overview of Macros . . . . . . . . . . . . . . . . . . . . . 151
Use Special Control Characters in Macros . . . . . . . . . . 154
Pause for User Input in Macros . . . . . . . . . . . . . . . 156
Provide International Support in Macros . . . . . . . . . . 158
Use Built-in Commands in Macros . . . . . . . . . . . . . 159
Repeat Commands in Macros . . . . . . . . . . . . . . . . 159
Use Single Object Selection Mode in Macros . . . . . . . . 160
Use Macros to Swap User Interface Elements . . . . . . . . 160
Use Conditional Expressions in Macros . . . . . . . . . . . 162
Use AutoLISP in Macros . . . . . . . . . . . . . . . . . . . 163
Control the Display of Command Items . . . . . . . . . . . . . 165
Assign Search Tags . . . . . . . . . . . . . . . . . . . . . . . . . 171
Create Tooltips and Extended Help for Commands . . . . . . . . 174
Create Status Line Help Messages . . . . . . . . . . . . . . . . . 180
Assign, Create, and Manage Images for Commands . . . . . . . 181
Assign Images to a Command . . . . . . . . . . . . . . . . 181
Create and Edit Custom Images for Commands . . . . . . 184
Manage, Import, and Export Custom Images . . . . . . . . 186
Customize User Interface Elements . . . . . . . . . . . . . . . . . . . 191
Quick Access Toolbars . . . . . . . . . . . . . . . . . . . . . . . 194
Ribbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Ribbon Panels . . . . . . . . . . . . . . . . . . . . . . . . 201
Ribbon Tabs . . . . . . . . . . . . . . . . . . . . . . . . . 238
Ribbon Contextual Tab States . . . . . . . . . . . . . . . . 244
Toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Create and Edit Toolbars . . . . . . . . . . . . . . . . . . . 248
Add Flyouts to a Toolbar . . . . . . . . . . . . . . . . . . . 260
Add, Remove or Switch Toolbar Controls . . . . . . . . . . 265
Pull-down and Shortcut Menus . . . . . . . . . . . . . . . . . . 270
Overview of Pull-Down and Shortcut Menus . . . . . . . . 270
Contents | v
Create a Pull-Down Menu . . . . . . . . . . . . . . . . . . 271
Create a Shortcut Menu . . . . . . . . . . . . . . . . . . . 275
Create Submenus . . . . . . . . . . . . . . . . . . . . . . 285
Reference Pull-Down or Shortcut Menus . . . . . . . . . . 288
Swap and Insert Pull-Down Menus . . . . . . . . . . . . . 290
Quick Properties . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Rollover Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Keyboard Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . 309
Shortcut Keys . . . . . . . . . . . . . . . . . . . . . . . . 309
Temporary Override Keys . . . . . . . . . . . . . . . . . . 317
Double Click Actions . . . . . . . . . . . . . . . . . . . . . . . 324
Overview of Double Click Actions . . . . . . . . . . . . . . 324
Double Click Action Object Names . . . . . . . . . . . . . 327
Examples of Double Click Actions . . . . . . . . . . . . . 330
Mouse Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Overview of Mouse Buttons . . . . . . . . . . . . . . . . . 331
Accept Coordinate Entry in Button Menus . . . . . . . . . 333
Legacy Interface Elements . . . . . . . . . . . . . . . . . . . . . 334
Create Tablet Menus . . . . . . . . . . . . . . . . . . . . . 334
Customize Tablet Buttons . . . . . . . . . . . . . . . . . . 336
Create Screen Menus . . . . . . . . . . . . . . . . . . . . . 337
Create Image Tile Menus . . . . . . . . . . . . . . . . . . 341
Load an AutoLISP File . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Customize Workspaces . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Overview of Workspace Customization . . . . . . . . . . . . . . 347
Control User Interface Elements Outside the CUI Editor . . . . . 361
Control User Interface Elements in the CUI Editor . . . . . . . . 364
Control the Appearance of Palettes . . . . . . . . . . . . . . . . 380
Transfer and Migrate Customization . . . . . . . . . . . . . . . . . . 384
Customize User Interface (CUI) Editor FAQs . . . . . . . . . . . . . . 387
Chapter 5 DIESEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Customize the Status Line . . . . . . . . . . . . . . . . . . . . . . . . 393
Overview of the MODEMACRO System Variable . . . . . . . . . 393
Set MODEMACRO Values . . . . . . . . . . . . . . . . . . . . . 394
Set MODEMACRO with AutoLISP . . . . . . . . . . . . . . . . . 396
DIESEL Expressions in Macros . . . . . . . . . . . . . . . . . . . . . . 399
Catalog of DIESEL Functions . . . . . . . . . . . . . . . . . . . . . . 402
+ (addition) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
- (subtraction) . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
* (multiplication) . . . . . . . . . . . . . . . . . . . . . . . . . 403
/ (division) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
= (equal to) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
< (less than) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
> (greater than) . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
!= (not equal to) . . . . . . . . . . . . . . . . . . . . . . . . . . 405
vi | Contents
<= (less than or equal to) . . . . . . . . . . . . . . . . . . . . . 405
>= (greater than or equal to) . . . . . . . . . . . . . . . . . . . . 406
and . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
angtos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
edtime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
eq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
eval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
fix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
getenv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
getvar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
nth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
rtos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
strlen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
substr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
upper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
xor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
DIESEL Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Chapter 6 Slides and Command Scripts . . . . . . . . . . . . . . . . . . 417
Create Slides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Overview of Slides . . . . . . . . . . . . . . . . . . . . . . . . . 417
View Slides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Create and View Slide Libraries . . . . . . . . . . . . . . . . . . 420
Create Command Scripts . . . . . . . . . . . . . . . . . . . . . . . . 422
Overview of Command Scripts . . . . . . . . . . . . . . . . . . 422
Run Scripts at Startup . . . . . . . . . . . . . . . . . . . . . . . 424
Run Slide Shows from Scripts . . . . . . . . . . . . . . . . . . . 426
Chapter 7 Introduction to Programming Interfaces . . . . . . . . . . . . 429
ActiveX Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Overview of ActiveX . . . . . . . . . . . . . . . . . . . . . . . . 429
Define a Command to Start Your Application . . . . . . . . . . 431
Start an Application from a Menu or Toolbar . . . . . . . . . . . 431
AutoCAD VBA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Overview of AutoCAD VBA . . . . . . . . . . . . . . . . . . . . 432
Use AutoCAD VBA Applications . . . . . . . . . . . . . . . . . . 434
Automatically Load and Execute VBA Projects . . . . . . . . . . 435
AutoLISP and Visual LISP . . . . . . . . . . . . . . . . . . . . . . . . 437
Overview of AutoLISP and Visual LISP . . . . . . . . . . . . . . 437
Use AutoLISP Applications . . . . . . . . . . . . . . . . . . . . . 439
Automatically Load and Run AutoLISP Routines . . . . . . . . . 440
Overview of AutoLISP Automatic Loading . . . . . . . . . 440
Contents | vii
The ACAD.LSP File . . . . . . . . . . . . . . . . . . . . . . 442
The ACADDOC.LSP File . . . . . . . . . . . . . . . . . . . 443
The MNL File for an AutoLISP Menu . . . . . . . . . . . . 444
Prevent AutoLISP Errors When Loading Startup Files . . . . 445
S::STARTUP Function: Postinitialization Execution . . . . . 446
ObjectARX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Overview of ObjectARX . . . . . . . . . . . . . . . . . . . . . . 447
Use ObjectARX Applications . . . . . . . . . . . . . . . . . . . . 448
Automatically Load ObjectARX Applications . . . . . . . . . . . 449
.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
Overview of .NET . . . . . . . . . . . . . . . . . . . . . . . . . 451
Loading Managed Applications in AutoCAD . . . . . . . . . . . 451
Chapter 8 Shapes and Shape Fonts . . . . . . . . . . . . . . . . . . . . . 453
Overview of Shape Files . . . . . . . . . . . . . . . . . . . . . . . . . 453
Create Shape Definition Files . . . . . . . . . . . . . . . . . . . . . . 455
Shape Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . 455
Vector Length and Direction Code . . . . . . . . . . . . . . . . 456
Special Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
Use Special Codes . . . . . . . . . . . . . . . . . . . . . . 458
Codes 0, 1, and 2: End of Shape and Draw Mode
Control . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Codes 3 and 4: Size Control . . . . . . . . . . . . . . . . . 460
Codes 5 and 6: Location Save/Restore . . . . . . . . . . . . 460
Code 7: Subshape . . . . . . . . . . . . . . . . . . . . . . 461
Codes 8 and 9: X-Y Displacements . . . . . . . . . . . . . 461
Code 00A: Octant Arc . . . . . . . . . . . . . . . . . . . . 462
Code 00B: Fractional Arc . . . . . . . . . . . . . . . . . . 464
Codes 00C and 00D: Bulge-Specified Arcs . . . . . . . . . . 465
Code 00E: Flag Vertical Text Command . . . . . . . . . . . 466
Text Font Descriptions . . . . . . . . . . . . . . . . . . . . . . . 467
Sample Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Extended Simplex Roman . . . . . . . . . . . . . . . . . . 470
Extended Standard Font for UNICODE . . . . . . . . . . . 498
Big Font Descriptions . . . . . . . . . . . . . . . . . . . . . . . 518
Define a Big Font . . . . . . . . . . . . . . . . . . . . . . 518
Define an Extended Big Font File . . . . . . . . . . . . . . 519
Use Big Font Text in a Drawing . . . . . . . . . . . . . . . 525
Use a Big Font to Extend a Font . . . . . . . . . . . . . . . 526
Unicode Font Descriptions . . . . . . . . . . . . . . . . . . . . 528
Superscripts and Subscripts in SHX Files . . . . . . . . . . . . . 529
viii | Contents
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

Basic Customization

1
Your dealer can offer you independently developed applications that can further tailor AutoCAD to your needs.

Overview of Customization

AutoCAD can be customized in simple ways. For example, you can change the directory structure or move a button from one toolbar to another. If you want to change the interface further, you can edit the CUIx file and use DIESEL code to create customizations with your own commands.
You can also use a number of powerful application programming interfaces (APIs) to add to and modify AutoCAD to suit your needs.
The list that follows is arranged from least to most complex:
Organize files. You can organize program, support, and drawing files. For
example, you can make a separate folder for each project that includes only the support files that project needs.
Customize Tool Palettes. You can create a tool by dragging objects from
your drawing onto a tool palette. You can create a tool palette by right-clicking on the Tool Palettes title bar and selecting New Palette. For information about customizing tool palettes, see Customize Tool Palettes in the User's Guide.
Create custom templates. Use templates to define common parameters when
you publish a drawing using the Publish to Web wizard.
Run external programs and utilities from within AutoCAD. You can, for
example, copy a disk or delete a file from within AutoCAD by adding the appropriate external command to the program parameters (PGP) file, acad.pgp.
1
Define command aliases. You can define simple abbreviations, or aliases,
for frequently used commands from within AutoCAD by adding the command to the PGP file acad.pgp. For example, you might want to start the BLOCK command by entering b.
Create custom linetypes, hatch patterns, shapes, and text fonts. You can
create linetypes, hatch patterns, shapes, and text fonts that conform to your company standards and working methods.
Customize the user interface. The CUIx file controls many aspects of the
user interface, including the behavior of your pointing device buttons and the functionality and appearance of pull-down, tablet, and image tile menus, toolbars, and accelerator keys. You can edit or create a CUIx file to add commands or combine commands and assign them to a menu, toolbar, or other location.
Customize the status line. You can use the DIESEL string expression
language and the MODEMACRO system variable to provide additional information at the status line, such as the date and time, system variable settings, or retrievable information using AutoLISP®.
Automate repetitive tasks by writing scripts. A script is an ASCII text file
containing commands that are processed like a batch file when you run the script. For example, if a set of drawings needs to be plotted a certain way, you can write a script that opens each drawing, hides and displays various layers, and issues PLOT commands. You can use scripts with slides to create automated presentations like those used at trade shows. A slide is a snapshot of the drawing area that cannot be edited. Slides can also be used in image tile menus and dialog boxes.
Record action macros. Action macros are files that contain a series of
commands and command options that allow you to perform repetitive tasks. Action macros are created using the Action recorder and are similar in concept to script files. Unlike some of the other methods of customizing AutoCAD, you do not need to learn a special syntax or programming language to record action macros.
In addition to the methods described in the Customization Guide, there are application programming interfaces (APIs) available for customizing AutoCAD.
Introduction to Programming Interfaces on page 429 briefly describes these
APIs and provides cross-references to more information.
See also:
Organize Program and Support Files
2 | Chapter 1 Basic Customization
Toolbars
Customize a Publish to Web Template
Create Command Aliases
Custom Linetypes
Custom Hatch Patterns
User Interface Customization
DIESEL
Customize the Status Line
Introduction to Programming Interfaces
Slides and Command Scripts
Quick Reference
Commands
CUI
Manages the customized user interface elements in the product.
CUSTOMIZE
Customizes tool palettes and tool palette groups.
REDEFINE
Restores AutoCAD internal commands overridden by UNDEFINE.
UNDEFINE
Allows an application-defined command to override an internal command.
System Variables
TOOLTIPS
Controls the display of tooltips on the ribbon, toolbars, and other user interface elements.
Overview of Customization | 3

Organize Program and Support Files

You can change the default directory structure for the program and support files to suit your needs.

Overview of File Organization

AutoCAD uses support files for purposes such as storing customization definitions, loading AutoLISP and ObjectARX applications, and describing text fonts.
The default directory structure for the AutoCAD program and support files is designed to efficiently organize those files into logical groups. If this organization does not suit your needs, you can change it. However, some applications look for certain files in specific locations, and you should verify that your modifications do not conflict with the requirements of those applications. Without the full path, including drive and directory, AutoCAD can locate only those files that are found in the library search path.
The location of the support folder changed in AutoCAD 2004. The location of local customizable files is stored in the LOCALROOTPREFIX system variable. The location of roamable customizable files is stored in the ROAMABLEROOTPREFIX system variable. If a network supports roaming, customizable files in the user's roaming profile are available on the machine the user is logged onto.
The following LISP script creates the CUSTFILES command, which launches Windows® Explorer in the correct folder.
(defun c:custfiles ()
(command "shell"
(strcat "explorer \"" (getvar "roamablerootprefix") "\"") ) (princ)
)
Library Search Path
The library search path specifies where the program searches for files when you do not specify a full path name, as follows:
Current directory. (This is typically determined by the Start In setting
in your shortcut icon.)
Directory that contains the current drawing file.
4 | Chapter 1 Basic Customization
Directories listed in the search path specified on the Files tab in OPTIONS.
(See Specify Search Paths and File Locations in the User's Guide.)
Directory that contains the AutoCAD program files.
Depending on the current environment, two or more directories may be the same.
If a file is not in this search path, you must specify both its path name and file name before AutoCAD can find it. For example, if you want to insert the part5.dwg drawing into your current drawing and it is not in the library search path, you must specify its full path name, as shown here:
Command: insert Enter block name or [?]: /files2/olddwgs/part5
If the drawing exists in that location, AutoCAD prompts you to finish the INSERT command in the usual manner.
Directory Structure
AutoCAD uses tree-structured directories and subdirectories. It is recommended that you keep supplemental files (such as AutoLISP applications and customization files) separate from the AutoCAD program and support files. This makes it easier to track possible conflicts and to upgrade each application without affecting the others.
The default location for AutoCAD is in the Program Files folder. You can create a new directory on the same level (for example, /AcadApps) and store your custom AutoLISP and VBA macros, customization files, and other third-party applications in subdirectories on the next level. If you want to maintain multiple drawing directories (for separate job files), you can create a directory such as /AcadJobs with subdirectories for each job.
Command Search Procedure
When you enter a command, AutoCAD goes through a series of steps to evaluate the validity of the command name. A command can be a built-in command or system variable, an external command or alias defined in the acad.pgp file, or a user-defined AutoLISP command. Commands can also be defined by ObjectARX applications or a device driver command. You can enter a command on the command prompt or choose a command from the appropriate menu. Commands can also be entered from a script file or by an AutoLISP or ObjectARX application.
The following list describes the search order AutoCAD uses to validate a command name.
Overview of File Organization | 5
1 If the input is a null response (SPACEBAR or ENTER), AutoCAD uses the
name of the last command issued. HELP is the default.
2 AutoCAD checks the command name against the list of built-in
commands. If the command is in the list and is not preceded by a period (.), AutoCAD then checks the command against a list of undefined commands. If the command is undefined, the search continues. Otherwise, the command is run, unless another reason prevents it from doing so. Running it transparently or in Perspective mode might be impossible.
3 AutoCAD checks the command name against the names of commands
defined by a device driver, and then by those defined by the display driver.
4 AutoCAD checks the command name against the external commands
defined in the program parameters file (acad.pgp). If the command name corresponds to a defined external command, that command runs, and the search is complete.
5 AutoCAD checks the command name against the list of commands
defined by AutoLISP or ObjectARX applications. At this point, an autoloaded command is loaded.
6 AutoCAD checks the command name against the list of system variables.
If the command name is in the list, AutoCAD executes the SETVAR command, using the input as the variable name.
7 If the command name corresponds to a command alias defined in the
program parameters file, AutoCAD uses the expanded command name and continues the search, starting a new search against the list of built-in commands.
8 If all the preceding steps fail, the search terminates with a warning
message about illegal command names.
See also:
Overview of AutoLISP Automatic Loading on page 440
Specify Search Paths and File Locations in the User's Guide
6 | Chapter 1 Basic Customization
Quick Reference
Commands
OPTIONS
Customizes the program settings.
System Variables
LOCALROOTPREFIX
Stores the full path to the root folder where local customizable files were installed.
ROAMABLEROOTPREFIX
Stores the full path to the root folder where roamable customizable files were installed.

Multiple Configurations

If you use more than one pointing device or use different plotters, you can set up more than one configuration file to make it easy to switch between devices.
When you configure AutoCAD for a pointing device and plotter drivers, the information you supply is recorded in a configuration file.
The default location of the acad2011.cfg configuration file is listed in the Options dialog box, Files tab, under Help and Miscellaneous File Names, but you can specify an alternative path or file name.
Typically, only a single configuration is necessary, but you may need multiple configurations. For example, if you use a mouse for most of your work but occasionally require a large digitizing tablet, you can set up your system to handle multiple configurations rather than reconfiguring each time you change a device.
The configuration file stores the values of many AutoCAD system variables and the configuration options defined in the Options dialog box. If you want different settings for these system variables and operating parameters, you can save those values to different configuration files. For a list of the system variables and where they are stored, see System Variables in the Command Reference.
Multiple Configurations | 7
To take advantage of multiple configurations, you must set up AutoCAD to use different configuration files. Use the /c switch to specify alternative configuration files at startup.
See also:
Customize Startup in the User's Guide
Quick Reference
Commands
OPTIONS
Customizes the program settings.

Multiple Drawing Folders

Keeping your drawing and other associated files in separate directories makes it easier to perform basic file maintenance.
Keeping your drawing files and other associated files in separate directories makes it easier to perform basic file maintenance. The scenario described in this topic is based on the sample directory structure described in Overview of
File Organization on page 4, but you can expand or alter it to meet your
needs.
You can set up the /AcadJobs directory to contain your drawing subdirectories. The drawing subdirectories can contain other subdirectories that hold related support files for a particular drawing type or job. The /AcadJobs/Job1/Support directory can contain blocks and AutoLISP files specific to the drawing files in /AcadJobs/Job1. Specifying support (with no path prefix) in the Support path adds the support directory within the current directory to the Support path. Notice that if you use the Options dialog box to specify a directory, AutoCAD creates a hard-coded path to that directory. To use the relative naming convention previously described, you must specify the Support path with the /s switch on the command line. See Customize Startup in the User's Guide.
To make sure that the required drawing directory is the current directory when you start AutoCAD, and that all files and subdirectories in that directory are easily accessible, you can create a program icon or a Start menu item that specifies the correct working directory for each job. This functionality works only if you set the AutoCAD system variable REMEMBERFOLDERS to 0.
8 | Chapter 1 Basic Customization
You can use a batch program as an alternative to using icons or menus. With batch programs you can create new job directories automatically. The following batch program verifies that a specified directory exists, sets that directory to be current, and then runs AutoCAD.
@echo off C: if exist \AcadJobs\Jobs\%1 goto RUNACAD echo. echo *** Creating \AcadJobs\Jobs\%1 echo *** Press Ctrl+C to cancel. echo. pause mkdir \AcadJobs\Jobs\%1 :RUNACAD cd \AcadJobs\Jobs\%1 start C:\ AutoCAD\acad.exe
Using an ASCII text editor (such as Notepad), save the batch program to a file named acad.bat. Be sure to change the drive and directory names to match those on your system. Place this file in a directory that is on your system search path (for example, C:\winnt). You can run this batch program using the Run command on the Start menu or by double-clicking the file in Explorer. If you saved the file as acad.bat, use the following syntax:
acadjobname
where jobname is the name of the job directory to make current.
Quick Reference
System Variables
CMDECHO
Controls whether prompts and input are echoed during the AutoLISP command function.
Multiple Drawing Folders | 9

Locate Customized Files

Beginning with AutoCAD 2004, the location of some of your customized files has changed. The reasons for the file location changes include the following:
Limited user rights on a workstation. You can run AutoCAD as a limited
user. This means that you no longer need power user or Administrator permissions to run AutoCAD once it is installed.
Roaming profiles. Roaming profiles allow you to log on to any computer
within a network and retain your user settings. Some files, such as your personal settings and documents, follow you from computer to computer, while other files, such as templates (including Publish to Web templates), reside only on your system. If roaming profiles are allowed on your network, your roamable files are located in the \Application Data\Autodesk\<Product Version> folder, and your nonroamable files are located in the \Local Settings\Application Data\Autodesk\<Product Version> folder.
NOTE In some operating systems, the folders that are located under your profile are hidden by default. To display these files, you may need to change your display settings. On the Start menu, click Control Panel Folder Options. In the Folder Options dialog box, on the View tab, click Show Hidden Files and Folders.
Locate Data Link Files
Beginning with the 2004 products, the default location of your data link files has changed. For information about the default location of these files, see
Locate Customized Files on page 10.
To locate your data link files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Data Sources Location.
10 | Chapter 1 Basic Customization
4 Under Data Sources Location, click the path name to view the location
of your data link files.
NOTE The changes you make do not take effect until you restart the program.
Locate Plot Style Files
Beginning with the AutoCAD 2004, the default location of your plot style files has changed. For information about the default location of these files, see
Locate Customized Files on page 10.
To locate your plot style files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Printer Support File Path.
4 Click the plus sign (+) to the left of the Plot Style Table Search Path file.
5 Under Plot Style Table Search Path, click the path name to view the
location of your plot style files.
NOTE You can also locate your plot style files by entering stylesmanager on the AutoCAD command line.
Locate Plotter Files
Beginning with AutoCAD 2004, the default location of your plotter files has changed. For information about the default location of these files, see Locate
Customized Files on page 10.
Locate Customized Files | 11
To locate your plotter files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Printer Support File Path.
4 Click the plus sign (+) to the left of Printer Configuration Search Path.
5 Under Printer Configuration Search Path, click the path name to view
the location of your plotter files.
NOTE You can also locate your plotter files by entering plottermanager on the AutoCAD command line.
Locate the PMP File
Beginning with AutoCAD 2004, the default location of your PMP file has changed. For information about the default location of this file, see Locate
Customized Files on page 10.
To locate your PMP file
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Printer Support File Path.
4 Under Printer Description File Search Path, click the path name to view
the location of your PMP file.
12 | Chapter 1 Basic Customization
Locate Support Files
Beginning with AutoCAD 2004, the default location for some of your support files has changed. For information about the default location of these files, see Locate Customized Files on page 10.
Support files include the following:
Configuration file (acad2011.cfg)
Customization file (acad.cuix)
Custom icon files
Help and miscellaneous files
Font mapping file (acad.fmp)
Alternate font file (simplex.shx)
Support path files (acad.dcl, acad.lin, acad.mnl, acad.pat, acad.pgp, acad.psf,
acad.unt, acadiso.lin, acadiso.pat, ase.dcl, base.dcl, doshelp.dcl, and gdt.shx)
To find the default location of the configuration file
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Help and Miscellaneous File Names.
4 Click the plus sign (+) to the left of Configuration File.
5 Under Configuration File, click the path name to view the location of
your configuration file.
To find the default location of the customization files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
Locate Customized Files | 13
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Customization Files.
4 Click the plus sign (+) to the left of Main Customization File.
5 Under Main Customization File, click the path name to view the location
of your main customization file.
6 Click the plus sign (+) to the left of Enterprise Customization File.
7 Under Enterprise Customization File, click the path name to view the
location of your enterprise customization files.
NOTE By default, the path to an enterprise customization file is empty until you define the file. For more information about defining a customization file, see Customize the User Interface in the Customization Guide.
To find the default location of the custom icon files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Customization Files.
4 Under Custom Icon Location, click the path name to view the location
for the custom button image files used with your customization files.
To find the default location of the Help and miscellaneous files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
14 | Chapter 1 Basic Customization
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Help and Miscellaneous File Names to expand the list.
4 Click the plus sign (+) to the left of the file you want to locate, and then
click the path name to view the location of the files.
To find the default location of the font mapping file
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Text Editor, Dictionary, and Font File Names.
4 Click the plus sign (+) to the left of Font Mapping File.
5 Under Font Mapping File, click the path name to view the location of
your font mapping file.
To find the default location of the alternate font file
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Text Editor, Dictionary, and Font File Names.
4 Click the plus sign (+) to the left of Alternate Font File.
Locate Customized Files | 15
5 Under Alternate Font File, click the path name to view the location of
your alternate font file.
To find the default location of the support path files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Support File Search Path.
4 Under Support File Search Path, click a path name to view the location
of your support files.
Locate Drawing Template Files
Beginning with AutoCAD 2004, the default location of your drawing template files has changed. For information about the default location of these files, see Locate Customized Files on page 10.
To locate your drawing template files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Template Settings.
4 Under Template Settings, click the plus sign (+) to the left of Drawing
Template File Location.
16 | Chapter 1 Basic Customization
5 Under Drawing Template File Location, click the path name to view the
location of your drawing template files.
Locate Texture Files
Beginning with AutoCAD 2004, the default location of your texture files has changed. For information about the default location of these files, see Locate
Customized Files on page 10.
To locate your texture files
1 Do one of the following:
(Windows XP) Click Start menu Programs Autodesk
<AutoCAD> <AutoCAD>.
(Windows Vista) Click Start menu All Programs Autodesk
<AutoCAD> <AutoCAD>.
2 Click application menu Options.
3 In the Options dialog box, Files tab, click the plus sign (+) to the left of
Texture Maps Search Path.
4 Under Texture Maps Search Path, click the path name to view the location
of your texture files.

Customize a Publish to Web Template

You can create customized templates to use in the Publish to Web wizard by modifying one of the Publish to Web template (PWT) files provided. Use any HTML editor or text editor.
To create a custom template, add or modify any of the following elements:
Images
Text
Hyperlinks
Color
Title
Customize a Publish to Web Template | 17
Video, animation, and so on
There are four default Publish to Web templates that you can customize:
Array of Thumbnails. Creates a web page containing an array of thumbnail
images.
Array Plus Summary. Creates a web page containing an array of thumbnail
images and summary information about each image.
List of Drawings. Creates a web page containing a list of drawings and an
image frame.
List Plus Summary. Creates a web page containing a list of drawings, an
image frame, and summary information about a selected image.
NOTE You must be familiar with HTML syntax to customize the Publish to Web templates.
You can make changes or additions to the look and feel of a template, but you cannot change the arrangement of images within it. For example, in the Array of Thumbnails template, the images are presented across the page in rows. You cannot alter the presentation of the images, but you can wrap text and graphics around the table of images.
WARNING To ensure that you do not overwrite the default Publish to Web template files, back up those files before you make any changes to them.
To create quick access to the Publish to Web templates
1 Click Tools menu Options.
2 In the Options dialog box, Files tab, click the plus sign (+) next to
Template Settings. Then click the plus sign next to Drawing Template File Location.
3 Move the cursor to the path name that is displayed and click inside it,
and press F2, and press CTRL+C to copy it.
4 Click OK or Cancel to close the Options dialog box.
5 Click File menu Open.
6 In the Select File dialog box, right-click an empty area in the vertical
panel on the left side, and click Add on the shortcut menu.
7 Enter a name in the Item name box (for example, Templates).
18 | Chapter 1 Basic Customization
8 Press CTRL+V to paste the path into the Item Path box, and click OK.
You can now access the Template folders by clicking the button in the left panel of the Select File dialog box.
To customize a Publish to Web template
1 Browse to the Publish to Web template folder, click File menu Open.
See To create quick access to the Publish to Web templates on page 18.
2 Double-click the PTWTemplates folder to open it. The following folders
are displayed. Each contains a Publish to Web template and preview images (BMP) that you see when you run the Publish to Web wizard.
Template1. Contains the Array of Thumbnails template and a preview
image
Template2. Contains the Array Plus Summary template, a preview image,
and HTML frames
Template3. Contains the List of Drawings template, a preview image,
and HTML frames
Template4. Contains the List Plus Summary template, a preview image,
and HTML frames
3 Right-click the folder you want to use, and click Copy.
4 Press ALT+2, right-click the PTWTemplates folder, and click Paste.
5 Reopen the PTWTemplates folder, and right-click the new folder and
rename it.
6 Right-click the new folder and click Open to display its contents.
7 Rename the Publish to Web template (PWT) file with an .htm or .html file
extension.
8 Open the template file in an HTML editor or a text editor.
The template file contains comments that help you determine which areas of the code you can modify to create your new web page.
9 Review the comments and make changes to the parts of the template
you want to customize.
10 Save the template with a .pwt file extension. Make sure you save the file
to the template folder you created in step 3.
Customize a Publish to Web Template | 19
NOTE Each template folder can contain only one PWT file. If you create a new PWT file, make sure you delete any other PWT files that exist in the same folder.
When you run the Publish to Web wizard, the new template is displayed in the list of templates.
Quick Reference
Commands
PUBLISHTOWEB
Creates HTML pages that include images of selected drawings.

Define Custom Commands

You can define external commands that run from within AutoCAD. You can also create command aliases for AutoCAD commands in the acad.pgp file, an ASCII text file that stores command definitions.

Define External Commands

External commands start other programs or utilities while AutoCAD is running.
While AutoCAD is running, you can invoke other programs or utilities, such as the following:
Windows system commands and utilities, such as start, type, dir, or copy
Applications such as text editors or word processors
Database managers, spreadsheets, and communications programs
User-supplied programs, such as batch files or VBA macros
When you enter an external command, AutoCAD looks for the command in acad.pgp. The first section of acad.pgp defines external commands. You can add command definitions by editing acad.pgp in an ASCII text editor (such as Notepad). In addition to command aliases in acad.pgp, you will also find comment lines which are preceded by a semicolon (;). Comment lines allow you to add textual information to acad.pgp, such as when or who revised the file last.
20 | Chapter 1 Basic Customization
NOTE Before you edit acad.pgp, create a backup file so that you can restore it later, if necessary.
When you define an external command, you specify a command name to be used at the command prompt and an executable command string that is passed to the operating system. Each line in the external commands section has five comma-delimited fields, as follows:
command,[executable],flags[,[*]prompt[,return_code]]
command The command that is entered at the command prompt. If the name is an internal AutoCAD command name, it is ignored. The name is not case-sensitive.
executable The constant string sent to the operating system when you enter a command name. It can be any command that you can execute at the operating-system prompt. The string can include switches or parameters. The case-sensitivity of this string depends on the application you are running.
flags A required bitcoded parameter. Add these integer values in any combination to achieve the result you want.
0 Start the application and wait for it to finish.
1 Don't wait for the application to finish.
2 Run the application in Minimized mode.
4 Run the application hidden.
8 Put the argument string in quotes.
Bit values 2 and 4 are mutually exclusive; if both are specified only the 2 bit is used. Using value 2 or 4 without value 1 should be avoided, because AutoCAD becomes unavailable until the application has completed.
Bit value 8 allows commands like del to work properly with file names that have embedded spaces. This eliminates the possibility of passing a space-delimited list of file names to these commands. If you prefer multiple file support, do not use the bit value 8.
prompt An optional field. It specifies the prompt to display on the AutoCAD command line or for the dynamic input tooltip. The response to this prompt is appended to the string supplied in the executable field. If the first character of the prompt field is an asterisk (*), the response can contain spaces and the user must press ENTER to terminate it. Otherwise, the response is terminated by either SPACEBAR or ENTER. If no prompt is specified, no input is requested; however, you must add a comma if a return code is to be supplied or if you want the prompt to have a trailing space.
Define External Commands | 21
return_code An optional bitcoded parameter. You can add these integer values together in any combination to achieve the result you want. For example, if values 1 and 2 are required, you use 3 as the return code. The values are defined as follows (codes 0 and 4 are meaningless in a windowed environment and are therefore not included):
1 Loads a DXB file. AutoCAD loads the DXB file named $cmd.dxb into the
drawing after the command is terminated. After the DXB file is loaded, the $cmd.dxb file is deleted. This action produces the same result as the DXBIN command.
2 Constructs a block definition from a DXB file. AutoCAD creates a block
definition from the DXB file named $cmd.dxb. The response to the prompt field is used as the block name. This name must be a valid block name that does not currently exist in the drawing; therefore, this mode cannot redefine a previously defined block. After AutoCAD loads the DXB file, the $cmd.dxb file is deleted. The default name for the INSERT command is set to the newly defined block.
The file can also contain comment lines preceded by a semicolon (;).
Windows System Commands
The start and cmd Windows system commands are very useful when defining external commands. If you specify an executable string that does not use the start or cmd command, AutoCAD is unavailable until that window is closed.
The start command starts a separate window and runs a specified program or command. If start is used without any parameters, it opens a new command prompt window. The start command has many command line switches that affect the display of the new window. To launch a Windows application, use start without any switches. The start command is also very useful for starting a document that is associated with an application. For example, you can use start to directly open a document created with a word processor or an HTML file.
The cmd command opens a command prompt window that acts as a shell of AutoCAD. This window must be closed before control returns to the AutoCAD command prompt. Two command line switches, /c and /k, are useful for external commands. The /c switch carries out the specified command and then stops (the window closes). The /k switch carries out the specified command and then continues (the window remains open). When using the /k switch, you must close the command window (with the exit command).
In general, use start to start a new window or application that is to be a separate process from AutoCAD. Use cmd to run a batch file or command script that does not create a separate window, or to create a window that must be closed
22 | Chapter 1 Basic Customization
Loading...
+ 524 hidden pages