Chapter 2. Managing Your System

I'm a teacher and trainer, and my experience with AutoCAD users tells me you should know some things about your computer system that affect how AutoCAD functions. I often find that even experienced AutoCAD users run into confusing situations when they try to use backup or Autosave files. That's why I'm focusing this chapter on managing the system you use to work with AutoCAD. In this chapter, I'll take you through the Options dialog box and discuss the relationship between profiles and workspaces.

I'll also take you on a brief trip into the past, with a discussion of how knowing some old-fashioned DOS can save you a huge amount of time. (If DOS is too antique for you, call it Windows Scripting Language.) I want to encourage you to preserve knowledge that's fast fading away; fewer and fewer AutoCAD users remember (if they ever knew) how powerful these functions are.

I'll conclude this chapter with a discussion of the ACAD.PGP file: a humble little thing that still has some utility and provides the only hook to certain operating system features from the AutoLISP processor.

  • Managing Files

  • Managing AutoCAD

  • Directories

  • Why DOS Isn't Dead Yet

  • External Commands

Managing Files

AutoCAD uses many different file types. Two of them are useful to you because they're backups or automatically saved versions of your current drawing. When you're in a bind because you've lost a drawing, AutoCAD has stopped responding, the computer has crashed, or you tried to open a corrupted file, you should know how to use the backup files and the Autosave files that AutoCAD creates. It's not as obvious as you may hope.

Backup Files

When you save a drawing, any existing file of the same name is renamed by changing the .dwg extension to .bak before your drawing is saved. It's in the same folder as your .dwg file. To use a backup file, change the extension to .dwg, and open the file. If that results in a file with the same name as another file, you must also change the filename. Although some data may be missing, it's better than nothing. By the way, it's possible to turn off the backup feature in OPTIONS; doing so saves hard disk space at some risk of data loss.

Autosave Files

AutoCAD automatically saves your drawing every 15 minutes by default. Unfortunately, if you don't change the default settings for Windows, you won't be able to find the resulting file; and even if you could, you wouldn't be able to open it. This section shows you how to fix that surprising glitch. OK, it's a Windows feature, not a glitch, but why should it be so hard to find a critical file?

The file created by the Autosave function does not have the same name, extension, or path as the drawing. The name given to the file created by Autosave starts with the drawing name and contains incrementing characters. The extension is always .sv$. As with BAK files, the extension must be changed to .dwg before the file can be opened as a drawing.

Note

Note the dollar sign used as the last character of the extension: It indicates that this file is temporary. An SV$ file is available for a drawing only if AutoCAD terminates abnormally. Otherwise, it's deleted when AutoCAD closes. Don't rely too heavily on this feature—you must save your files regularly to avoid losing data.

By default, Autosave files are in C:Documents and Settings\%username%local settings emp.

To change the name of an Autosave file, you must do two things.

  • The default location is a hidden folder, so you must make hidden folders visible in order to display the filename in Windows Explorer.

  • The file extensions for AutoCAD are known file types, so they're hidden by default. To change the extension of an Autosave file from .sv$ to .dwg, you must clear the Hide File Extensions For Known File Types check box.

Changing folder options

Figure 2.1. Changing folder options

You can do both of those things in any Windows file-management dialog box, such as Windows Explorer, by choosing Tools → Folder Options → View. Select the Show Hidden Files And Folders radio button, and clear Hide Extensions For Known File Types check box, as shown in Figure 2.1.

One you make these changes, you can both find the files created by Autosave and change their extensions. However, I recommend that you change the location of Autosave files from this default to a custom folder, using the Files tab of the Options dialog box (see Chapter 3, "Customizing AutoCAD's Interface"). I also recommend that SAVETIME be set to an increment of 15–30 minutes so you won't lose too much work if you ever need the Autosave file.

Note

SAVETIME is saved in the system registry, not in the drawing, so its value stays the same for every drawing once it's set.

AutoCAD 2006 added a Drawing Recovery Manager that pops up the next time you start AutoCAD if the last session ended abnormally. This makes it much easier to use the Autosave files, because you can open them from this window. Earlier releases don't have this function. To run the Drawing Recovery Manager manually, use the DRAWING-RECOVERY command, which you can access from File → Drawing Utilities → Drawing Recovery Manager.

Working with Files on Removable Media

Did you know that you shouldn't open DWG files directly from any removable media? Nor should you use SAVEAS to save a drawing directly to any removable media, including flash drives, CD burners, or floppy disks. Why? Because if you do, the default location for your drawing files is the removable disk. This can slow your work considerably, because the removable disk can fill up with BAK files, and the computer does frequent searches on it while you're working. Instead, to use a file from a removable disk, first copy it to the hard drive, and then open it from there. When you save files, even backup files, first save them to the hard drive, and then copy them to the removable disk.

To save a backup to a removable disk, right-click the filename in any file-management dialog box, and select the Send To option, as shown in Figure 2.2. Files copied from a CDR or DVD+R disk will probably have the Read-Only property checked. To change that, right-click the filename, select Properties, and then clear the Read-Only attribute.

Archiving Files

When you archive drawings on servers or local hard drives that have a limited capacity, reduce the file size as much as possible by using the PURGE or WBLOCK command. If you have limited file space, use compression software to reduce the drawings' sizes even further. You may even ask whether you really need all those files, but I err on the side of saving everything.

Don't rely entirely on keeping files on a single computer, or even in a single room. Writers often refer to fire copies of their manuscripts. You might think the same way. What if your office burns down? Invest in a DVD burner, determine which files would cost you money if you lost them, and put those files on DVD. Then, store them in another building.

Using Send To to save backup files

Figure 2.2. Using Send To to save backup files

Set a Default File-Saving Location

Set the path for starting up AutoCAD in the Properties window for the AutoCAD desktop icon. Display the Properties window by right-clicking the icon and selecting Properties at the bottom of the list. Type in the location of the folder in which you want AutoCAD to start. Now you'll go directly to the folder you specify when you save new drawings for the first time.

Note that the example in Figure 2.3 also includes a startup template file, a startup profile, and a startup script. See Chapter 7, "AutoCAD Scripts," for more information.

