Ambrosius Lee

AutoCAD Platform Customization


Скачать книгу

file's extension through the operating system.

      Units of Measurement and Format

      The drawings that you create in AutoCAD are based on one of two systems of measurement: Imperial or English, and metric. Imperial measurement is based on inches, and metric measurement is based on meters. The system of measurement that a drawing currently uses is stored in the measurement system variable; 0 (Imperial units) or 1 (metric units). Changing the value of the measurement system variable does not affect the objects that are already in a drawing. Resizing objects in a drawing to fit the new system of measurement can be done with the scale command.

      The measurement system does not affect the formatting of linear and angular units, but it does control the following:

      • The default drawing template used for the initial drawing that is created when AutoCAD first starts up: acad.dwt for Imperial measurement and acadiso.dwt for metric measurement

      • Which hatch pattern and linetype definition files AutoCAD looks for in its support-file search paths: acad.pat and acad.lin for Imperial measurement and acadiso.pat and acadiso.lin for metric measurement

      • The current measurement choice of the Scale List area in the Default Scale List dialog box of the Options dialog box (Windows) and Application Preferences dialog box (Mac OS)

The current measurement system does not affect the way linear and angular drawing units are accepted or displayed. Drawing-unit formatting is controlled by several settings, which you can change by using the Drawing Units dialog box (units command); see Figure 1.3.

Figure 1.3 Drawing Units dialog box. The Windows version of the dialog box appears on the top the Mac OS version appears on the bottom.

Each of the settings shown in the Drawing Units dialog box can also be accessed using system variables. Understanding the relationship between many of the AutoCAD dialog boxes and the system variables they represent will help you automate tasks related to drawing setup, configure drafting aids, and control the default behavior of commands. Table 1.1 explains the system variables that can be changed using the Drawing Units dialog box.

Table 1.1 System variables

      You can learn more about system variables, including how to change their values, later in this chapter in the section “Working with System Variables.” For now, just understand that system variables play an intricate part in being able to customize AutoCAD.

      Graphical and Named Objects

      As I previously mentioned, a drawing template (DWT) file is the same as a drawing (DWG) file; it can contain both graphical and nongraphical objects. The graphical and nongraphical objects in a DWT file should be limited in number and common to all the new drawings you create. If you have named objects that might be less frequently used, you could store them in a drawing file and then insert that drawing into your drawing to inherit the additional named objects. Or you may choose to automate the creation process of the named objects using one of the available customization methods mentioned later in this book. I cover the creation and management of named objects in Chapter 2, “Working with Named Objects.”

      Most DWT files have no objects in model space but do have objects placed on one or more of the named layouts in the file. Named layouts commonly have viewports as well as a number of objects or a single block that defines a title block used to frame your design when outputting. The title block could be an external reference (xref) or a block that has already been defined within the DWT file. I cover defining blocks in Chapter 3, “Building the Real World One Block at a Time.” General notes, callouts, symbols, and a revision table are other objects that you might place on a layout as well in your DWT file.

      The named objects that you should add to your DWT files are as follows:

      If you work on 3D models, you might also want to consider including UCSs, model-space viewports, saved views, materials, and visual styles. I cover the creation and management of named objects in Chapter 2.

      Organize Output with Layouts

      Each drawing template (DWT) file contains at least one named layout, and it is a good practice to make sure that the layout is ready to be plotted after a drawing is created using the drawing template. A drawing template can contain more than one layout, but each layout should add some value. If you need additional layouts in your drawing, you could use the layout command to duplicate a layout that already exists in the drawing or to import a layout from another drawing file.

      The layouts in a drawing template should contain the following:

      • Page-setup settings that define the output device, paper size, and other settings that impact the layout when it is plotted or published. I cover configuring plotter devices and plot styles in the section “Defining Plotter Configurations and Plot Styles” later in this chapter.

      • A title block that contains all the informational fields needed to identify the drawing once it is plotted or published. A title block might include your company name and address, project name and address, part number, scale, and other information that helps identify the drawing. I discuss creating blocks and attributes in Chapter 3.

      • One or more floating viewports that define which areas of model space should be plotted as part of the layout, along with the scale the objects in the viewports should be viewed at.

      You might also want to consider adding the following to a drawing for use with or on a layout:

      • General notes or disclaimers, and viewport labels that each or most of the drawings created with the drawing template might contain.

      • A border around the margins of the paper. The viewports, title block, and other objects on the layout should be inside the border.

      • A plot stamp that indicates when the drawing was plotted and the name of the source drawing file.

      • Dimension and text styles set up for adding dimensions and annotation to a layout. Remember that layouts are plotted at a 1:1 scale, so the styles need to be defined correctly.

      Working with System Variables

      System variables in many ways are like the keys hiding under the doormat at the front door of a house. They allow you to directly access many of the settings that can be used to manipulate the AutoCAD environment and control how commands work, instead of you resorting to a dialog box or using options with a command. The values of system variables are stored in one of two places: with the drawing or as part of the user's AutoCAD profile. The user's AutoCAD profile is stored in the Windows Registry, or in several Plist files on Mac OS.

      You use the setvar command to list and change the current value of a system variable. After you start the setvar command, you can enter the name of the system variable to work with or? (question mark) to return a list of all values or a filtered list using a wildcard match of the system variables that are supported.

      The following steps explain how to list and change the value of a system variable:

      1. At the command prompt, enter setvar and press Enter.

      2. At the Enter variable name or [?]: prompt, enter the name of the system variable whose value you want to view or change.

      For example, enter cursorsize and press Enter. The cursorsize system variable controls the size of the crosshairs in the drawing window.

      3. At the Enter new value for system_variable_name <current_value>: prompt, enter a new value for the system variable.

      The