Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 132 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
132
Dung lượng
1,32 MB
Nội dung
1014 Part VI ✦ Customizing AutoCAD name of the file to edit, and Windows opens it in Notepad. (You need to type in the complete path of the file.) To open Notepad without a file, press Enter at the *File to edit: prompt. Creating keyboard shortcuts to commands Most of the acad.pgp file contains aliases, or keyboard shortcuts, for common AutoCAD commands. You can change these or add your own. After you get used to them, it’s often faster to type shortcuts at the command line than to click the tool- bar button or menu item, especially if your hands are already on the keyboard. You cannot include a command option in the acad.pgp file. To do that, you need to create a menu item, toolbar button, or AutoLISP routine. The Express Tools contain an Alias Editor that enables you to edit the acad.pgp file through a dialog box interface. Choose Express ➪ Tools➪Command Alias Editor. The format for creating an alias is as follows: Shortcut,*Full command name Refer back to Figure 29-1 for some examples of shortcuts. Note that the space between the columns is not necessary — it simply improves readability. You can use aliases transparently if the command itself can be used transparently. Aliases cannot be used in script files or menus. Note that you cannot use control or function keys in command aliases in the .pgp file. You can print out acad.pgp and tape it up on the wall where you work. If you are working on someone else’s computer, do not do the following Step-by- Step exercise without that person’s permission. It is not good computer etiquette to modify other people’s AutoCAD files without asking first. Step-by-Step: Customizing the acad.pgp File 1. Start AutoCAD. 2. Place a blank disk in your floppy disk drive. Type explorer ↵. After opening a preliminary window, AutoCAD opens Windows Explorer using the acad.pgp shortcut. Caution Tip New Feature 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1014 1015 Chapter 29 ✦ Customizing Commands, Toolbars, and Tool Palettes By default, acad.pgp is in \Documents and Settings\[user name]\ Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Support. However, your location may be different, depending on your operating system and customiza- tion. To find the location of acad.pgp, choose Tools➪ Options and click the Files tab. Double-click the first item, Support File Search Path, to display the location of the support files. 3. Find acad.pgp, click it, and drag it to the drive (in the Folders window) that contains your floppy disk. Windows copies acad.pgp to the disk. If you haven’t already backed up your other customizable files, copy acad.lin, acad.lsp, acad.mln, acad.mnl, acad.mnu, and acad.pat to the disk as well. (If they don’t fit, you may need to use two disks or a CD-ROM.) Remove the disk and label it “AutoCAD customizable files — original form.” 4. While Explorer is open, double-click acad.pgp. Windows opens the file in Notepad. (If Windows opens the Open With dialog box, choose Notepad from the list. Check the Always Use This Program To Open This File option and click OK. From then on, Windows will automatically open your acad.pgp file with Notepad. (Another method is to right-click and then choose Open With to choose the application you want to use.) 5. Scroll down roughly two screens until you see the three Windows commands, as shown in Figure 29-2. Place the cursor at the end of the PBRUSH line and press Enter. Figure 29-2: The Windows commands in the acad.pgp file 6. Type the following and press Enter (the uppercasing and spaces are used to match the format of the rest of the file): WORDPAD, START WORDPAD, 1,, 7. Look at the next section of acad.pgp. Read AutoCAD’s guidelines for creating new aliases. 8. Scroll down until you see the following two lines: CH, *PROPERTIES -CH, *CHANGE The alias for the CHANGE command follows the guideline of using a hyphen to distinguish command-line versions of commands. Suppose you have trouble finding that hyphen quickly (you end up typing =ch instead). You want to change the alias to cg (with no hyphen). Note 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1015 1016 Part VI ✦ Customizing AutoCAD 9. To be extra careful, add a new alias rather than changing the current alias (which someone may be in the habit of using). Place the cursor after the word *CHANGE and press Enter. Type the following and press Enter (don’t worry about the spaces — I’ve matched the spacing of the acad.pgp file): CG, *CHANGE 10. Choose File ➪ Save. This section of acad.pgp that you worked on should look like Figure 29-3. Figure 29-3: A section of the edited acad.pgp file 11. Close Notepad. Generally, AutoCAD only reads acad.pgp when loading a new or existing drawing. However, you can use the REINIT command to reload the file at any time. Type reinit ↵. AutoCAD opens the Re-initialization dialog box, as shown in Figure 29-4. Figure 29-4: The Re-initialization dialog box 12. Check PGP File and click OK. In your drawing, draw any line. 13. Type cg ↵. AutoCAD starts the CHANGE command. Select the line, right-click to end selection, and pick a new endpoint location. AutoCAD changes the endpoint of the line. 14. Do not save your drawing. The edited acad.pgp file is on the CD-ROM in the Results folder. Although you made only two changes, if you want, you can copy the acad.pgp file from the CD-ROM over your original acad.pgp file. Of course, you can make additional changes to suit your needs. On the CD-ROM 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1016 1017 Chapter 29 ✦ Customizing Commands, Toolbars, and Tool Palettes Customizing Toolbars In the Windows environment, you frequently find yourself using toolbar buttons for many of your tasks. Nevertheless, how many times have you found yourself typing a command because you couldn’t quickly find an equivalent button on a toolbar, or because it was on a flyout that was too annoying to deal with? In addition, think how often you start a command with a toolbar button, only to return to the keyboard to type in a simple option. You can customize AutoCAD’s toolbars to make your work easier and faster. You can create new toolbars from scratch, or edit existing ones. You can even create your own toolbar buttons. When you create a toolbar button, you can attach any sequence of commands to it — a complex macro or even an AutoLISP expression. Using the Customize dialog box The Toolbars tab of the Customize dialog box (choose View➪ Toolbars), shown in Figure 29-5, combines all the tools you need to manage toolbars. Figure 29-5: The Toolbars tab of the Customize dialog box To display a toolbar, you don’t need to use the Toolbars dialog box. You can right- click any toolbar and choose from the list on the shortcut menu. However, you can also display toolbars from the Toolbars tab of the Customize dialog box by check- ing the toolbar you want to see. Both lists include flyouts. It is therefore very easy to turn a flyout into a toolbar if you want — click the flyout—for example, Zoom — and it appears as a regular toolbar. 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1017 1018 Part VI ✦ Customizing AutoCAD You also use the Toolbars tab of the Customize dialog box to create new toolbars, delete toolbars, and customize existing toolbars. If you create your own menus, they can have toolbars as well. You can then choose toolbars from your menus using the Menu Group drop-down list. Creating a new toolbar To create a new toolbar, choose New in the Toolbars dialog box. In the New Toolbar dialog box, shown in Figure 29-6, name your toolbar (and the Menu Group if you have created one) and then click OK. Your toolbar now appears in the Toolbars list of the Toolbars dialog box, and a small, new toolbar appears on the screen, as shown in Figure 29-7. You use menu groups when you start to create your own menus. For more on Menu Groups, see Chapter 33, which covers customizing menus. Figure 29-6: The New Toolbar dialog box Figure 29-7: The new toolbar shown in the Toolbar list and on the screen Cross- Reference 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1018 1019 Chapter 29 ✦ Customizing Commands, Toolbars, and Tool Palettes The new toolbar is just a baby, but as you add buttons to it, it grows automatically. An important part of managing toolbars is finding a place to dock them so that they don’t take up valuable real estate on the screen. You can make several small toolbars and fit them in the blank spaces next to existing toolbars. The AutoCAD 2004 Standard toolbar is shorter than the previous one and gives you more room for your own toolbars. Removing buttons You can customize any toolbar by removing buttons that you rarely use. To remove buttons from a toolbar, follow these steps: 1. Display the toolbar. 2. Choose View ➪ Toolbars to display the Customize dialog box. If necessary, move it out of the way so you can access the toolbar that needs a button removed. 3. Drag the unwanted button off the toolbar and onto the screen area and release the mouse button. It’s easy to forget that you need to have the Customize dialog box open to remove buttons because there’s no direct connection between dragging buttons off the toolbar and the dialog box —but you can’t drag buttons off a toolbar unless the dialog box is open. Inadvertently dragging a button off the Customize Toolbars dia- log box is also easy —if you do, you create a new toolbar. Adding buttons If you have created a new toolbar, you need to add buttons to it. You have several ways to do this: ✦ Add a button from the Commands tab of the Customize dialog box. Display the Commands tab of the Customize dialog box and choose a category. AutoCAD provides a number of preset buttons in each category (including many of the flyout buttons from Release 13). You can also choose All Commands in the Category pane and then choose any command from the alphabetical Commands list. Click a button to see its description at the bottom of the dialog box. When you have found the button you want, drag it to your new toolbar. ✦ Move a button from another toolbar. With the Customize Toolbars dialog box open, drag a button from one open toolbar to your new toolbar. This moves the button, deleting it from the original toolbar. ✦ Copy a button from another toolbar. If you want to leave the original toolbar intact, use the same technique as for moving a button, but hold down the Ctrl key as you drag a button from one open toolbar to your new toolbar. This pro- cedure copies the button. Note Tip 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1019 1020 Part VI ✦ Customizing AutoCAD Creating your own button definition You can also create your own button definition from scratch. Follow these steps: 1. With the Commands tab of the Customize dialog box displayed, choose User Defined from the Categories list. The Commands pane lists a User Defined Button and User Defined Flyout. 2. Drag the button you want onto your toolbar. Because the buttons have no borders, they are indistinguishable from the background until you click them. 3. Click the Properties tab of the Customize dialog box and then click the blank button to display the Button Properties tab of the Customize dialog box, as shown in Figure 29-8. Figure 29-8: The Button Properties tab of the Customize dialog box 4. Type a name for the button. This name appears as a tooltip, so don’t make it too long. 5. Type a help description in the Help text box. This text appears on the status line to further explain the function of the button. 6. Write the macro. AutoCAD places ^C^C there for you. This cancels any other command that may be active when you use the button. You can place any valid menu command string as it would be typed on the command line or even an AutoLISP expression. You should use menu syntax for the macro. I explain the details of creating command strings in Chapter 33, where I cover customizing menus. Cross- Reference 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1020 1021 Chapter 29 ✦ Customizing Commands, Toolbars, and Tool Palettes 7. Choose a button icon from the list of button icons or choose Edit to create your own button, as explained in the next section. 8. Click Apply and click the Close button of the Customize dialog box to close it. Close any other open dialog boxes. AutoCAD updates the menus, showing its progress on the status bar. Using the Button Editor The Button Editor, shown in Figure 29-9, enables you to make your own button icons. Open the Button Editor by clicking Edit on the Button Properties tab of the Customize dialog box. You can choose one of the provided buttons and edit it — which I recommend—or start from scratch if you have artistic tendencies. Figure 29-9: The Button Editor The center of the editing area shows an enlarged view of the button. You see the button’s actual size at the top-left corner of the dialog box. Check Grid to show a grid of pixels — this is just for your reference. Choose a color from the color palette and then choose one of the four tools at the top of the dialog box: ✦ The Pencil tool draws any shape. To draw, drag it across the editing area. ✦ Click and drag the Line tool to draw a straight line. ✦ The Circle tool draws circles and ellipses. You click the center and drag out to the circumference to indicate the radius. ✦ The Erase tool erases. You can click to erase pixel by pixel or drag to erase a series of pixels. 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1021 1022 Part VI ✦ Customizing AutoCAD Here are the other features of the Button Editor: ✦ Choose Clear to clear the editing area and start from scratch. ✦ Choose Open to open an existing button for editing. Button icons are stored as .bmp files. ✦ Choose Undo to undo your most recent action. ✦ Choose Save to save the button icon as a .bmp file. The default file name is ICON.bmp. ✦ Choose Save As to save an existing .bmp file under a new name. ✦ Choose Close to close the Button Editor. ✦ Choose More to select a standard index color or true color. With the introduction of true color support in AutoCAD 2004, you can now create your toolbar icons with a wider variety of colors. Choose More in the Button Editor dialog box (shown in Figure 29-9) to access this colorful new feature. Creating flyouts You can also create your own flyouts, or you can use one of the existing flyouts. To use an existing flyout, open the Commands tab of the Customize dialog box and choose Flyouts. You can simply drag one of these to a toolbar. To create your own flyout, follow these steps: 1. Create a toolbar with the buttons that you want on the flyout, as explained in the previous section. 2. Open the Customize dialog box and display the Commands tab. 3. Choose User Defined from the Categories list and drag User Defined Flyout from the Commands list onto an existing toolbar. You see a blank flyout on the toolbar. 4. Click the Properties tab of the Customize dialog box and then click the blank flyout button to display the Flyout Properties tab, shown in Figure 29-10. 4. You see a message telling you to associate a toolbar with the flyout. 5. From the list of toolbars, choose the new toolbar that you created. This tool- bar will be the flyout from the flyout button you just added. 6. Click Apply and then click Close. 7. Your new toolbar is now a flyout on a toolbar. You can close the new toolbar you created because you can access it from its parent toolbar. New Feature 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1022 1023 Chapter 29 ✦ Customizing Commands, Toolbars, and Tool Palettes Figure 29-10: The Flyout Properties tab of the Customize dialog box The following exercise changes your menu files. After the exercise, I explain how to undo the changes if you want. If you are working on someone else’s computer, do not do this exercise without that person’s permission. As I mentioned before, it is not good computer etiquette to modify other people’s AutoCAD files without asking first. Step-by-Step: Customizing Toolbars 1. Open Windows Explorer and copy acad.mnu, acad.mnc, and acad.mns from the AutoCAD 2004\Support folder to a floppy disk. Label and date the disk. By default, acad.mnu, acad.mnc, and acad.mns are in \Documents and Settings\[user name]\Application Data\Autodesk\AutoCAD 2004\ R16.0\enu\Support. However, your location may be different, depending on your operating system and customization. To find the location of acad.mnu, acad.mnc, and acad.mns, choose Tools ➪ Options and click the Files tab. Double-click the first item, Support File Search Path, to display the location of the support files. 2. Start a new drawing using any template. Save the file as ab29-01.dwg in your AutoCAD Bible folder. 3. Choose View ➪ Toolbars to open the Customize dialog box. From the Toolbars list, scroll down to find the Zoom toolbar and check it. When it appears, drag it away from the Toolbars dialog box, if necessary. 4. Drag the Zoom Center and Zoom All buttons off the toolbar (or choose the two buttons that you use least and drag them off), confirming the deletion each time. A small space appears between the last (Zoom Extents) button and the rest of the buttons. Drag the Zoom Extents button to the left slightly to eliminate the space. Note 36 539922 Ch29.qxd 5/2/03 9:42 AM Page 1023 [...]... delay 3000 37 5 399 22 Ch30.qxd 5/2/03 9: 43 AM Page 10 39 Chapter 30 ✦ Creating Macros and Slide Shows with Script Files vslide vslide *ab30-02c delay 3000 vslide delay 3000 rscript 2 Remember to press Enter at the end of the last line Save the file as ab30-02.scr in your AutoCAD Bible folder Close Notepad 3 So that AutoCAD can find the slide files, place your AutoCAD Bible folder in AutoCAD s support... 37 5 399 22 Ch30.qxd 1032 5/2/03 9: 43 AM Page 1032 Part VI ✦ Customizing AutoCAD Figure 30-2: The Select Script File dialog box 2 Choose the script file you want 3 Click Open AutoCAD runs the script file Running a script when loading AutoCAD Run a script when loading AutoCAD by changing the target expression that Windows uses to open AutoCAD The easiest way to do this is to use the shortcut to AutoCAD. .. ab30-b.dwg, is in the Drawings folder of the AutoCAD 2004 Bible CD-ROM Step-by-Step: Creating and Viewing Slides 1 Open ab30-b.dwg from the CD-ROM 2 Save the file as ab30-02.dwg in your AutoCAD Bible folder 3 Type hide ↵ AutoCAD hides the drawing 4 Type mslide ↵ In the Create Slide File dialog box, click the Save in drop-down box and select your AutoCAD Bible folder, if it isn’t already selected In... script file to preload the second slide (the second line of the script file): vslide *3dmodel(ab30-02b) 10 39 37 5 399 22 Ch30.qxd 1040 5/2/03 9: 43 AM Page 1040 Part VI ✦ Customizing AutoCAD To create a slide library, you need to use the DOS prompt AutoCAD provides the SLIDELIB utility in its AutoCAD 2004 folder to create slide libraries To get to the DOS prompt, choose Start ➪ Programs ➪ Accessories ➪ Command... the target there Right-click the AutoCAD shortcut and choose Properties Click the Shortcut tab, shown in Figure 30-3 Figure 30-3: The Shortcut tab of the AutoCAD 2004 Properties dialog box 37 5 399 22 Ch30.qxd 5/2/03 9: 43 AM Page 1033 Chapter 30 ✦ Creating Macros and Slide Shows with Script Files The Target text box displays the command expression that Windows uses to open AutoCAD Don’t make any change... to include the spaces as well: pedit \w 1 ; 12 Choose the Polyline Edit button from the Button Icon list, as shown in Figure 29- 11 Choose Edit to open the Button Editor Figure 29- 11: The completed Button Properties dialog box 36 5 399 22 Ch 29. qxd 5/2/03 9: 42 AM Page 1025 Chapter 29 ✦ Customizing Commands, Toolbars, and Tool Palettes 13 You want to change the button so that it looks as if a zero-width polyline... ab31-01.dwg in your AutoCAD Bible folder 3 Type notepad and press Enter at the File to edit: prompt to open a new file in Notepad 38 5 399 22 Ch31.qxd 5/2/03 9: 43 AM Page 1043 Chapter 31 ✦ Creating Your Own Linetypes and Hatch Patterns 4 Type the following: *3dotsandadash, temporary fencing A,.5,–.25,0,–.1,0,–.1,0,–.25 5 Press Enter after the last line Save the file as ab31-01.lin in your AutoCAD Bible folder... file Click Save Figure 29- 13: The Tool Palettes tab of the Customize dialog box Summary In this chapter, I covered the basics of customizing AutoCAD You started to customize AutoCAD by: ✦ Creating command shortcuts (aliases) in the acad.pgp file ✦ Creating your own toolbars that can contain any command sequence you need ✦ Working with tool palettes, a new feature of AutoCAD 2004, including changing... search path To do this, click Tools ➪ Options ➪ Files tab Click Support File Search Path and click Add Click Browse and find your AutoCAD Bible folder Click OK twice 4 In any AutoCAD drawing, choose Tools ➪ Run Script Locate ab30-02.scr in your AutoCAD Bible folder and click Open AutoCAD runs the slide show Notice that the last slide still takes a while to display 5 Let the slide show run through twice... drive:\path\drawingname.dwg /b script_file For example, if your current target reads C:\Program Files \AutoCAD 2004\ acad.exe and you want to open a drawing named ba-3 49. dwg in c:\drawings and run a script file named pre-plot.scr, your target should read: “C:\Program Files \AutoCAD 2004\ acad.exe” c:\drawings\ba-3 49. dwg /b pre-plot You don’t need to add the scr extension after the script file name Long file names . shown in Figure 29- 11. Choose Edit to open the Button Editor. Figure 29- 11: The completed Button Properties dialog box 36 5 399 22 Ch 29. qxd 5/2/03 9: 42 AM Page 1024 1025 Chapter 29 ✦ Customizing. want to change the alias to cg (with no hyphen). Note 36 5 399 22 Ch 29. qxd 5/2/03 9: 42 AM Page 1015 1016 Part VI ✦ Customizing AutoCAD 9. To be extra careful, add a new alias rather than changing. toolbar shown in the Toolbar list and on the screen Cross- Reference 36 5 399 22 Ch 29. qxd 5/2/03 9: 42 AM Page 1018 10 19 Chapter 29 ✦ Customizing Commands, Toolbars, and Tool Palettes The new toolbar