Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Книги_AutoCad_2 / AutoCAD 2006 and AutoCAD LT 2006 Bible_2004г__.pdf
Скачиваний:
122
Добавлен:
09.04.2015
Размер:
17.83 Mб
Скачать

Chapter 32 Creating Shapes and Fonts 997

Creating Fonts

AutoCAD’s support for TrueType fonts makes so many fonts available that the need to create your own is certainly less than with earlier versions. However, you might want to add special symbols to some existing fonts, especially if you often use these symbols within text.

Font files use the same codes to define the characters as shape files. They have the following unique characteristics:

The shapenumber part of the definition must correspond to the ASCII code value for the character you’re defining. To find these codes, look at the sample fonts in the Help file (choose Help Help Contents Customization Guide Shapes and Shape Fonts Create Shape Definition Files Sample Files). Fonts generally use either hexadecimal or decimal format.

The shapename part of the definition is lowercase and is usually used to label the character. For example, it uses ucp for uppercase p and lcr for lowercase r. The sample files mentioned in the previous item use these codes.

The file must include a special shape number 0 that defines the entire font, using the following syntax:

*0,4,font-name above,below,modes,0

The above value specifies how far above the baseline that uppercase letters extend. The below value specifies how far below the baseline that lowercase letters, such as p or q, extend. Together, these two values define the size of the characters. AutoCAD uses these values to scale letters when you define a text height for the font. Modes should be 0 for a horizontal font and 2 for a font that supports both horizontal and vertical orientations. For example, a header for a font named arch with capital letters 21 units high and lowercase letters that extend 7 units below the line could be:

*0,4,arch

21,7,0,0

You must define the line feed (LF), which drops down one line without drawing so that lines of text can be placed beneath each other. The line feed is ASCII code 10.

You need to create a start point and endpoint with the pen up to create spacing between letters. See the previous exercise for an example.

As with all shapes, you probably want to use AutoCAD to draw all of the characters on a grid with a spacing of 1. Decide on the height of the letters and be consistent.

998 Part VI Customizing AutoCAD

Big Fonts and Unicode Fonts

The Japanese and Chinese written languages use fonts with thousands of characters because each character represents a word. AutoCAD uses big fonts to support these languages. It is beyond the scope of this book to go into detail about how to create these fonts, but a short explanation is useful.

Big font files use special codes to allow for the larger number of shapes. Big fonts allow up to 65,535 shape numbers. Unicode fonts support the ISO10646 standard, which uses 16-bit encoding to support many languages in one font file. If you open one of the .shp files, you’ll see characters for all of the letters that may have accents in French, Spanish, and so on. All of the fonts in AutoCAD are now compliant with this standard.

The advantage of Unicode fonts is that characters that you type appear the same in all systems and countries. This is important if you exchange drawings with clients or colleagues in other countries. Unicode fonts use a special header that includes two extra codes.

Unicode special characters can be inserted by typing \u+ and the hexadecimal Unicode value in the font file. (For this reason, Unicode font files use hexadecimal shape numbers.) For example, the hexadecimal code for the plus/minus sign is 00B1. If you type \u+00b1 and press Enter (using DTEXT in this example), you get the plus/minus sign. (It works with multiline text, too.)

If you don’t need the additional capabilities of big fonts or Unicode fonts, you can create fonts without them.

Summary

In this chapter, you read about how to create shapes. You discovered how to:

Use shape files when you need to insert a shape many times, while using as little storage space as possible

Create fonts using shape files with a few special codes that define both the font as a whole and each character

In the next chapter, I explain how to customize menus.

 

 

 

Customizing Menus

You probably use the AutoCAD and AutoCAD LT menus all the time. (If you don’t, you can skip this chapter.) Although the

