Читать книгу AutoCAD Platform Customization - Ambrosius Lee - Страница 17
Part I
AutoCAD Customization: Increasing Productivity through Personalization
Chapter 1
Establishing the Foundation for Drawing Standards
Managing Standards with Drawing Templates
ОглавлениеWhen you create a new drawing, you have two choices: start from scratch or use a drawing template (DWT) file. Starting from scratch, or using the default drawing that is created when AutoCAD first starts up, is not ideal as it most likely does not conform to your company's standards and the settings can change from release to release. The same is true for the drawing template files that come with AutoCAD: you can use them, but they are not tailored to your company's standards. The default drawing templates make for an excellent starting point, but you should create your own drawing template files so that you know what's in them.
What Is a Drawing Template?
A drawing template is a file that contains the objects, styles, unit of measurement, and other settings that should be used when creating a new drawing with the new or qnew commands. It has a file extension of .dwt. Prior to drawing templates, they were called prototype drawings; you should know that just in case you hear that term come up in a conversation with an AutoCAD veteran.
When a new drawing is created using a DWT file, the DWT file is copied into memory as a new drawing and the DWT file remains unchanged. A DWT file is identical to a drawing (DWG TM) file. While you commonly use the saveas command to save a DWG file as a DWT file, you could also just change the file extension of a DWG file from .dwg to .dwt and achieve the same results.
The following steps explain how to save a DWG file as a DWT file using AutoCAD on Windows:
1. In the AutoCAD software, open the DWG file that you want to save as a DWT file and click the Application button ➢ Save As (or at the command prompt, you could enter saveas and press Enter).
2. In the Save Drawing As dialog box, click the Files Of Type drop-down list and choose AutoCAD Drawing Template (*.dwt).
The AutoCAD software changes the Save In location to the location specified by the Drawing Template File Location node on the Files tab of the Options dialog box (options command).
3. In the File Name box, enter a name for the new drawing template file. Click Save.
If you are using AutoCAD on Mac OS, use the following steps:
1. With AutoCAD as the active application, open the DWG file that you want to save as a DWT file and click File ➢ Save As (or at the command prompt, you could enter saveas and press Enter).
2. In the Save Drawing As dialog box, click the File Format drop-down list and choose AutoCAD Drawing Template (*.dwt).
AutoCAD changes the current Save To location in the Where drop-down list to the location specified by the Drawing Template File Location node on the Application tab of the Application Preferences dialog box (options command).
3. In the Save As box, enter a name for the new drawing template file. Click Save.
NOTE
Drawing standards (DWS) files are always saved in the latest file format. If you support multiple releases of AutoCAD in your company, you will want to instead save your standards to a DWG file with the oldest file format required. Once the DWG file is created, you can then just change the 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 current value is displayed between the angle brackets. Pressing Enter without providing a new value ends the command and does not change the value of the system variable.
TIP
The name of a system variable can also be entered directly at the command prompt just like any other command. Doing so avoids having to first start the setvar command.
You can list all supported variables by doing the following:
1. At the command prompt, enter setvar and press Enter.
2. At the Enter variable name or [?]: prompt, enter ? and press Enter.
3. At the Enter variable(s) to list <*>: prompt, press Enter to list all supported system variables or enter a wildcard search string.
For example, you can enter the wildcard search string DIM* to list all the system variables that start with the letters DIM.
All the system variables that match the previous entered value are returned.
If the message Press ENTER to continue: is displayed in the command-line window, it indicates that there are additional results that have not yet been displayed. Press Enter to continue paging through all the returned system variables. Continue pressing Enter until you reach the last page of the results returned, or press Esc when you are done paging through the system variables.
Managing Drawing Template Files
After you spend the time creating and customizing your drawing template (DWT) files, you will want to make sure that all users in your company have access to them. By default, AutoCAD looks in a local folder on each workstation for the DWT files it can use. This local folder is specified in the Options dialog box (Windows) or Application Preferences dialog box (Mac OS).
Using a local folder is not ideal for maintaining these files; it is best to change the location AutoCAD looks in to a folder on a networked drive. A networked folder makes it easy to update your drawing template files; post the files once, and then everyone always has access to the latest version.
If you need to use a local folder for your DWT files – when you have remote users, for example – it is good practice to keep your customized files separate from those that come with AutoCAD. Doing so makes it easy to back up your custom files and also removes the temptation to stray from your company's CAD standards. The recommended process for managing local DWT files is to first create a company folder on the local drive, and then create a Template subfolder and add your DWT files to the Template folder. Keeping the files synchronized from a network or remote server can be done using a batch (BAT) or BASH script (SH), Windows Task Scheduler event, or login script to synchronize the files from a network or remote server.
Follow these steps to specify a different folder for AutoCAD on Windows to look in for DWT files:
1. In Windows Explorer or File Explorer, browse to the folder that you created for this book under My Documents (or Documents) or create a new folder that you will use to store your DWT files.
• On the keyboard, press the Windows+E key combination, or right-click in the lower-left corner of the screen (not the AutoCAD application window) and click Windows Explorer or File Explorer, based on your operating system.
• In Windows Explorer or File Explorer, navigate to the folder where you want to store your DWT files.
• Right-click in an empty area in the Folders/Files list and click New Folder. Enter the name Templates or the name you want to use. Press Enter to accept the new name.
2. Click the Application button ➢ Options.
3. In the Options dialog box, click the Files tab.
4. Expand the Templates Settings node, and then expand the Drawing Template File Location node.
5. Double-click the folder path listed under the Drawing Template File Location node.
6. In the Browse For Folder dialog box, browse to and select the folder that contains or will contain your DWT files. Click OK.
7. Click OK to return to your drawing.
8. Click the Application button ➢ New. Click Cancel.
You should notice that the Select Template dialog box now opens to the location you specified in step 6.
If you are using AutoCAD on Mac OS, use these steps:
1. In Finder, browse to the folder that you created for this book under Documents or create a new folder that you will use to store your DWT files.
• In the Mac OS Dock, click Finder or from the desktop click File ➢ Computer.
• In Finder, navigate to the folder where you want to store your DWT files.
• Ctrl-click or secondary-click in an empty area in the Folders/Files list and click New Folder. Enter the name Templates or the name you want to use. Press Enter to accept the new name.
2. Click AutoCAD <release> menu ➢ Preferences.
3. In the Application Preferences dialog box, click the Application tab.
4. Expand the Templates Settings node, and then expand the Drawing Template File Location node.
5. Double-click the folder path listed under the Drawing Template File Location node.
6. In the Open dialog box, browse to and select the folder that contains or will contain your DWT files. Click Open.
7. Click OK to return to your drawing.
8. Click File ➢ New Drawing. Click Cancel.
You should notice that the Select Template dialog box now opens to the location you specified in step 6.
In addition to specifying the location of the Select Template dialog box, you can specify the default DWT file that is used with the qnew (Quick New) command. You specify the DWT file for the qnew command using the Options dialog box (Windows) or Application Preferences dialog box (Mac OS).
Use these steps to specify which DWT file should be used when the qnew command is executed in AutoCAD on Windows:
1. Click the Application button ➢ Options.
2. In the Options dialog box, click the Files tab.
3. Expand the Templates Settings node, and then expand the Default Template File Name for QNEW node.
4. Double-click the filename listed under the Default Template File Name For QNEW node.
5. In the Select A File dialog box, browse to and select the DWT file that you want to use with the qnew command. Click Open.
6. Click OK to return to your drawing.
7. On the Quick Access toolbar, click New. A new drawing file is created based on the DWT file you selected in step 5.
If you are using AutoCAD on Mac OS, use the following steps:
1. Click AutoCAD <release> menu ➢ Preferences.
2. In the Application Preferences dialog box, click the Application tab.
3. Expand the Templates Settings node, and then expand the Default Template File Name For QNEW node.
4. Double-click the filename listed under the Default Template File Name For QNEW node.
5. In the Open dialog box, browse to and select the DWT file that you want to use with the qnew command. Click Open.
6. Click OK to return to your drawing.
7. At the command prompt, enter qnew and press Enter. A new drawing file is created based on the DWT file you selected in step 5.