Desktop icon properties

Figure 2.3. Desktop icon properties

Creating and Using Template Files

You can save a lot of work if you create and use AutoCAD template files. To create a template file, open a drawing that is set up the way most of your drawings in each discipline should be set up—with proper layer names, dimension styles, text styles, variable settings, layouts, and block definitions. Save it using the SAVEAS command, by selecting AutoCAD Drawing Template File (.dwt) from the Files Of Type field. Give the drawing a name that's logical, and save it in either the default location given (the default is C:Documents and SettingsUserNameLocal SettingsApplication DataAutodeskAutoCAD 2007R17.0enuTemplate, which is, believe it or not, yet another hidden folder) or a custom folder. Now, erase all the objects in the drawing, and save it again. See Chapter 4, "Applying Graphics Standards," for suggestions about what should be included in a template file.

I also recommend creating a template folder of your own. In the next section, I'll discuss using OPTIONS to set the path for template files to your custom folder.

Managing AutoCAD

AutoCAD's interface is complex and can be cluttered. When you do a default installation and start AutoCAD, you barely have any room to draw. Most users immediately start changing the interface by turning off toolbars and tool palettes, but you have a lot more control than that. This is one of my favorite AutoCAD features: You have a lot of control over how the program looks and works, so it's easy to adapt it to your personal style of working.

One feature that helps users manage AutoCAD is the Options dialog box. By optimizing specific settings, you can improve your efficiency and make your AutoCAD experience easier and more pleasant. In this section, I'll show you how you can combine the use of saved workspaces and profiles, and I'll give you a little advice on maintaining AutoCAD.

Note