menus are designed to be useful for most people, the whole point of customization is that everyone has different needs. For example, you can draw easier and faster by customizing the menus to suit your own individual requirements. Not only can you add commands to a menu, but you can also add menu items consisting of a series of commands that run just like a macro. If you’re using AutoCAD, you can even add AutoLISP routines to your menus. You can edit the default menu or create your own menu. You may want to create specialized menus that are used only for one drawing — for example, a menu to help clients view a drawing. Menu customization includes the drop-down menu, mouse or puck buttons, toolbars (covered in Chapter 29), shortcut menus, image-tile menus, keyboard shortcuts, and temporary override keys. The only limit is your imagination, and the time that you can devote to customization.

Working with the Customization File

The AutoCAD or AutoCAD LT menu is contained in a file that you don’t edit directly; instead, you use the Customize User Interface, or CUI, dialog box to modify the menu.

New

In AutoCAD 2006 and AutoCAD LT 2006, the entire menu file has

Feature

changed. In place of the MNU, MNS, and MNC files is one file in XML

 

 

format, acad.cui or aclt.cui. Instead of editing the file directly,

 

you use a dialog box.

Understanding the menu file

The main menu file is acad.cui in AutoCAD, and aclt.cui in AutoCAD LT. You can either customize this file, or load another CUI file. I discuss using this file to customize toolbars in Chapter 29. In this chapter, I cover customization of the menu, including the dropdown menu, shortcut (right-click) menus, mouse buttons, keyboard shortcuts (including temporary override keys), tablet menus, and image-tile menus.

Caution

Don’t even think about customizing the menu until you’ve backed

 

up at least acad.cui or aclt.cui. It is possible to corrupt the

 

menu file. If you get stuck, then you can find the original file in

 

C:\Program Files\AutoCAD 2006\UserDataCache\Support

 

(if you used the default installation location). For AutoCad LT, go to

33C H A P T E R

In This Chapter

Understanding and working with

the customization file

Loading full and partial customization files

Creating commands and macros for dropdown menus

Creating shortcut menus

Creating image-tile menus

Creating keyboard shortcuts

c:/Program Files/AutoCAD LT/2006/UserDataCache/Support

1000 Part VI Customizing AutoCAD

In additional to the main menu file, AutoCAD and AutoCAD LT use these other files:

custom.cui: This file is specifically meant to be used for customization. It is a partial customization file, which means that you use it to add on to the main customization file. For example, you can add a toolbar and a menu that you use with the regular menu.

acad.mnr or aclt.mnr: This file contains bitmap images used by the menu, such as toolbar icons and icons on menus.

acad.mnl: This file contains AutoLISP routines used by the menu. If you create a new menu file that contains AutoLISP routines, then AutoCAD creates this file automatically. (AutoCAD only.)

You can create your own full or partial menu files using any name that you want. You’ll have the best results if you place all of your menu files in the same folder as the main customization file.

Note

To find the location of acad.cui or aclt.cui, choose Tools Options and then click the

 

Files tab. Expand the Customization Files item, and then expand the Main Customization File

 

item. Browse to that location in Windows Explorer.

Loading and unloading customization files

There are two types of customization files: partial and main (full). A partial customization file usually has only one or two drop-down menus (or toolbars). You can then load this partial menu along with your regular menu. If your menu customization consists of simply adding a few menu items, then you may want to create a partial customization file and add it to your current menu.

On the other hand, you may also want to have complete alternate menus, in which case you can customize the main menu. Perhaps two different people work on one computer and have different menu needs. For example, you may find it useful to have one menu for architectural drawings, another for mechanical drawings, and a third for electrical schematics. Of course, you can customize your one main menu to better suit your needs.

Loading and unloading a main customization file

Using your own customization file is a good way to keep the original file safe, in case you want to go back to it. Generally, you start by making a copy of the default main customization file, acad.cui or aclt.cui.

You can copy the main customization file (or any file, for that matter) in Windows Explorer. Right-click the file and choose Copy. Then right-click in any blank space in the Explorer window and choose Paste. The new file appears at the bottom of the list of files. Click the file to select it, and then click it again to change its name. Enter the new name, and then press Enter.

