Читать книгу AutoCAD Platform Customization - Ambrosius Lee - Страница 20
Part I
AutoCAD Customization: Increasing Productivity through Personalization
Chapter 1
Establishing the Foundation for Drawing Standards
Enforcing CAD Standards
ОглавлениеCAD standards enforcement is a gradual process if you are not doing it today. The best strategy you have is positive reinforcement and coaching. At the end of the day, your drafters and professionals need to want to follow all the established standards. It can be tempting to take the quick and easy route to get a job done, but shortcutting a process can have unexpected consequences, such as a custom tool not working in a drawing and resulting in manual steps or a drawing not plotting correctly. After all, a process works each and every time only when each step is completed properly.
There are steps you can take to help make following CAD standards easier for the drafters and professionals you support. You can use these methods to apply and enforce your company's standards:
User-Interface Customization AutoCAD offers an interface that can be customized to the way your company works. You can create ribbon buttons or menu items that use a custom macro to set a layer or style as current before starting a command. Customizing the user interface is covered in Chapter 5, “Customizing the AutoCAD User Interface for Windows,” and Chapter 6, “Customizing the AutoCAD User Interface for Mac.”
Scripts Script files are a great way to execute multiple commands and options in a specific order using predefined values without needing to understand a programming language. You can create layers and styles, insert a title block on a specific layer, or even change your current drafting settings. Creating script files is discussed in Chapter 8.
Action Macros Created using the Action Recorder, action macros are a modern take on script files. They allow you to execute multiple commands and options in a specific order, but they are created interactively while you use AutoCAD. After an action macro is created, it can be executed in other drawing files. Recording action macros is covered in Chapter 8. (Action macros are not available on AutoCAD for Mac OS.)
Custom Programs
The programming languages that AutoCAD supports give you the most flexibility in enforcing CAD standards. Custom programs can be created to make sure a specific layer is current before a command is started, whether the user starts the command from the user interface or from the command prompt.
You can also use custom programs to step through the objects in a drawing and make sure they conform to your standards, and much more.
Tool Palettes An arrangement of tools in the Tool Palettes window allows you to create objects using specific property settings. You can create a Note tool that uses a specific combination of text style and layer for general notes and define another tool for disclaimers; access and insert commonly used blocks at a set scale; or fill an enclosed area with a hatch pattern, using a specific lineweight and color. I discuss tool palettes in Chapter 7, “Creating Tools and Tool Palettes.” (The Tool Palettes window is not available on AutoCAD for Mac OS.)
DesignCenter™ DesignCenter allows you to access the named objects defined in a drawing and add them to your current drawing. It also allows you to insert blocks as well as attach external drawings and raster images. I do not cover using DesignCenter in this book; use the AutoCAD Help to learn more about this feature. (DesignCenter is not available on AutoCAD for Mac OS.)
Content Explorer™ Content Explorer is a modernized version of DesignCenter that allows you to locate named objects from other drawing files on a network and add them to your current drawing. I do not cover configuring and using Content Explorer in this book; use the AutoCAD Help to learn more about this feature. (Content Explorer is not available on AutoCAD for Mac OS.)
AutoCAD on Windows offers multiple tools that are designed to help you validate named objects and their properties in a drawing against those defined in a drawing standards (DWS) file. These tools are as follows:
Standards Manager Used to configure and validate a drawing file for standards violations. Violations found can be fixed to conform to the standards you are validating against.
Batch Standards Checker Validates the standards in a set of drawing files and generates a report of all the violations found and which drawing files they were found in. You must open each drawing file manually in order to fix the violations found.
Layer Translator Used to create layer mappings and align the layers of a drawing with those defined in your standards.
Drawing Standards (DWS) Files (Windows Only)
A drawing standards (DWS) file is the same as a drawing or a drawing template file, with the exception of the content it contains and its file extension. A DWS file commonly does not contain any graphical objects, but it does contain all of the named objects that are used to define your CAD standards and your layer translation mappings for the Layer Translator. For more information on named objects, see Chapter 2. I cover the Layer Translator in the “Translating Layers (Windows Only)” section later in this chapter.
At a minimum, your DWS files should contain the following named objects:
• Dimension styles
• Layers
• Linetypes
• Text styles
These steps explain how to save a DWG file to a DWS file using AutoCAD on Windows:
1. In AutoCAD, open or create a DWG file that contains the named objects that represent your CAD standards. Click the Application button ➢ Save As.
2. In the Save Drawing As dialog box, click the Files Of Type drop down-list and choose AutoCAD Drawing Standards (*.dws).
3. Browse to a common location on the network to store the DWS file so that you and others in your company can access it.
4. In the File Name box, enter a name for the new drawing template file. Click Save.
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.
Configuring, Checking, and Fixing Drawing Standards (Windows Only)
The AutoCAD Standards Manager provides you with the ability to check several of the named object types in a drawing against those defined in a drawing standards (DWS) file. Using the Standards Manager requires the completion of two distinct processes: first, you associate one or more DWS files that contain your CAD standards with the current drawing, and second, you check and fix any standards violations found.
Configuring Standards
Configuring a drawing to be checked for standards violations requires you to associate the DWS files that contain your CAD standards and specify which plug-ins you want to use. A plug-in defines the comparison rules that should be used to find any standards violations in the current drawing against the approved CAD standards in the DWS files. You can choose from one of four plug-ins that come with AutoCAD, you can obtain plug-ins from third-party developers, or you can develop your own plug-ins using the CAD Standards Plug-in API. You associate DWS files with a drawing using the standards command, which displays the Configure Standards dialog box.
TIP
You can associate DWS files with a drawing template (DWT) file. Any new drawings created from the drawing template will maintain the associations so that you do not have to go through the configuration process for each new drawing file you create.
The following steps explain how to associate a DWS file with a drawing and specify which standards plug-ins to use:
1. On the ribbon, click Manage tab ➢ CAD Standards panel ➢ Configure (or at the command prompt, enter standards and press Enter). The Configure Standards dialog box (see Figure 1.6) is displayed.
2. In the Configure Standards dialog box, click the Standards tab.
You use the Standards tab to associate DWS files with the current drawing and to control the order in which AutoCAD should search the associated DWS files when validating standards. AutoCAD starts searching for named objects that match the names of those in the current drawing from the top of the list downward.
3. Click the + (plus) button to add a new DWS file association to the current drawing. The Select Standards File dialog box is displayed.
4. In the Select Standards File dialog box, browse to and select the DWS file that you want to associate with the drawing. Click Open.
Only one DWS file can be associated at a time. Click the + (plus) button and add all the DWS files you want to check against.
5. If you add more than one DWS file, select an associated DWS file and click Move Up/Move Down to change the search order of the DWS files.
Select a DWS file and click the X to remove an associated DWS file.
6. Click the Plug-ins tab. You use the Plug-ins tab (see Figure 1.7) to specify which plug-ins should be used when checking the standards of the current drawing against the DWS files that have been associated with the drawing.
7. Specify the plug-ins you want to use when checking for standards violations.
8. Click the Settings button. The CAD Standards Settings dialog box (see Figure 1.8) is displayed.
9. In the CAD Standards Settings dialog box, change the settings as needed and click OK.
You can change the display behavior of the CAD Standards notification balloon and icon in the drawing status bar tray (see Figure 1.9) in the Notification Settings section. The settings in the Check Standards Settings section control how errors are handled when a drawing is checked for standards violations.
1. Click OK to close the Configure Standards dialog box and return to your drawing.
Based on your settings in the CAD Standards Settings dialog box, the CAD Standards icon might be displayed in the drawing status-bar tray. The tray icon, when displayed, can be used to indicate whether at least one DWS file is associated with the current drawing. Right-clicking the icon allows you to configure and check the drawing standards in your drawing.
Figure 1.6 Configuring drawing standards files
Figure 1.7 Enabling the plug-ins to use when validating drawing standards
Figure 1.8 Changing the notification and Check Standards settings
Figure 1.9 Access to CAD Standards notifications and settings is just a click away.
Checking For and Fixing Standards Violations
After you have associated at least one DWS file to a drawing and specified which plug-ins to use, you can check your drawing for standards violations. While you are checking for standards violations, each plug-in is executed one by one, and how a plug-in checks for standards violations can vary between plug-ins.
The standard four plug-ins that come with AutoCAD compare the name of an object in the current drawing to the names of objects in the associated DWS files. When a match is found, AutoCAD checks to see whether the properties of the two named objects are the same. If they are the same, AutoCAD moves on to the next named object and checks it. If the properties are different, you are asked to fix or ignore the standards violation. If no matching named object is found between the drawing and DWS files, you are prompted to select one of the approved named objects from the associated DWS files or ignore the standards violation.
Follow these steps to check a drawing for any standards violations:
1. On the ribbon, click Manage tab ➢ CAD Standards panel ➢ Check (or at the command prompt, enter checkstandards and press Enter).
The Check Standards dialog box (see Figure 1.10) is displayed. If no DWS file is associated with the drawing file, you will be presented with an error message. Click OK to configure the CAD standards settings for the drawing and then continue checking for standards violations.
2. In the Check Standards dialog box, in the Problem area review the first standards violation found. The Problem area provides you with a description of the standards violation.
3. In the Replace With area, choose one of the available fixes.
The Replace With area provides you with all the possible fixes that one of the plug-ins identified for the standards violation. A plug-in can recommend a fix that is indicated by a blue check mark to the left of the item. After selecting a possible fix for the standards violation, you can see an overview of the changes that will be made in the Preview Of Changes area. You can have AutoCAD automatically fix standards violations that have nonstandard properties by clicking the Settings button and enabling Automatically Fix Non-standard Properties in the CAD Standards Settings dialog box. If your DWS files offer more than one recommendation for a fix, you can specify the preferred DWS file that you want to use from the CAD Standards Settings dialog box as well.
4. Click Fix to correct or Next to skip the standards violation, and move to the next one found.
When you skip a standards violation, you can click Mark This Problem As Ignored to not have the violation show up the next time the drawing is checked. You can choose to display all ignored violations by clicking the Settings button and enabling Show Ignored Problems in the CAD Standards Settings dialog box.
5. Continue stepping through each standards violation until the Check Standards – Check Complete message box is displayed. Click Close.
The Check Standards – Check Complete message box (see Figure 1.11) provides you with a summary of the actions taken to resolve the standards violations found.
6. Click Close to close the Check Standards dialog box and return to your drawing.
Figure 1.10 Standards violation found
Figure 1.11 The check for standards violations is complete.
While working on a drawing with CAD standards configured, you might see the Standards Violation balloon (see Figure 1.12) come up. This indicates that something in the drawing conflicts with your company's standards. A custom routine might have caused the standards violation, or maybe you inserted a drawing that contains named objects that were not updated with the latest standards. Click the Run Check Standards link in the balloon to fix or ignore the standards violation.
Figure 1.12 Standards violation detected
Checking Drawings in Batches
The Check Standards dialog box is efficient for checking the standards of the current drawing, but it is not ideal if you have five, ten, or even hundreds of drawings in your project that need to be checked. When AutoCAD is installed, it also installs an external utility called the Batch Standards Checker. The Batch Standards Checker allows you to select a number of drawings and check them against the standards defined in a DWS file.
The Batch Standards Checker allows you to check the drawing files using the DWS files that are already associated with each file, or you can specify which DWS files should be used. This utility uses the same plug-ins that are available in the Configure Standards dialog box. The one feature that the Batch Standards Checker does not support is the ability to fix any of the violations found; that must be done by opening each drawing and using the checkstandards command.
The following steps explain how to use the Batch Standards Checker:
1. Do one of the following:
• (Windows XP and Windows 7) Click the Windows Start button ➢ [All] Programs ➢ Autodesk ➢ AutoCAD <release> ➢ Batch Standards Checker.
• (Windows 8) On the Start screen, right-click and click All Apps. Under the AutoCAD <release> category, click Batch Standards Checker.
The Batch Standards Checker dialog box (see Figure 1.13) is displayed.
2. In the Batch Standards Checker, on the Drawings tab click the + (plus) button.
3. In the Batch Standards Checker – File Open dialog, browse to and select the drawings and drawing templates you want to check for standards violations. Click Open.
Press and hold the Ctrl key when browsing to select more than one file.
4. Optionally, click the Check External References Of Listed Drawings check box.
When this option is enabled, the Batch Standards Checker will also check the external references attached to the listed files for any standards violations.
5. Click the Standards tab.
This tab is similar to the Standards tab of the Configure Standards dialog box in AutoCAD. The only difference is the two options located along the top of the tab.
6. Choose one of the two options along the top of the tab:
• The Check Each Drawing Using The Associated Standards Files option instructs the Batch Standards Checker to use the DWS files associated with each drawing file; if no DWS file is associated with a drawing file, the drawing is not checked for standards violations.
• Use the Check All Drawings Using The Following Standards Files option to specify which DWS files to use for validating the CAD standards. Click the + (plus) button to list which DWS files to use. If more than one DWS file is added, select an associated DWS file and click Move Up/Move Down to change the search order of the DWS files. Select a DWS file and click the X to remove an associated DWS file.
7. Click the Plug-ins tab.
This tab is identical to the Plug-ins tab of the Configure Standards dialog box in AutoCAD.
8. Specify which plug-ins to use when checking the drawings for standards violations.
9. Optionally, click the Notes tab and enter the text for the note.
You might want to list the project's name, your name, and any other information that could be useful to the next person who views the report generated after checking the drawing files for standards violations.
1. On the Batch Standards Checker toolbar, click Save.
2. In the Batch Standards Checker – File Save dialog, browse to a location and enter a name for the Standards Check (CHX) file. Click Save.
The CHX file contains a reference to the drawings you added to the list and specifies which drawing standards (DWS) files and plug-ins to use, along with the notes and other settings you included. You might want to create a CHX file for each one of your projects and then store them with the drawing files in your project.
1. On the Batch Standards Checker toolbar, click Start Check.
The Progress tab is displayed with the current progress of the standards violation check for the drawing files that were listed on the Drawings tab. Once processing has been completed, the Standards Audit Report (see Figure 1.14) is displayed in your default web browser. Use this report to view any standards violations found. The most recent report is saved with the CHX and can be viewed by clicking Check ➢ View Report on the Batch Standards Checker's menu bar.
Figure 1.13 Morethan one drawing can be checked for standards violations with the Batch Standards Checker.
Figure 1.14 Use this report to determine which files contain standards violations so they can be fixed.
Translating Layers (Windows Only)
Checking a drawing for standards violations is great for ensuring the files in the projects you create conform to your CAD standards, but working with drawings from a client or subcontractor can make this a bit more challenging, especially when it comes to layer standards. Over a set of drawings, you might use a few different dimension or text styles, but over those same drawings you could be working with dozens or hundreds of different layers.
AutoCAD provides a tool called the Layer Translator that allows you to map a single layer or a group of layers to a single layer based on your established CAD standards. Once a translation map is defined, it can be saved to a drawing or drawing standards file to reuse on other files from the client. This tool can also be useful in transitioning from an old to a new layer standard that your company is implementing. The Layer Translator can be displayed using the laytrans command.
Follow these steps to define a layer translation map and translate the layers in the current drawing to those defined by your CAD standards:
1. On the ribbon, click Manage tab ➢ CAD Standards panel ➢ Layer Translator (or at the command prompt, enter laytrans and press Enter). The Layer Translator dialog box (see Figure 1.15) is displayed.
2. In the Layer Translator, click Load in the Translate To area.
3. In the Select Drawing File dialog box, browse to and select the file that contains your CAD standards. Click Open. The layers in the file are populated in the Translate To list.
4. If your CAD standards file does not contain a layer you want to use as part of the layer translation map, click New. The New Layer dialog box (see Figure 1.16) is displayed.
5. In the New Layer dialog box, enter a name for the layer and define the new layer's properties. Click OK.The new layer is added to the Translate To list, but it is not actually created in the drawing until it is used as part of the layer translation mapping and the Translate button is clicked.
6. Click Map Same, adjacent to the Translate To area. This creates layer mappings for the layers that are named the same between the Translate From and Translate To areas.
7. In the Translate From area, select the layers that you want to map to a layer listed in the Translate To area. Press and hold Ctrl to select more than one layer in the Translate From area.
TIP
If the layer list in the Translate From area contains a large number of layers, you can right-click the list and click Purge Layers to remove from the list the layers that are not being used in the current drawing. You can also enter a wildcard search in the Selection Filter text box to help you select layers listed in the Translate From area. For example, you can enter *DIM* to find all the layers that have a name containing the characters DIM some place in their names.
8. In the Translate To area, select the layer that the layers you selected in the Translate From list should be mapped to. Click Map.One or more layer mappings are added to the Layer Translation Mapping list, and the layers selected from the Translate From list are removed from the list since they cannot be mapped to multiple layers.
9. Click Settings. The Settings dialog box (see Figure 1.17) is displayed.
10. In the Settings dialog box, enable the options you want to use when translating the mapped layers. Click OK.
11. In the Layer Translator dialog box, click Translate.
12. In the Layer Translator – Changes Not Saved message box, click Translate And Save Mapping Information or Translate Only.
• If you clicked Translate And Save Mapping Information, the Save Layer Mappings dialog box is displayed. Browse to a location and enter a name for the file. If needed, choose Standards (*.dws) or Drawing (*.dwg) from the Files Of Type drop-down list, and then click Save. After the translation mappings are saved, the layers are updated in the current drawing according to the layer mappings you created.
• If you clicked Translate Only, the layers are updated in the current drawing based on the layer mappings you created and then the layer translation mappings are discarded.
Figure 1.15 Translating layers between CAD standards
Figure 1.16 Defining a new layer to use as part of the layer translation map
Figure 1.17 Changing the settings to use when translating layers