Categories

AutoCAD 2015 and AutoCAD LT 2015 Bible

The most comprehensive AutoCAD book around!

All the ways to open a drawing

There are lots of ways to open a drawing and sometimes you may not think of the quickest way right away. Here’s my list:

  1. The OPEN command. This is the obvious one, of course. Click the Open button on the Standard toolbar. (In 2009, click Open on the Quick Start toolbar.) Or type open on the command line.
  2. From the DesignCenter. Press Ctrl+2 to open the DesignCenter. In the left, navigation pane, navigate to the folder containing the drawing and select it. Then find the drawing in the Content pane on the right, right-click it, and choose Open in Application Window.
  3. From the Sheet Set Manager. With a sheet set open in the Sheet Set Manager, on the Sheet List tab, double-click the name of the drawing (or right-click and choose Open).
  4. Double-click it in Windows Explorer. As with any Windows file, you can double-click it in Windows Explorer to open it in AutoCAD. If AutoCAD isn’t open, Windows will start it for you.
  5. Drag from Windows Explorer to the command line window. This is a little-known tip. Drag a file from Windows Explorer to the command line window. If you drag to the drawing area instead, you insert the file as a block.
  6. From a script. Just use OPEN in your script, add a space, and enter the name of the file. (See Tutorial: Automate tasks with a script file for instructions on creating a script.) Be sure to use the entire path if it isn’t in the support file search path. Enclose the file name (and path, if any) in quotation marks if there are spaces in the name. For example:

open “c:\drawings\3a 297.dwg”

Tannar Frampton contributed another way to open a drawing. He says, “You can open drawings via the XREF Manager by right-clicking and selecting ‘Open.’ This way, you do not have to search for the file.”

Align a block to other objects with a dynamic block Alignment parameter

If you’d like to be able to quickly snap a block aligned or perpendicular to another object, a quick, helpful use for dynamic blocks is the Alignment parameter. Unlike most other parameters, you don’t need to specify an action.

The Alignment parameter is easy to create. Make the block and open the Block Editor (the BEDIT command). In the Edit Block Definition dialog box, choose the block and click OK. You’re now in the Block Editor and the Block Authoring Palettes window appears.

Click the Parameters tab and then choose the Alignment Parameter tool. At the prompt, specify the base point for the alignment parameter, the point that you want to use to snap the block. When you use this parameter, the block will rotate around this point to align with another object.

Alignment parameters can be perpendicular or tangent. To set the alignment type, press Enter or use the Type option. Choose Perpendicular if you want to align the block perpendicular to other objects. Choose Tangent if you want to align the block tangent to other objects.

Then specify the direction of the alignment. You can do this by specifying a point. As you move the cursor, you see a rubberband line from the base point. Usually, you want an orthogonal angle, but you can specify any angle that you want. The direction combines with the type to determine how the block will align. If you’re not sure, try out different options to see their effect.

Click the Save Block (Definition) button in the Block Editor and close the editor.

Now insert the block. To align it, select the block and click the alignment grip.

Drag the grip near an other object and the block snaps to that object. Note that there is always more than one possible alignment and so you’ll have to move the cursor a little to get the result you want.

acadtips_align_parameter-4

Use the command line to launch programs

You may know that you can start certain Windows programs from the command line. These programs are in the acad.pgp file that defines aliases for commands. The first section has aliases for Windows commands.

To edit this file and add more commands, choose Tools > Customize > Edit Program Parameters. Notepad opens the acad.pgp file. Scroll down until you see the following:

Therefore, if you type explorer on the command line, Windows Explorer opens. To open a new file in Notepad, type notepad and press Enter at the prompt that appears.

If you add commands, use the same format. The text before these commands explains the meaning of the 1 and the general format. Then save the file. Back in AutoCAD, type reinit to reinitialize acad.pgp and you’ll be able to use your changes.

Tushar Dabholkar from Pune, India e-mailed me some more ways to launch programs from the command line.

You can type start on the command line and it functions like choosing Start > Run in Windows. For example, you can type winword or excel to open those programs (if you have them installed). Or type calc to open the Windows calculator or mplayer2 to the Windows media player.

Tutorial: Add a button to the ribbon in AutoCAD

Customizing the ribbon is similar to customizing a toolbar, but you need to be aware of the special structure of the ribbon.

If you’re interested in creating custom commands, also see “Tutorial: Create a custom command.” This tutorial builds on those skills, but is complete in itself.

  1. Choose Tools tab> Customization panel> User Interface, or just type cui on the command line.