You can use only one main customization file at a time. If you want to work with your own customization file, you first need to unload the current customization file. Use the new CUILOAD command on the command line both to unload and load a customization file. The Load/Unload Customizations dialog box opens, as shown in Figure 33-1. Choose the main customization file that you want to unload and click Unload. (Although there is also a new CUIUNLOAD command, it opens the same dialog box as the CUILOAD command.)

Chapter 33 Customizing Menus 1001

Figure 33-1: The Load/Unload Customizations dialog box.

To load a new main customization file, follow these steps:

1.In the Load/Unload Customizations dialog box, choose the current main customization file and click Unload.

2.Click the Browse button.

3.Navigate to and select the new main customization file. Click Open.

4.In the Load/Unload Customizations dialog box, click Load.

5.Click Close to close the dialog box.

6.Choose Tools Customize Interface (or type cui on the command line or in the dynamic input tooltip).

7.In the Customizations In pane, the top drop-down list should show All Customization Files or Main CUI File. The top item in the pane lists the current main customization file. It may still show the customization file that you unloaded; in that case, right-click it and choose Rename. Enter the name of the customization file that you loaded, and press Enter to match the customization group name to the file name.

When you start AutoCAD or AutoCAD LT, the last customization file that you used, which is stored in the Windows registry, is loaded. If you want to use a new menu while in AutoCAD or AutoCAD LT, you must unload the current customization file and load the new one.

Loading and unloading partial customization files

You can use the Custom partial customization file that comes with AutoCAD (or AutoCAD LT), or create your own partial customization files. To create a new partial customization file, follow these steps:

1.On the Transfer tab of the Customize User Interface dialog box, choose New from the Customizations In drop-down list.

2.From the drop-down list, choose Save As. Enter a name for the new file in the Save As dialog box. Make sure that you use a name that is different from all other CUI files.

1002 Part VI Customizing AutoCAD

3.To use the file, go to the Customize tab and choose Main CUI File from the drop-down list in the Customizations In pane. Then click the Load Partial Customization File button to the right of the drop-down list. In the Open dialog box, locate the partial CUI file and click Open.

4.Choose Main CUI File again from the drop-down list. You should now see the new file listed under the expanded Partial CUI Files item.

You can load more than one partial customization file along with the main customization file. For example, you might have one partial customization file for 2D work and another for 3D work; sometimes, you might want both of them.

You can load and unload partial customization files in two ways:

Use the CUILOAD command as explained in the previous section.

Use the CUI command to open the Customize User Interface dialog box. To load a file, click the Load Partial Customization File button in the Customizations In pane.

Select the file and click Open. In the Customize User Interface dialog box, click Apply.

After you have loaded a partial customization file, check to make sure that it has been loaded. In the Customize User Interface dialog box, choose Main CUI File from the top drop-down list. Expand the Partial CUI Files item in the Customizations in Main CUI pane, and make sure that your partial CUI file is listed.

To unload a partial customization file, use one of these methods:

Use the CUIUNLOAD command. Follow the instructions for unloading a main CUI file described in the previous section.

In the Customize User Interface dialog box, right-click the file and choose Unload CUI File.

Transferring customization between files

You can also move customization items between customization files, using the Transfer tab of the Customize User Interface dialog box. You can transfer items from a loaded file to any menu file, including MNU, MNS, and CUI files. You can also transfer items between partial customization files or between a main customization file and a partial one.

When you display the Transfer tab, the current customization file is listed in the left pane. To open another file, click the Open Customization File button in the right pane, choose the file that you want to use, and click Open.

In each pane, expand the element that you want to transfer. For example, if you want to transfer menus, expand the menu item on each side. You then see the actual menus in each file that is listed. To transfer an item, drag it from one pane to the other. Make sure that you are dragging to the same type of item, that is, menu to menu or toolbar to toolbar.

When you’re done, click OK to close the Customize User Interface dialog box.

Соседние файлы в папке Книги_AutoCad_2