If you want an uncluttered drawing editor, but you don't want to turn off all the toolbars and palettes, use the CLEANSCREENON and CLEANSCREENOFF commands. What, they're too hard to type? Well, this is AutoCAD, so you know there are three other ways to do it. The quickest is Ctrl+0 (that's zero, not O), which toggles clean screen on and off. Now you can have all those aids and room to draw, as well. There is also a button that controls Clean Screen at the right end of the status bar, but it's not a toggle since once it's selected, it disappears—you can only use it to turn CLEANSCREEN off. Use Ctrl+0 to turn it back on.

Options and Profiles

You can customize the interface by changing things like the background color, the behavior of right-click menus, the locations of default files, and so on. Use the Profiles tab of the Options dialog box to save the resulting profile with a specific and logical name, and export it to an ARG file so you can use it on another computer (or restore it on your current computer if your settings change). You may find that having multiple profiles is helpful, either because others use the same workstation you do, or because you use AutoCAD for different kinds of projects that benefit from different settings.

This section includes recommendations for changes to settings in each of the 10 tabs of the Options dialog box:

The figure of each tab illustrates the settings I recommend you change.

Options and Profiles

Files Tab

I have found that a great deal of confusion among AutoCAD stems from not understanding the notion of a search path. When any software needs a file, it looks for it in either the specific location you give (such as C:dwgmydrawing.DWG) or a predetermined set of folders. AutoCAD won't search an entire computer looking for the application files it needs, because that would take an enormous amount of time.

The order in which AutoCAD searches for folders also matters, because if it's looking for a file named ACAD.LIN, for example, it stops at the first such file it finds. It's possible that there are other files with the same name on your system, and they could even be in a folder that is specified as part of the search path; but if AutoCAD finds another one first, that's the one it uses.

If your custom linetypes, aliases, or AutoLISP commands aren't working as you hoped, it's possible that the file that contains them isn't early enough in the AutoCAD file search path, and that some other version of the file is being found first. That's why all the sections of the Files tab include a Move Up button. You can create new folders, if you desire, and then use this button to move them into the location along the path that suits your needs—usually at the top.

Note

To find the location of any specific support file that AutoCAD is currently using, replace filename.ext in the following line of AutoLISP code with the name of the file you're looking for, and type it at the command line, including the parentheses: (findfile "filename.ext").

I recommend that you create a folder in which you place all the files you use to customize AutoCAD, except the CUI files. This folder should not be located in the C:program filesAutodeskAutocad 2007 folder. Otherwise, you may inadvertently delete it when you upgrade to a new version of AutoCAD.

Once you have a folder for your customization files, add it to the Project Files Search Path. This setting identifies the folders that AutoCAD searches by default when it needs a file. This folder can be your personal folder or a network location that allows all users to have access to office-wide customization files. After you add the folder to the search path, move it to the top of the search path list so that your files are the first ones AutoCAD finds.

The Customization Files section shows the default location of both the Main and Enterprise CUI files. You should customize only the Main file for personal settings. The Enterprise file is to be created and managed by a CAD manager. It's generally used over a network for customization files to be used by everyone, and it's read-only to most users.

You can also set a new location for Autosave files in this tab using the Browse button. I recommend saving them in a folder that you've created. Doing so eliminates the problem of the hidden folder into which those files are placed by default. I recommend that you also create a location for your own custom DWT files and add that folder to the Drawing Template File Location path under Template Settings. The folder can be local or a shared folder on a network. If you're networked, you may want to point to a different location for plotters or pen style tables as well. See Figure 2.4.

Display Tab

The Display tab is where you can get creative about your personal preferences: the colors of backgrounds, the command line, the layouts, and so on. You should hide scroll bars; doing so gives you more screen space and prevents the sudden shift in the screen display that sometimes happens when you grab a scroll bar by mistake as you try to make a selection near the edge of your screen. You can also change your background color to white, which you may want to do if you use an earlier release of AutoCAD and are doing screen captures or using the WMFOUT command to create a raster image. If your eyes are going bad, increase the font size in the command line. If you think a magenta background would be soothing, change it.

Files tab of the Options dialog box

Figure 2.4. Files tab of the Options dialog box

Display tab of the Options dialog box

Figure 2.5. Display tab of the Options dialog box

Other things of note in this dialog box include the controls over layouts. By default, a floating viewport is added automatically to a new layout. If you don't like having a viewport created automatically, clear that setting. Set Arc And Circle Smoothness to at least 1000. On earlier releases the default value of VIEWRES is set to 100. The size of the crosshair can be increased from 5 percent up to 100 percent if you just have to have an R14 retro look. See Figure 2.5.

Open And Save Tab

By default, AutoCAD uses the file format of the current release when saving. Set the Save As option to an earlier release if you exchange drawings with other companies. I've gotten stuck more than once when I produced some work for someone and sent it off, only to find that they used an incompatible release.

Note

If you have a file you can't open because the format is incompatible with the release you are using, download a free conversion utility at www.autodesk.com. Search the Autodesk website for "DWG TrueConvert." While you're there, you may also want to download the utility "DWG TrueView." You can use this to view any AutoCAD DWG, DXF, or DWF on a computer that doesn't have AutoCAD installed.

Set Automatic Save to 15 to 30 minutes to reduce the number of interruptions. I find that 10 minutes is a bit too frequent for complex drawings, because the save takes time and system resources.

Note

If you use an increment of 15–30 minutes, then when an Autosave takes place, look at an object some distance from the monitor and stretch your hands and wrists. If you're diligent about doing this every 15 minutes, you're much less likely to experience eyestrain or repetitive-motion problems.

The Incremental Save Percentage balances how quickly the drawing saves with how much space it takes up. The larger the value, the less time required for saving each drawing; but the size of the drawing is much larger until the estimated wasted space exceeds 50 percent. Once that happens, a full save with smaller file size takes place. I find that 50 percent works well because most workstations have ample storage capacity. If it takes too long to save your files, bump this value up to a higher number.

Security Options are interesting, primarily because of the opportunity to add password protection to your drawings. I don't know of any offices that use the digital signatures or password protection available by clicking this button. If I were a CAD manager, I'd turn it off just to prevent users from locking a drawing. Of course, an automated backup system should also be in place, with rights carefully controlled.

If backup files take up too much room on your hard drive, you can disable them here. I've done that in the past in student computer labs, but large-capacity hard drives are so cheap that I haven't bothered to do so for a while.

If you're using an earlier release of AutoCAD, increase Number Of Recently-Used Files To List from 4 to the maximum of 9. It would be nice if the history function of the much-maligned AutoCAD Today had been retained, but it wasn't. Setting this value to 9 is the closest you can come.

Demand Load Xrefs Enabled With Copy is generally the best setting for external references, but you may want to clear the Allow Other Users To Refedit Current Drawing check box if you're a CAD manager. It's easy for someone using an XRef to change it and save the result. I prefer to have someone open an externally referenced drawing directly if it needs to be edited. Clearing the check box sets the variable XEDIT to 0. See Figure 2.6.

Plot And Publish Tab

The Plot And Publish tab has a lot of things worth changing. Begin by selecting a default plotter. Doing so reduces the likelihood of someone using the wrong device. If you use the Plot To File option, as I often do to create raster plot images, you may want to create a different default location for plot files. By default, background plotting is used only when you plot using the Publishing functions. If you add the Plotting setting, it will speed up your plotting somewhat. If you use different plotter configurations for different sheet sizes, as is common, I suggest that you change the setting for Paper Size to Use The Plot Device Paper Size.

Open And Save tab of the Options dialog box

Figure 2.6. Open And Save tab of the Options dialog box

I also check the Hide System Printers box so that every print device available to a particular workstation doesn't show up as an available plotter. That way, output can be controlled by specific plot styles, and it's less likely that users will select a plotter for a new configuration. This tab is also the place to set up default plot stamp data.

Clicking the Plot Style Table Settings button gives you some control over plotting with color tables or style tables. Plotting is discussed in Chapter 6, "Plotting," at length, including a discussion of the merits of color tables versus style tables. If there wasn't such a long legacy of plotting by color, we wouldn't be faced with this choice—we'd be using style tables. But in my experience, most offices use color tables. I suggest specifying a default Plot Style Table here to avoid the None option being left on by mistake. When the Plot Style Table is set to None, you get a color plot that matches object color, which may not be what you want. See Figure 2.7.

System Tab

I have suggestions about only two options on this tab. The 3D Performance settings depend a great deal on your hardware, and I don't have enough experience with the options to advise you. You can find out whether your graphics card is certified by selecting View Tune Log and clicking Check For Updates, which takes you to the Autodesk website's certified hardware URL.

Otherwise, if you want the startup dialog box, this tab is where you can change AutoCAD's current behavior. If you use a legacy ACAD.LSP file, check Load acad.lsp With Every Drawing unless you want it loaded only in the first drawing that is opened or started in an editing session. If so, you can create an ACADDOC.LSP file that will load in each drawing, and use the ACAD.LSP file to start up applications you want loaded only once. See Figure 2.8.

Plot And Publish tab of the Options dialog box

Figure 2.7. Plot And Publish tab of the Options dialog box

System tab of the Options dialog box

Figure 2.8. System tab of the Options dialog box

User Preferences Tab

The User Preferences tab contains some great stuff. I like the double-click functions of AutoCAD, but I know a lot of users who don't. If double-clicking an object and having its editing function pop up is annoying, you can turn off double-click editing here. Far more useful to me is the time-sensitive right-click available via the Right-Click Customization button. See Figure 2.9.

If you've been using AutoCAD for some time, you undoubtedly got used to right-clicking to end a command and then right-clicking to repeat a command you just exited. Drawing lines involved doing that constantly. When right-click menus became important in AutoCAD 2000, it was a difficult transition for some of us. We didn't like the menu popping up with Enter as the first option every time we right-clicked. With time-sensitive right-click, you can a get different behavior from a quick right-click than from a slow one. A quick click issues the Enter command, and a slow click brings up a menu. If you haven't tried this feature yet, you should, even if you're not an old-timer. The default setting of 250 milliseconds is OK, but you may want to lower the value so the time necessary to bring up a menu is reduced.

Priority For Coordinate Data Entry should be left the way it is. Otherwise, a specific absolute coordinate you type in may be overridden by a running osnap. That was a significant problem in AutoCAD before this feature was added. Scripts are exempted by default because people sometimes write script files in which they intend a running osnap to over-ride absolute coordinates.

User Preferences tab of the Options dialog box

Figure 2.9. User Preferences tab of the Options dialog box

I have one other caution about the User Preferences tab. If you clear the Make New Dimensions Associative check box, the value of DIMASSOC changes from 2 to 1. This means dimensions will be associated with definition points, not with geometry, so they won't move when the geometry moves. They also won't give accurate values in Paper Space, except when the viewport being used is scaled 1:1.

The big news in this tab since AutoCAD 2006 is the Edit Scale List button. You can add or remove any scale from the Viewport Scale Control drop-down list that appears on the Viewports toolbar. You may remove scales to prevent users from selecting a plot scale that doesn't conform to your office standards. This drop-down list is used for selecting plot scales for viewports in layouts. If you've deleted some scales that you want back, you can reset the list to the defaults.

Drafting Tab

I have two recommendations for the Drafting tab: Reduce Aperture Size to make selecting objects with running osnaps more precise, and use Drafting Tooltip Settings to increase the size of the dynamic input cursor text. If your eyes are good, and you don't do presentations, you can leave it the way it is. See Figure 2.10.

3D Modeling Tab

The only thing I recommend regarding the 3D Modeling tab is selecting the Reverse Mouse Wheel Zoom option if you also use Autodesk Inventor. When I've been working with one or the other, the zoom wheel feels backward. If you work with both AutoCAD and Inventor, this adjustment is surprisingly helpful. See Figure 2.11.

Drafting tab of the Options dialog box

Figure 2.10. Drafting tab of the Options dialog box

3D Modeling tab of the Options dialog box

Figure 2.11. 3D Modeling tab of the Options dialog box

Selection Tab

The Selection tab, not surprisingly, is where you can control AutoCAD's behavior when you're selecting entities. See Figure 2.12.

Three options on this tab often go awry:

  • Make sure Noun/Verb Selection is checked so you can select an object first, and then identify an action to apply to it. You undoubtedly use this feature whenever you change an object's layer with the Layer Control window on the Layer toolbar. This option controls the PICKFIRST variable, which sometimes gets changed without the user realizing it.

    Note

    Historically, AutoCAD has used a verb/noun syntax for commands. A user first started a command, like MOVE (verb), and then selected an object (the noun). Noun/verb syntax was added to AutoCAD because many other CAD programs let a user first select an object and then select the action to be performed on that object. Whenever you select an object and then select a layer to move it to, you're using noun/verb syntax.

  • You may want to increase or reduce Pickbox Size to make object selection easier. You may also want to decrease the number of selected objects for which grips are shown, because the default is 100; I certainly wouldn't increase this value.

    Selection tab of the Options dialog box

    Figure 2.12. Selection tab of the Options dialog box

  • You may also find that PICKADD, the variable that controls the Shift To Add option, mysteriously changes. If so, the Properties palette toggle is the likely culprit. Users sometimes try to close the Properties palette by selecting the + sign, which apparently looks too much like the X used to close a window. Why we needed a means of changing PICKADD there, I can't say.

Profiles Tab

The Profiles tab allows you to save a named profile once you've gone to the trouble of setting up the interface exactly the way you want it. A named profile is saved in the system registry and can be set current at any time, including on startup if you use a desktop icon and place the /p switch in the Target window. The only settings that are saved in a named profile are those that can be changed in the Options dialog box.

If you want to use a named profile on another workstation, or you want to back up the profile, export the result to an AutoCAD Registry file (.arg) using the Export button. You can import the file using the Import button. See Figure 2.13.

Note

Setting a profile current may change the search paths used by AutoCAD. If you import an ARG file that was created by another user or for a different release or installation of AutoCAD, you may not have the correct search path for your workstation. Always save the current profile before importing a new one so you can quickly and easily return to the current settings if things go wrong.

Profiles tab of the Options dialog box

Figure 2.13. Profiles tab of the Options dialog box

Workspaces

Workspaces were added in AutoCAD 2006. You should use them to save the appearance, properties, and location of the following elements:

  • Advanced render settings

  • Command line

  • Dashboard

  • dbConnect Manager

  • AutoCAD DesignCenter

  • External References Manager

  • Info palette

  • Materials palette

  • Markup Set Manager

  • Properties palette

  • QuickCalc

  • Sheet Set Manager

  • Toolbars

  • Tool palettes

  • Visual Style Manager

When you change these elements, the changes aren't saved to the current workspace. You must manually save them by clicking Save Current As on the Workspaces toolbar and giving the workspace a name. This allows you to save custom toolbar and palette settings for specific projects to named workspaces. Keep the default workspaces intact so you can return to them if you need to.

Note

Workspaces may have some tiny glitches. The state of the AutoCAD DesignCenter (ADC) sometimes changes if you exit AutoCAD with one workspace active, open it again and change to a different workspace. The display of custom toolbars isn't always predictable either. However, those little issues will be worked out—and even with them, workspaces are very much worth using.

Using Workspaces and Profiles Together

There is a startup switch for profiles (/p), and as of AutoCAD 2007, there's one for workspaces as well (/w). If you're using AutoCAD 2006 and want AutoCAD to start with a specific profile (dan, for example) and a specific workspace (abbott, for example), create a script file (see Chapter 7) with the line WSCURRENT abbott, and then save the file with the extension .scr (startup.scr, for example). Make a copy of the AutoCAD desktop icon, and add the following to the startup line in the properties window after the call to ACAD.EXE:

/b startup.scr /p dan

The entire startup line looks like this for a default installation of AutoCAD:

"C:Program Files AutoCAD 2007acad.exe" /b setup.scr /p dan

When you start AutoCAD by clicking this icon, you load both your profile and your workspace. In AutoCAD 2007, the same thing can be accomplished by adding the /w to the line, which looks like this:

"C:Program Files AutoCAD 2007acad.exe" /p dan /w abbott

Startup Switches

Speaking of startup switches, you can use others with AutoCAD either from an operating system command prompt or in the target window of a shortcut icon. Some of them—/b, /t, /p, and /w—I use regularly, but others I have never personally needed (I know that a lot of people use the /nologo switch). Table 2.1 identifies each switch and the use it serves in AutoCAD.

Maintaining AutoCAD

As with most software, a few problems get through the beta process for each version of AutoCAD. Usually, at least one service pack is required after each release. You can do several things to maintain your installation of AutoCAD and find workarounds for software bugs that get through.

Maintaining AutoCAD

Table 2.1. Command-Line Switches

SWITCH

NAME

PURPOSE

/b

Script

Followed by a script name, runs a script (see Chapter 8, "AutoLisp by Example: Getting Started")

/t

Template

Followed by the name of a DWG or DWT file, starts AutoCAD using that file as a template

/c

Configuration

Sets the hardware path for a CFG file

/v

View

Starts a drawing with a named view

/ld

Load

Loads an ARX or DBX application

/s

Support

Identifies support folders for the search path

/nologo

No AutoCAD logo

Eliminates the AutoCAD logo on startup

/p

Profile

Specifies a named profile on startup

/nossm

No Sheet set

Prevents the Sheet Set Manager from displaying

/set

Sheet set

Loads a named sheet set

/w

Workspace

Specifies a named workspace (new in AutoCAD 2007)

/pl

Plot

Plots a drawing set from a file

/r

Configuration

Restores the default pointing device (usually a mouse) by changing the AutoCAD configuration in the acad2007.cfg file

Communications Center Settings

Figure 2.14. Communications Center Settings

You can find out about many AutoCAD bugs by reading Cadalyst, which you can find online at www.cadalyst.com. Look for the Bug Watch feature written by Steve Johnson.

Keep backup copies of key customization files, particularly ACAD.CUI (AutoCAD 2006 and 2007), ACADDOC.LSP, and ACAD.MNS (prior to AutoCAD 2006), in a folder that is not in the AutoCAD Program Files folder. If your menus change unexpectedly, you can replace the appropriate files.

Directories

The terms directory, subdirectory, and folder are used here interchangeably to refer to any named digital location that isn't a drive letter. In DOS, those locations are usually referred to as directories; directories contained inside another directory are called subdirectories. In Windows, they're called folders. Same thing.

Competent CAD work requires that you understand the fundamentals of your operating system. Among the most important of these fundamentals are subdirectories and path statements. I have a few tips about mapping drive letters, understanding what a path is, and understanding the confusing filenames that sometimes result from a conflict between the old and the new rules for naming files and folders.

Paths

Files used on computers must have a name and a location. When you save a file, you must identify both the filename and its location. A file's location is sometimes referred to as a path. A path starts with a drive letter, which can be any letter of the alphabet. Generally, the A: and B: drives are floppy drives, and the C: drive is the first hard drive. It's possible to partition physical hard drives into two or more drives (D:, E:, and so on). You can also have more than one physical hard drive in a computer. In addition to physical hard drives, you undoubtedly have one or more CD or DVD drives, and you may have multiple thumb or flash drives or even digital cameras attached via USB ports. They all have drive letters assigned to them.

To complicate matters further, if you're attached to a network, you have access to additional physical drives, some of which may be partitioned into more than one drive. Even worse, network directories are often mapped with drive letters, even though they're directories and not drives. And just to make things just slightly more involved, a drive letter can be assigned to any folder on a local workstation. Don't get thrown by all the drive letters you're likely to encounter, particularly in a networked environment: A drive letter is simply the start of a path.

Note

You can easily map drive letters to a network folder in Windows by right-clicking the My Computer icon and selecting Map Network Drive, but it isn't so easy to map a drive letter to a folder on the local computer. To do that, use the DOS subst function at the Operating System command prompt or in a batch file (see the section "Why DOS Isn't Dead Yet," later in this chapter). Here's the syntax: subst S: c:sybexASTEUSKch01. Now you can use the drive letter S: to go directly to the specified folder.

Think of your computer as a file cabinet with multiple drawers: an A: drive drawer, a C: drive drawer, a D: drive door, an E: drive drawer, and an X: drive drawer. It's nice to have five places to store files, but you would never just throw a pile of papers into one drawer in a file cabinet. As with a file cabinet, in order to organize your work, you need separate folders within each drive and separate folders within those folders, and often you need folders within folders within folders. That's the tree you see in Windows when you're using its file manager. See Figure 2.15.

Directory or folder tree

Figure 2.15. Directory or folder tree

Naming Requirements

The lengths of file and folder names were limited in the distant past to no more than eight characters, with an extension of no more than three characters. This was known as the eight-dot-three (8.3) convention. Sometimes your computer treats folders and files with long names differently from those that follow the 8.3 standard. Depending on the operating system, if a name includes spaces, you may have to enclose the filename in quotes so it can be read as a single name. If a folder or file has a long name that must be shortened to an eight-character name, the first six letters followed by the tilde and a number can be used to represent the folder, as in PROGRA˜1 for Program Files. See Table 2.2 for examples of how folders that start with the same six letters would be named.

Table 2.2. Comparing long folder names to their 8.3 names

LONG FOLDER NAMES

8.3 FOLDER NAMES

MyPhotos Cats

MyPhot~1

MyPhotos Dogs

MyPhot~2

MyPhotos Kids

MyPhot~3

MyPhotos Mom

MyPhot~4

Sometimes AutoCAD uses the 8.3 naming convention for search paths, but not usually. Check out the Automatic Save File Location used by AutoCAD in the Files tab of the Options dialog box for an example (see Figure 2.16). You may run across this convention in other situations as well, so don't let it throw you. Just recognize that the actual folder names are longer.

8.3 naming convention

Figure 2.16. 8.3 naming convention

Why DOS Isn't Dead Yet

You may wonder why anyone would put a section on DOS in a book about AutoCAD. It's simple: Knowing DOS, or what is now often referred to as Windows Scripting Language, has saved me hundreds of hours of time over the years (and that's no exaggeration). Chapter 8 contains a description of a system I use for batch-processing drawings that has saved companies thousands of hours of work—and it depends on a single DOS function to work.