Tip: If you display the tab you want to work on and type cui on the command line, you can see that tab as you work– just move the Customize User Interface dialog box. In fact, if you click the title of the panel you want to work on and click the Pin icon, you can keep even the bottom section open as you work. (Unfortunately, the bottom section collapses when you click Apply.)

  1. In the Customization in All CUI Files pane, expand the Ribbon Panels item.
  2. Expand the panel where you want to add your command. You’ll see several rows. Expand one or more rows that you might want to look at. Here you see the Draw-2D panel open with several of its rows. To the left, you can see the expanded panel itself.

Note: One new concept is the sub-panel. Sub-panels are a way of compartmentalizing commands for layout purposes. On the Draw-2D panel, there’s a sub-panel after the LINE command to separate that command from the rest. Also, each panel comes with a panel separator. Rows below the panel separator don’t show until you click the panel name; they’re in the lower, expanded section.

Caution: Remember to back up your original menu file in case you make a mistake! The file is acad.cui or acad.cuix (depending on which release of AutoCAD you’re using). The location may vary, so use the OPTIONS command and click the Files tab. Open the Customization Files item to find the location. When you find the file, use Windows Explorer to back it up. Another option is to use Windows Explorer to make a copy first, rename the copy, and load the copy. Use the CUILOAD command to first unload the main acad.cui file, then browse to your copy and load that.

  1. Decide which changes you want to make. I added a custom command and moved existing commands around to better suit how often I use them. Don’t make the panel too wide, because you need to leave room for the rest of the panels. If you make a panel too wide, others will be condensed and you won’t see all of their contents.
  2. To move existing commands, drag them from one location to another. (Sometimes this doesn’t always seem to work on the first try; try another location, or delete the command and drag it from the Command List to the new location.) To delete a command, right-click and choose Remove.
  3. To add a different or custom command, locate it in the Command List at the lower-left corner of the dialog box. Then drag it to the desired location.
  4. To delete a sub-panel, drag its contents to another location, right-click it, and choose Delete. Sub-panels do a nice job of setting off buttons, but they create blank space that you might want to use.
  5. When you’ve made a few changes and want to see how they look, click the Apply button and wait while AutoCAD reloads the menu.

Note: The panel preview at the upper-left corner of the dialog box isn’t completely accurate, so don’t rely on it completely. For example, my preview showed the LINE command with a large icon, but it shows as a standard-sized icon on my ribbon. You can set the size in the Properties panel.

  1. When you’re done, click OK. Here you can see my new menu. I’ve added a custom 1LINE command (line \\;) which ends the LINE command after one line. I’ve also moved the existing buttons around and banished some to below the panel separator.

Originally done in AutoCAD 2009.

Switch between Imperial and metric measurements

If you usually draw using Imperial measurements (feet and inches), you may sometimes want to enter a length in metric units. For example, if you’re designing a house in the United States, you may have certain items that were imported from Europe and are measured in millimeters or centimeters. It might be easier to be able to enter the metric measurements but calculating the conversion can be time-consuming.

Of course, the opposite is possible. If you are drawing using metric measurements, you may need to enter a length in Imperial units. Here are a couple of AutoLISP programs, one that converts Imperial to metric (inches to millimeters) and one that converts metric to Imperial (millimeters to inches). You can use these routines whenever you need to enter a length, generally with the LINE command.

You can change these routines to make other conversions, of course.

Convert metric to Imperial

(defun m2i (len ang /)
(strcat “@” (rtos (* len (/ 0.03937 1))) “<” (rtos ang))
)

This routine (m2i means metric to Imperial) multiplies any length by 0.03937 because there are 0.03937 inches in a millimeter. So if you use a length of 100 millimeters, you’ll get 3.937 inches.

Convert Imperial to metric

(defun i2m (len ang /)
(strcat “@” (rtos (* len (/ 25.4 1))) “<” (rtos ang))
)

This routine (i2m means Imperial to metric) multiplies any length by 25.4, because there are 25.4 millimeters in an inch. So if you use a length of 3 inches, you’ll get 76.2.

How to use these routines

To load these routines, you can put them in acaddoc.lsp (which you may need to create). Make sure acaddoc.lsp is in your support file search path. Any routines in this file are automatically loaded each time you open a new drawing.

These routines have two parameters, len (length) and ang (angle). You use them at the Specify next point or [Undo]: prompt, in parentheses, adding the length and angle that you want for the line segment, as shown in this example:

(m2i 25 0)

Immediately afterwards, you see the results of the routine, so you can check that you’re getting the result you want, as shown here:

“@0.9843<0.0000”

So you’re command line would look like this:

Command: _line Specify first point:
Specify next point or [Undo]: (m2i 25 0)
“@0.9843<0.0000”

Specify next point or [Undo]:

You can then continue to specify other line segments.

I want to thank Darren Young (www.mcwi.com)  for the original AutoLISP code,  which I’ve changed slightly, and expanded upon.

Speed up your work with command aliases

When I give instructions, I usually provide ribbon access instructions for commands, but the quickest way to work is to type command aliases on the command line. You just need to know them. Print out this list and keep it by your computer for a couple of weeks until you learn them. You’ll be amazed at how much faster you work.

ARC a
BLOCK b
CIRCLE c
COPY co
ERASE e
EXPLODE x
EXTEND ex
FILLET f
HATCH h
INSERT i
LAYER la
LINE l
MOVE m
MEXT t
OPTIONS op
PLINE pl
PROPERTIES pr
ROTATE ro
TABLE tb
TOOLPALETTES tp
TRIM tr
UNDO u
XREF xr
ZOOM z

AutoCAD comes with a large number of aliases already made for you. You edit the acad.pgp file to add to these, or change them. The acad.pgp file is a text file and you can edit it directly, but the easiest way is to use the Express Tools ALIASEDIT command.

John Palmer wrote in: “I use PE (polyline edit) when I want to turn a line into a polyline.”

Brian A. Glover wrote in: “Here are a few of the keyboard aliases that I use all of the time:

AS Align Space
CS Change Space
CC Circle (I changed ‘C’ to copy because I copy 100 times a day, and draw maybe 10 circles a week)
CB Copy Base
ET Enclose Text
XX Extrim
QQ Quick Leader
TTF Text-to-Front

I try to use keys close together on the keyboard, or use the same key so I don’t have to take my eyes off the screen when I’m working.”

Gerald Goodlander wrote in: “I changed the following because Copy is used much more than Circle:

CI Circle
C Copy

Do you have your own favorites? Leave a comment and share them with others!

See current settings on the status bar

Would you like to see current settings for important system variables on tshe status bar? It looks like this:

It shows the date, DIMSCALE, LTSCALE, DIMSTYLE, and current UCS name (I named my UCS “anything“). You can put any system variable you like here. This code is in DIESEL.

; —- Mode Macro for status bar —

(setvar “modemacro”
(strcat
“Date = $(edtime, $(getvar,tdupdate),M/D/YY) Dimscale = $(getvar,dimscale) LTscale = $(getvar,ltscale) Dimstyle = $(getvar,dimstyle) UCS = $(getvar,ucsname)”
)
)
(princ)

Save this in your acad.lsp file. Then close AutoCAD (if it’s open) and open it again. That’s all there is to it!

If you don’t have an acad.lsp file, you can create it. Place it in the support file search path.

Thanks to Devon Middleditch, CAD Manager, Sydney Australia for this code. (I changed the format of the date in his code to “Americanize” it.)

Options you should change

The Options dialog box (Tools > Options or right-click in the Command Line window and choose Options) has many options that significantly affect how AutoCAD functions. If something is not working the way you want, a setting in the Options dialog box may be the answer.

Everyone works in a different environment. Various disciplines have different policies. People are different. As a result, there is no one right set of options. However, for what it’s worth, here’s my list of settings that you might want to change from their out-of-the-box defaults.

Files tab: Template Settings > Default Template File Name for QNEW: When you click the QNew button (the leftmost button) on the Standard toolbar, by default, you get the Select Template dialog box. A needless time-waster in my opinion. Instead, set this option to the template you use most, or just acad.dwt. If you want to specify a template, File > New opens the Select Template dialog box.

Display: If you work in 3D, change the Contour Lines Per Surface in the Display Resolution section to 8. The default, 4, is too puny to provide a usable display of 3D objects. This option sets the ISOLINE system variable, which affects how 3D curved objects are displayed. On the left, you see the default setting of 4. On the right you see 8.

Open and Save: In the File Open section set the Number of Recently-Used Files to List option to 9. This setting determines how many files show at the bottom of the File menu. Unfortunately, 9 is the maximum. (I think that this is a Windows standard because every program seems to have this maximum.) Although I couldn’t find documentation, I’m pretty sure I remember that the default is 4. There’s no reason not to use the maximum.

There’s a fairly new Application menu section. This defaults to 9, but you can set it up to 50. Go for it!

Plot and Publish: In the Plot to File section, change the default location to one that you actually use. (Maybe it’s just me, but I rarely use the My Documents folder.) Also, in the Background Processing Options, check the Plotting check box so you can plot while you work. If you find that this slows AutoCAD down, then turn it off again.

System: If you do 3D work, click the Properties button next to the Current 3D Graphics Display list. In the 3D Graphics System Configuration dialog box, check the Render Options check box. When you do this, the Enable Materials check box is checked. If you use lights and backgrounds, check the boxes for those options as well. Click OK until you get back to your drawing and choose View > Shade > Gouraud Shaded, Edges On, or one of the other shading options. Working with materials displayed — actually drawing and editing — is awesome! especially in the final stages of your work.

User Preferences: Time-sensitive right-click rocks! Click the Right-Click Customization button and check the Turn On Time-Sensitive Right-Click check box. Look at the options in the Right-Click Customization dialog box — almost everyone can find one that will be comfortable and make your drafting life easier.

Selection: The double effect of bolding and dashing objects can become overwhelming in a busy drawing. Click the Visual Effect Settings button and choose Thicken, rather than the default Both. You’ll still know what you will select when you pass the cursor over an object, but without any confusion.

Profiles: When you’re done with your settings, profile it! Click Add to List, name the profile, and then click Set Current. Your current settings will be saved to the profile. You can create multiple profiles for variations in your settings.

What settings do you change? Leave a comment!

Manage the user interface–the ribbon and the menu bar

AutoCAD 2009 introduced the ribbon, a completely different way of specifying commands. Some people like it; some don’t. However, if you want to use the ribbon (and it’s not going away), you can create a hybrid user interface that gives you the best of all worlds.

One reason to continue with menus is if you have third-party or customized menus that you need to continue using.

Vivian Takagaki wrote: “I made a big jump from 2002 to 2009 and I still have vendor toolbars that haven’t upgraded to ribbons. To get both ribbons and toolbars I did the following: (Saved my current settings to a Profile – just in case) Switched to Acad Classic and set up all my toolbars I used. Typed _Ribbon to get the new interface. And now I have both. I can also minimize the ribbon interface to save space to Tabs or Panel Titles. (And saved my new settings to a Profile – just in case)”

Once you have the view you like, click the Workspace Switching button on the status bar and choose Save Current As to save the new workspace.

Another option is to turn the menu bar on and off as needed. In this way, you can work with the ribbon, but return to the menu when necessary. The system variable is menubar and 0 turns it off, while 1 turns it on.

Russ Green wrote a DIESEL expression that toggles the menu bar on and off and assigned it to a keyboard shortcut (Sift+Z). Here it is:

$M=$(if,$(eq,$(getvar,menubar),0),^C^Cmenubar;1;,^C^Cmenubar;0;)

Here’s how to create that keyboard shortcut:

  1. Enter cui on the command line to open the Custom User Interface dialog box.
  2. In the Command List pane, click the Create a New Command button.
  3. In the Properties pane, enter a name and description for the command.
  4. Click in the Macro box, and then click the Ellipsis button at the right to open the Long String Editor dialog box.
  5. Enter the expression shown above.
  6. Back in the Command List, choose Custom Commands from the drop-down list of commands to more easily find the new command and choose it.
  7. In the customizations in All CUI Files pane, expand the Keyboard Shortcuts item.
  8. Drag the new command to the Shortcut Keys item under Keyboard Shortcuts.
  9. In the Properties pane, expand the Access section if necessary and click in the Keys Section. Click the Ellipsis button to open the Shortcut Keys dialog box
  10. Press the desired shortcut key combination on your keyboard. Click OK.
  11. Click Apply, then click OK to return to your drawing.

Now, you can just press your keyboard shortcut to toggle the menu bar on and off.

Loading AutoLISP programs quickly

A quick way to load an AutoLISP program is to drag it from Windows Explorer onto AutoCAD‘s drawing area. (Position the Windows Explorer window so you can see the AutoCAD drawing area or drag onto the AutoCAD taskbar button, wait until AutoCAD displays and then drag onto the drawing area.) You can even drag an AutoLISP file from the window of a search operation. Thanks to G. Ramesh of NPCC in Abu Dhabi, U.A.E. for this tip.