AC417-4: AutoCAD® Customization Boot Camp: No Experience Required

AutoCAD® Customization Boot Camp:
No Experience Required

Lee Ambrosius – Autodesk, Inc.

AC417-4 AutoCAD can be extended in a number of ways, but many users are unsure of where or how to get started. In this session, you will learn some of the most basic ways of customizing AutoCAD. You will learn how to create custom desktop icons, create and modify command aliases that can be used to start commands, record and play back action macros, define tools and tool palettes to reduce repetitive drawing tasks, and modify the ribbon and Quick Access toolbar. This class presents an overview of basic AutoCAD customization methods that you can use to enhance your productivity.

Learning Objectives

At the end of this class, you will be able to:

·  Learn which customization and programming options are available to you

·  Create custom desktop icons

·  Create and modify command aliases, and record and playback action macros

·  Define tools and tool palettes

·  Modify the ribbon and Quick Access toolbar in AutoCAD

About the Speaker

Lee is one of the technical writers on the AutoCAD team at Autodesk and has been an AutoCAD® user for over 15 years in the fields of architecture and facilities management. He has been teaching AutoCAD users for over a decade at both the corporate and college level. He is best known for his expertise in programming and customizing AutoCAD-based products, and has 10+ years of experience programming with AutoLISP®, VBA, Microsoft® .NET, and ObjectARX®. Lee has written articles for AUGI® publications and white papers for Autodesk on customization. He is the author of several books on AutoCAD and has been an active technical editor for AutoCAD books in the Bible and For Dummies series.

Twitter: http://twitter.com/leeambrosius
Email:
Blog: http://hyperpics.blogs.com

Contents

1 Introduction 3

2 Which Customization and Programming Options are Available 3

3 What You Need to Get Started 4

4 Desktop Shortcuts 4

5 Command Aliases 6

6 Action Macros 8

7 Tool Palettes 12

8 User Interface (Ribbon and Quick Access Tool bar) 17

9 Workspaces and Profiles 20

10 Where to Get More Information 23

1 Introduction

AutoCAD is an extensive 2D drafting and 3D modeling program. The functionality of AutoCAD has grown since it was first introduced almost 30 years ago in 1982. What sets AutoCAD apart from other CAD programs is its expansive capabilities of being customized and tailored to the workflows specific to the way a company works. These workflows might be the extraction of data from a drawing for use downstream in a BOM for manufacturing or to consume project information from something like a spreadsheet or database.

This session will help you learn how to leverage some of the basic customization methods AutoCAD offers and get more out of your company’s investment. While it is true that you need to learn how to program to get the most out of AutoCAD, you do not need to learn how to program in order to be more productive with AutoCAD.

2 Which Customization and Programming Options are Available

Not all customization and programming options are created equally, and some of the ways you can customize AutoCAD are well integrated into the program that you might not even think twice about doing. Creating new layers and styles is a way to customization AutoCAD that many drafters do not even realize that is what they are doing. When applied combined with a drawing template, they help to reduce repetitive tasks and reduce errors.

The following lists some of the common customization and programming options that are available for AutoCAD:

Basic

·  Layers

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

·  Blocks

·  Drawing templates

·  Plot styles

·  User profiles

·  Workspaces

·  Desktop icon customization

·  Command aliases

·  Tool palettes

·  Materials and visual styles

Intermediate

·  Scripts

·  User interface (CUI Editor)

·  Dynamic blocks

·  Action macros

·  DIESEL

·  Custom linetypes and hatch patterns

·  Custom shapes and text styles

Advanced

·  Database connectivity

·  AutoLISP / Visual LISP

·  Visual Basic for Applications (VBA)