Let's start with one example of how useful DOS can be. How would you go about creating a file that lists all the files in one of your folders? That should be easy, shouldn't it? Let's make this problem more useful and more challenging. How would you create a file that contains the locations and names of every single drawing file on your entire hard drive? If you can figure out a way to do that in Windows, please let me know.

Here's how you can do it in DOS:

  1. In Windows, choose Start → Run.

  2. Type cmd in the Run window.

    Why DOS Isn't Dead Yet
  3. Click the OK button. A window with a black background opens; it's normally referred to as the DOS screen.

  4. Enter the following at the DOS prompt: dir c:*.dwg /s /b > c:dwglist.txt. You may have to wait several minutes while your computer searches for every DWG file, so be patient. It would take a lot longer to do it manually!

    Why DOS Isn't Dead Yet
  5. Open the file named dwglist.txt in Notepad. It's in the root of the C: drive.

    Why DOS Isn't Dead Yet

I just did this on my desktop computer. It took less than 30 seconds to go through the steps shown here. It took the computer only minutes to create the text file, which lists thousands of DWG files. Imagine how long it would have taken to create such a list without this little line of DOS code. Table 2.3 illustrates what each element does:

Note

Jon McFarland, the technical editor for this book, reports that he saves a ton of time by using the DOS Rename command to update the names of a large group of files. Type rename C:Sybex???DCD.dwg ???AVM.dwg

Why DOS Isn't Dead Yet

Table 2.3. Elements of the dir c:*.dwg /s /b >c:dwglist.txt

DOS ELEMENT

PURPOSE

DIR

Creates a list of files in a folder

C:*.dwg

Identifies the files to be listed as having any name and the file extension .dwg

/s

Indicates that the search should include all subdirectories in addition to the root of the C: drive

/b

Indicates that the listing should be bare, including only the filename and location, and not the file size, date, and attributes

>

Directs the output into a file

C:DWGLIST.TXT

Creates a file with this name, and places the output of the DIR command into it

DOS Batch Files

A DOS batch file is an ASCII text file containing a series of DOS-level (operating system—level) commands. Using a batch file allows you to control one or more computers without having to type a series of commands repeatedly.

An ASCII file is a plain text file containing only the 94 characters that can be typed directly from a keyboard with no formatting—no underlining, boldface, special fonts, and so on. Much of this book deals with ASCII files, and they must remain in that format. To ensure that happens, use Notepad, the AutoCAD VLISP editor, or a third-party plain text editor to modify or create them. Do not use a word processor for any file identified as an ASCII or text file, so you don't corrupt the file unintentionally.

Note

ASCII stands for American Standard Code for Information Interchange, by the way. It's the means by which different computer systems can communicate. If they ever ask you that question on Jeopardy, send me a thank-you note.

I've always used batch files to manage the network and labs at Southern Maine Community College, where I teach. I have a batch file that cleans out directories, deletes them, re-creates them, assigns new users, and gives those users rights to their directories. I could do this using the Windows dialog boxes, but I have more than 300 users who need more than 600 directories. I also need to assign rights to each directory to myself, the other instructors, and the individual students. That would take a lot of mouse clicks.

I also use a batch file to manage the computers in the labs. A logon batch file runs every time a student logs on to the network. Old drawing files can be removed from each computer, new AutoCAD support files can be copied to each computer, custom files can be copied to each computer, new plotter configurations can be copied to each computer, network paths can be mapped, and so on.

Without batch files, I would spend days doing these things manually. Once I write a batch file, I start it running, and it does everything without making a single error. That way, I can spend my time doing more interesting work.

DOS Commands

DOS commands, also known as operating system (OS) commands, are issued at an OS command line. You can get to that command line two ways in Windows:

  • Type SHELL

    DOS Commands
  • Select Start → Run, and type CMD

    DOS Commands

Note

For those of you with a longer computer history, this is the Windows 2000 OS command interpreter. You can also get the old DOS 6 interpreter by typing COMMAND in the window; but if you do, you have to use the 8.3 filename convention, including progra˜1 for program files, and you lose some new functions.

To get a list of all DOS commands, use the Windows Help system and type DOS in the Index window. You can also type the word Help at the DOS command line to get a partial list.

Note

Many websites offer more information about using DOS. Search on DOS in your favorite search engine, and sit back. When I did a search at www.ask.com, it returned 19,490,000 hits.

Sample Batch Files

To write a batch file, start Notepad or another text editor, and type separate lines of DOS commands. When you're done, save the file with any name and the extension .bat, as in BACKUP.BAT.

Note

A batch file is a program file. If you double-click it or open it in a file list, the program is executed. To change the contents of a batch file, right-click it and select Edit from the cursor menu.

In each of the following tables, the actual DOS code that would appear in a batch file is shown on the left, and the explanation for each line appears on the right.

Creating Folders

Table 2.4 contains several lines from a much longer FOLDERS.BAT batch file that I use to create directories for multiple users. You don't need to see all the lines, because they're similar. The batch file contains only the lines in the column labeled DOS Code. The Purpose column explains what each line does.

Logon Batch Files

You can use batch files as logon scripts on a Windows network so that when someone logs on, the batch file runs automatically. Table 2.5 contains several lines from a LOGAED.BAT batch file used to manage the logon process. In this case, a drive letter is mapped to a folder named for an individual user, and another is mapped to a shared resource folder available to all users.

Table 2.4. FOLDERS.BAT

DOS CODE

PURPOSE

S:

Makes the S: drive current

CD

Changes to the root of the current drive

CD acad1

Changes to the directory name acad1

MD grade

Makes a new subdirectory named grade in the directory named acad1

MD templates

Makes a new subdirectory named templates in the directory named acad1

MD custom

Makes a new subdirectory named custom in the directory named acad1

Table 2.5. LOGAED.BAT

DOS CODE

PURPOSE

rem -- ACADLOG.bat file

rem means remark; allows notes to be added to the batch file

net use S: \techusers\%username%

Maps the drive letter S: to a folder with the same name as the user's logon name, which is located in a folder named users on the network server named tech

del c:*.bak

Deletes all BAK files in the root of C:

del s:\%username%*.bak

Deletes BAK files from the user's directory

del s:\%username%*.ac$

Deletes AC$ files from the user's directory

cd

Changes to the root of the current drive

net use R: \tech esources$

Maps the drive letter R: to a hidden, shared folder named resources on the network server named tech

Note

The NET USE command is a network OS command and won't be listed in the DOS help system. To see a list of other network commands, type net help

LOGAED.BAT

Backing Up Files

I use batch files to manage my own backup process, independent of the process available on my school's network—in fact, my backup process is redundant. It's not that I'm compulsive; I just don't like the idea of losing work. I use a similar system on my personal computer. The batch file shown in Table 2.6 copies all DWG files from the H: drive (a network drive on different server) to the network directory mapped as S: if they are newer than those that are already there. It then copies all DWG files on the S: drive to the H: drive, but again, only if they're newer than the versions that are already there. This type of batch file can be used as a way to make sure you have the latest versions of all DWG files on both network drives. It uses two switches:

  • The /d switch is the date switch, limiting XCOPY to those files that are newer than those with the same name on the destination drive.

  • The /s switch includes all the directories on both drives that contain any DWG files. Otherwise, only DWG files in the root of each drive would be copied.

Table 2.6. H2S2H.BAT

DOS CODE

PURPOSE

xcopy H:*.DWG S:*.DWG /d /s

xcopy (extended copy) copies all files on the H: drive with a .dwg extension to the S: drive. Files of the same name are copied only if they're newer than the versions in the destination drive.

xcopy S:*.DWG H:*.DWG /d /s

xcopy copies all files on the S: drive with a .dwg extension to the H: drive. Files of the same name are copied only if they're newer than the versions in the destination drive.

The batch file shown in Table 2.7 has a slight twist: It backs up to a removable DVD that doesn't have enough capacity to store all the files I want backed up from my hard drive. BACKUP.BAT lets me keep ongoing backups of new files. The D: drive is my DVD burner. The date switch here is used to copy only files created after a specific date—in this case, December 1, 2007. After the computer is done copying, the batch file opens in Notepad, and I change the date. When the DVD gets full, I start a new backup disk.

The second line of the batch file in Table 2.7 is interesting. It actually opens the batch file so I can change the date each time it runs. Once I save the new version of the batch file with the new date, the DOS window closes.

Table 2.7. BACKUP.BAT

DOS CODE

PURPOSE

XCOPY C:dan*.* /s /d:12/1/07 D:

Copies all files created after 12/1/2006 from the folder named dan on the C: drive to the D: drive

start /wait notepad.exe c:atackup.bat

Starts the Windows application NOTEPAD.EXE, opens the file named BACKUP.BAT located in the folder named bat on the C: drive, and waits for the file to be closed before returning to the OS command line

Running Batch Files Automatically

You can run a batch file manually by right-clicking the filename and clicking Open. You can run one automatically by making it the logon script for a network. But you can also run a batch file automatically by identifying it as a scheduled event in Windows. That's what I do for the backup batch file shown in Table 2.7. To make a batch file a scheduled event, follow these steps:

  1. Create the batch file, and save it. (I have a folder named bat in which I keep all my batch files. That way, I'm a little less likely to double-click one by accident.)

  2. Double-click the Scheduled Tasks icon in Windows Control Panel.

  3. Double-click the Add Scheduled Task option to start the Scheduled Task Wizard, and then click the Next button.

  4. Click the Browse button, and add your batch file.

    Running Batch Files Automatically
  5. Set the frequency with which you want the task to run. I have mine run every day. You'll also get a chance to enter a password. (That's the password you log on with, if you use one.) Now the task will run even if you're logged on under another user name that has fewer rights to run programs.

    Running Batch Files Automatically

External Commands and Command Aliases

AutoCAD uses the ACAD.PGP file to define two kinds of commands: external commands (DOS commands to be issued at the AutoCAD command prompt) and command aliases (shorthand commands used to issue standard AutoCAD commands).

Note

Some people have discovered that they can type START at the AutoCAD command prompt followed by a filename like ACAD.PGP and have the file open. Don't do it. The START command is an operating system command, and it uses the Windows search path, not the AutoCAD search path, to find the referenced file. If you have multiple versions of the file, you may open the wrong one. Use the AutoLISP findfile function, instead, as shown in Figure 2.18.

You have to go deep into the Documents and Settings folder, or use the Windows Search function, to find this file. The default location for the ACAD.PGP file for each user login name is shown in Figure 2.17. Your own login name will appear instead of Dan. Abbott, which is the logon name I used for this example.

Even knowing this, however, you're unlikely to find this file because you must navigate through another hidden folder, Application Data, in order to locate it. For a shortcut, you can type at the AutoCAD command line to open the file without navigating the long folder tree, as illustrated in Figure 2.18. As of AutoCAD 2006, you can also open this file from AutoCAD using Tools → Customize → Edit Program Parameters (acad.pgp).

AutoCAD support path

Figure 2.17. AutoCAD support path

Opening a file in the search path

Figure 2.18. Opening a file in the search path

If you don't know how to make a hidden folder visible, see the earlier section "Autosave Files."

When you open the ACAD.PGP file, the header information looks like this:

;  Program Parameters File For AutoCAD 2007
;  External Command and Command Alias Definitions
;  Copyright (C) 1997-2006 by Autodesk, Inc. All Rights Reserved.
;  Each time you open a new or existing drawing, AutoCAD searches
;  the support path and reads the first acad.pgp file that it finds.
...
;  The bits of the bit flag have the following meanings:
;  Bit 1: if set, don't wait for the application to finish
;  Bit 2: if set, run the application minimized
;  Bit 4: if set, run the application "hidden"
;  Bit 8: if set, put the argument string in quotes

The semicolons represent remarks. The section that follows the ellipses describes the bit-flag settings that can be used for external commands. Although it's not shown in the file, I've occasionally had to use a value of 0 as a bit flag, which forces the OS to wait for an application to finish before returning to AutoCAD.

Note

You can add bit-flag values together to force more than one condition. A bit flag of 12 (4 + 8) runs the application hidden and requires that the argument used be placed in quotes. Using a numbering system where each value doubles to form the next value should be familiar to you: 1, 2, 4, 8, 16, 32, 64, 128, 256, and so on. It's used because the sum of any group of values is always unique and allows multiple conditions to be represented by one number. The variable that controls object snaps works this way. Each of the object snaps is assigned one of the bitcode values: 1 for END; 2 for MID, 4 for CEN, 8 for QUA, and so on. If you turn on all four of them, the OSMODE variable is set to 15. If you turn on END and CEN only, OSMODE is set to 5.

External commands are defined using five fields. The fields are shown in the lines in the next text box, which define external DOS commands supplied by Autodesk in the default ACAD.PGP file. If you type any of the commands listed in the first column at the AutoCAD command prompt, the associated DOS function is executed:

CATALOG,   DIR /W,         8,File specification: ,
DEL,       DEL,            8,File to delete: ,
DIR,       DIR,            8,File specification: ,
EDIT,      START EDIT,     9,File to edit: ,
SH,        ,               1,*OS Command: ,
SHELL,     ,               0,*OS Command: ,
START,     START,          1,*Application to start: ,
TYPE,      TYPE,           8,File to list: ,

The next group of lines from the default ACAD.PGP file defines external commands that use the START function to run any Windows program. You must know the name of the executable file to call it from AutoCAD. For example, the application file that starts Microsoft Word is named WINWORD.EXE. (See the next section for an example of how to use this filename to start Word from the AutoCAD command line.) The reference to (STARTAPP) indicates an AutoLISP function that can also be used to start a Windows program. That's one of the functions used in Figure 2.18 to open the ACAD.PGP file directly from AutoCAD:

; Examples of external commands for Windows
; See also the (STARTAPP) AutoLISP function for an alternative method.
EXPLORER,  START EXPLORER, 1,,
NOTEPAD,   START NOTEPAD,  1,*File to edit: ,
PBRUSH,    START PBRUSH,   1,,

This last group of lines from the ACAD.PGP file defines command aliases:

; Command alias format:
;   <Alias>,*<Full command name>
3A,        *3DARRAY
3DMIRROR,  *MIRROR3D
3DNavigate,*3DWALK
3DO,       *3DORBIT
3DW,       *3DWALK
3F,        *3DFACE
3M,        *3DMOVE

External Commands

To add your own external commands, follow the same format used for the default ACAD.PGP commands. Here is an example from my ACAD.PGP file:

WORD,       start winword,                            1,    ,
EXCEL,      start excel,                              1,    ,
ACCESS,     start msaccess,                           1,    ,
CALC,       start calc,                               1,    ,
AU,         start iexplore www.autodesk.com/au        1,    ,
WORK,       start explorer c:danda-work,            1,    ,
LISP,       notepad c:daautocadcustomacad.lsp,    1,    ,

Each of these lines has five fields separated by commas:

  • Field 1—The name of a new AutoCAD command you're creating

  • Field 2—The external command you want to run when the new command name is typed at the keyboard

  • Field 3—A bit-flagged number that is explained at the top of the file, but which for our purposes can be 1

  • Field 4—A prompt if it's needed, or a blank if a prompt isn't needed

  • Field 5—A legacy blank space

Long Path Statements

There's a limit on how many characters AutoCAD can read from a single line in the acad.pgp file, and blank spaces in folder names and filenames can cause problems. You may also run into this problem in other situations.

To avoid surprises when referring to a long path, use the 8.3 naming convention if you want to write a new AutoCAD command. For example, the acad.lin file, which is located in the Documents and Settings folder, could be opened with the new command LIN if it were defined as follows. Note that the line is broken here because it is too long to fit on the page of this book, but it must be entered as a single line in the actual acad.pgp file:

lin,notepad c:docume~1danapplic~1autodesk
autoca~3
16.2enusupportacad.lin,1,,

Note

Here is a situation where an existing long folder name or filename must be represented using the 8.3 convention. In this example, autoca˜3 is the third folder, alphanumerically, in that location beginning with the characters autoca. The other two are earlier versions of AutoCAD that are installed on my computer.

Aliases

To create new command aliases, add lines in the following format or use the Express Tool ALIASEDIT (Express → Tools → Command Alias Editor...). The following are three commands from my ACAD.PGP file:

RI,   *REINIT
CY,   *CYLINDER
K,    *CAL

Each of these lines has two fields:

  • Field 1—The name of the alias you're creating.

  • Field 2—The name of the AutoCAD command, preceded by an asterisk, which lets AutoCAD know that this is a native AutoCAD command and not an external command. Because it's not external, the remaining fields aren't used. If a command can be issued transparently, like CAL, then the alias can be, too.

You can create as many aliases for existing commands as you want. You can even create an alias using a version of a command you often mistype. I once resorted to creating the alias CHAGNE for the CHANGE command.

Place your additions at the bottom of the file using lowercase letters so you can find them easily. If the same alias is used more than once, the one closest to the bottom of the file is the last one loaded. As of AutoCAD 2006, there's an area at the bottom of the file for user-defined aliases. If you place your definitions there, migrating them to future releases will be easier—at least, that's what it says at the end of the acad.pgp file.

The ACAD.PGP file is loaded when you start AutoCAD; if you change it, you have to save the result and use the REINIT command to reload it into AutoCAD. This is the only file that can be reinitialized this way. Figure 2.19 shows the Re-initialization dialog box as an example.

Re-initialization dialog box

Figure 2.19. Re-initialization dialog box

Note

If you want to reload the ACAD.PGP file from a Lisp program, reset the variable RE-INIT to 16 using the following AutoLISP code, including parentheses: (setvar "re-init" 16).

To load this file, it must be in the search path, so don't move it without adding its location to the default path used by AutoCAD. Read this entire file for a review of most of the AutoCAD commands. There's no reason not to use the entire alphabet for single-letter aliases. And some commands don't yet have an alias.

Note

The ALIASEDIT Express Tool automates this process, but I think it's good practice to edit the file directly. Doing so helps you understand the role of text files in customizing AutoCAD.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.198.170