·  ActiveX / COM (VBScript, VB.NET, C#, C++)

·  Managed .NET (VB.NET, C#)

·  ObjectARX (C++)

·  Sheet Set Manager API

·  Custom CAD Standards plug-ins

3 What You Need to Get Started

Many of the customization options that AutoCAD offers are supported through utilities or commands that come with AutoCAD or are already installed as part of the operating system. It is when you want to extend the functionality of AutoCAD by using one of the programming options that you will most likely have to purchase or install additional tools.

The following customization options are edited primarily outside of AutoCAD using a plain text editor:

·  Command aliases

·  Hatch patterns

·  Linetypes

·  Shapes or text styles

·  Scripts

On Windows the pre-installed text editor is NotePad, while on Mac OS X it is TextEdit.

4 Desktop Shortcuts

Shortcuts, often found on the desktop, are used to start an application. By default, a shortcut starts an application and can perform additional tasks through the use of command line switches if the program is designed to use command line switches. When you install a vertical program like AutoCAD Architecture, it uses command line switches to switch between profiles.

Customizing a desktop shortcut is done by adding a command line switch to the execution path of the shortcut. The AutoCAD command line switches can be used to specify the default drawing template (DWT, load a sheet set, publish a DSD file, execute a script, or set a workspace current.

AutoCAD supports a total of 14 different command line switches. Command line switches can be used individually or combined together, and are not case sensitive. The following is the default execution/target of the AutoCAD 2012 – English shortcut:

"C:\Program Files\Autodesk\AutoCAD 2012 - English\acad.exe"

Some of the most useful and commonly used command line switches are:

Switch Name / Description
/t / Specifies the drawing template to use for the default drawing.
/t “mytemplate.dwt”
/nologo / Splash screen is not displayed at startup.
/nologo
/p / Sets a named user profile current that is loaded in the product or loads a previously exported profile (ARG) file.
/p “<Unnamed Profile>”
/nohardware / Hardware acceleration is disabled at startup.
/nohardware
/set / Loads a sheet set (DST) file.
/set “mysheets.dst”
/w / Sets a named workspace current if it is part of the loaded CUI file.
/w “2D Drafting”
/pl / Loads a drawing set description (DSD) file created with the PUBLISH command and plots the drawings listed in the file in the background.
/pl “mypublish.dsd”

When specifying a folder or file with spaces in a command line switch, you must surround the path and file name with double quotation marks. The following shows an example of suppressing the splash screen, creating the default drawing based on the C-size.dwt drawing template file, and setting the 3D Basics workspace current.

"C:\Program Files\Autodesk\AutoCAD 2012 - English\acad.exe" /nologo /t "C:\Datasets\AC417-4\C-size.dwt" /w "3D Basics"

The following steps explain how to customize the AutoCAD desktop icon.

  1. Right-click on the AutoCAD 2012 – English shortcut and click Copy.
  2. Right-click in an empty area of the desktop and click Paste.
  3. Right-click the new shortcut and click Properties.
  4. In the Properties dialog box, on the Shortcut tab, Target text box, edit the execution text as needed.
  1. Optionally, edit the text in the Comment text box.

The Comment text is displayed in a tooltip when the cursor hovers over the shortcut.

  1. On the General tab, Name text box, edit the name of the shortcut to identify the purpose of the shortcut.
  2. Click OK to save the changes.
  3. Double-click the shortcut to test the new behavior.

5 Command Aliases

Commands are the heart and soul of AutoCAD, but they take time to type in or locate in the user interface. While there have been improvements to the user interface ever since AutoCAD was first introduced, the Command prompt is still the fastest way to execute a command.

Unlike the user interface, command aliases have stayed relatively consistent for well over 12+ releases. This is why many AutoCAD veterans can execute a command often in less time than a user looking for a command in the user interface, whether in the ‘Classic’ workspace or using the ribbon.

Command aliases are stored in the Program Parameters (PGP) file and can be edited using a plain text editor. A command alias is broken up into two parts separated by a comma; abbreviation and AutoCAD command name.

abbreviation, *command

The following are common examples of command aliases:

C, *CIRCLE
E, *ERASE
L, *LINE
P, *PAN
Z, *ZOOM

In addition to command aliases, the PGP file also defines external commands which are used to start OS applications from inside of AutoCAD. External commands are not as common these days. The following is an example of an external command alias defined with the name EXPLORER and is used to start Windows Explorer:

EXPLORER, START EXPLORER, 1,,

It is recommended to place all new command aliases at the end of the PGP, this will help you to identify which aliases need to be migrated after upgrading to a new release. If you create an alias that has the same abbreviation as another alias in the PGP file, the last instance of an alias is the one AutoCAD remembers.

The following steps explain how to define an alias to start the REVCLOUD command and to override the C alias to start the COPY command instead of CIRCLE.

  1. On the ribbon, click Manage tab > Customization panel > Edit Aliases.
  2. Scroll to the bottom of the file or press Ctrl+End.

The cursor should now be placed under the ‘User Defined Command Aliases’ section.

  1. Enter the text RV, *REVCLOUD.

You can add spaces after the comma for readability, but they are not required. Typing RV at the Command prompt will start the REVCLOUD command once the PGP file is loaded.

  1. Enter the text C, *COPY after the RV command alias.
  2. Enter the text CI, *CIRCLE after the C command alias.
  3. In Notepad, click File menu > Save.


The PGP file should look similar to the following now:

; **********------********** ; No xlate ; DO NOT REMOVE

RV, *REVCLOUD

C, *COPY

CI, *CIRCLE

  1. Switch back to AutoCAD and type REINIT at the Command prompt.
  2. In the Re-initialization dialog box, click PGP file and click OK.
  3. Test the new aliases in AutoCAD.

TIP: If you are using AutoCAD on Windows, you can use the Alias Editor (ALIASEDIT) that is part of the Express Tools to modify the PGP file.

Command aliases can only be used to start a command and not start a command with a specific sequence of options. To start a command and execute a serious of options, you will want to create an action macro, covered later in this handout, or create a custom command using AutoLISP.

The following are examples of single line AutoLISP programs that can be defined to execute a specific sequence of command options.

;; Custom Zoom commands
(defun c:ZW () (command "._zoom" "_w"))
(defun c:ZP () (command "._zoom" "_p"))

;; Insert title block
(defun c:TB () (command "._-insert" "C:\Datasets\AC417-4\C-Size Title Block.dwg" "0,0" "1" "1" "0"))

The AutoLISP code can be loaded automatically into AutoCAD by placing it in a file named acad.lsp and then placing the file in a path defined under the Support File Search Path in the Options dialog box.

6 Action Macros

Action macros allow you to create custom commands to automate repetitive tasks without needing to know how to program. You use the Action Recorder to create action macros which make it intuitive for non-programmers to automate tasks in AutoCAD.

The Action Recorder, see the illustration on the right, is a panel on the AutoCAD ribbon. From the Action Recorder, you record commands and input values as they are entered at the Command prompt or specified in the drawing area.

Recorded actions are saved to an action macro file which has the ACTM file extension. Once saved, ACTM files can be played back later to repeat the same tasks that were recorded.

The Action Recorder panel contains a set of controls that are always accessible with additional tools available when the panel is expanded. Click the panel’s name to expand it. When expanded and docked, the panel can be pinned so it remains open until you switch tabs on the ribbon or unpin the panel.

The following describes each control on the Action Recorder:

1.  Record/Stop – Starts and stops the recording of an action macro; stops the playback of an action macro.

2.  Insert Message – Inserts a user message into the current action macro.

3.  Insert Base Point – Inserts a pause for a base point; the base point is used by the proceeding coordinate entry/value in the action macro.

4.  Pause for User Input – Inserts a pause for user input during playback on the selected value node.

5.  Play – Starts the playback of the action macro selected in the Action Macro list.

6.  Preference – Displays the Action Recorder Preferences dialog box, where you can control the display of the Action Recorder panel during recording and playback.

7.  Manage Action Macros – Displays the Action Macro Manager, where you can copy, rename, modify, and delete action macros.

8.  Action Macro List – Displays a list of all available action macros that can be played back or modified. Selecting an action macro sets it as the current action macro to be modified in the Action tree.

9.  Action Tree – Displays the individual actions and values of the current action macro.

Storing of Action Macro Files

Newly recorded action macros are saved to one location, while other ACTM files for playback only are stored in another location. The paths used for recording and playing back ACTM files are grouped under the Action Recorder Settings node on the Files tab of the Options dialog box. The two nodes that define the locations used by the Action Recorder are: