Sheets Happen! Step 14: Automating View Label Data
As you learned in my previous Sheets Happen! post, you can assign the Label Block for Views property in your sheet set so that it automatically inserts a label block when you create a view from the Resource Drawings (in AutoCAD 2007 the Resource Drawings tab is called Model Views). While you can manually edit the values for the block data, such as viewport scale, view title, and view number, wouldn’t it be great if that process was automated? It can be! Assuming you already assigned the Label Block for Views property in the Sheet Set Properties according to Sheets Happen! Step 13, you can simply replace the default attribute values with the appropriate Fields! If your label block does not contain attribute definitions, you can define block attributes using traditional methods and then follow this procedure.
- Open the drawing containing the source block definition. This is the drawing which is being used by the Label Block for Views in the Sheet Set Properties. It is very important that you make sure you are editing the block definition which is being used by the sheet set. If you are like me, you might have several versions of a block and if you are editing one version, but testing a different version, you will make yourself crazy trying to troubleshoot! Trust me! The time you take verifying that the exact path and file name being used by the sheet set matches the one you are editing, will be worth it!
You will need to edit the Default value for each of the attribute definitions. A typical view label block would include attribute definitions for the view number, name and scale. Your block might include additional information as well, but I’ll focus on these three since they are the most common. The method you use to update the attribute definition depends somewhat on whether the block is stored as its own drawing or as a block definition within a drawing. Since I’m already assuming that you know how to create a block definition with attributes, I’m also going to assume that you know how to edit those attribute definitions. This way I don’t have to describe all of the different methods for accessing the attribute definitions. Instead, I will describe the most graphical method with which everyone is probably familiar. Realize that you can use any method (Battman, etc) that you want.
- If your label block is stored as its own drawing, go to the next step. If your label block is stored as a block definition within your drawing, insert and explode the label block (alternate methods include Battman or the Block Editor). When you explode a block with attributes, the attribute values (left) are replaced with the attribute definitions (right).
- Double-click on the attribute definition for the view number.
- In the Edit Attribute Definition dialog box, right-click in Default and select Insert Field.
- In the Field dialog box, select the SheetSet Field category, the SheetSetPlaceholder Field name, the ViewNumber Placeholder type and an appropriate format and then choose OK.
- Select the attribute definition that you just edited, right-click and choose Properties.
- In the Properties window, set the Preset property to Yes. Since the Field will be entering the attribute value for you, you do not want to prompt the user to enter the information as you would have done using traditional attribute definitions. Setting the Preset property to yes will prevent AutoCAD from asking for a value when the block is inserted.
- Repeat steps 3-7 to add fields to each of the attribute definitions by selecting the appropriate Field name. For example, use ViewTitle to display the name of the view and use ViewportScale to display its scale.
- Redefine the view label block using the Block command (not necessary if you use Battman or the Block Editor) and save the drawing. Keep in mind that the insertion point you specify will determine how the block is inserted relative to the viewport (see Sheets Happen! Step 13 for more information).
You want to ensure that you are editing the attribute definition NOT the attribute value in the block instance. How do you know the difference? The attribute definition says “Default”, whereas the attribute value says “Value”. If you insert a field in an attribute “Value”, it may appear to work properly, but if the instance was updated to include a field and the definition was not, the next time someone erases the block instance and reinserts it, the field data will no longer be there.
That is all it takes to make your old view label block smarter! Now you can try it out by creating a new sheet and then dragging a view from the Resource Drawings (Model Views) onto the sheet. The view label should automatically display the viewport scale and view title. By default, the view title uses the name of the named model space view or the drawing depending which one you inserted from the Resource Drawings (Model View) list. There is no default number associated with the view but you can easily change the view number and the view title in the Sheet Set Manager using the View List tab (in AutoCAD 2007 the View List tab is called Sheet Views).
- In the Sheet Set Manager, select the Sheet List tab.
- Right-click and choose New Sheet. When creating and testing sheet set fields, always create a new sheet to ensure that you are using the appropriate (new) definitions. If you add a new view to an existing sheet which already contains your old view label block definition, it will use that definition rather than the one you updated in the source file and you'll spend all your time trying to "fix" a problem that doesn't exist.
- Open the new sheet.
- Select the Resource Drawings (Model Views) tab and drag a view or drawing onto your sheet. When you add a new view to your sheet, that new view will automatically display on the View List (Sheet Views) tab.
- Select the View List (Sheet Views) tab. The View List (Sheet Views) tab displays all of the sheet/layout views created by the Sheet Set Manager. You can display the view list by sheet or by view category (AutoCAD 2005 only displays by view category). I may discuss view categories in a future post, but if you want to learn more about them now, you can refer to the Help system.
- Right-click on the newly-created view and choose Rename & Renumber.
- In the Rename & Renumber dialog box, you can enter a view number and/or change the view title and then choose OK. The field value in the view label block will update the next time the drawing regenerates (ie during an Open, Save, Plot, etc) or you can use the Regen command to force a regeneration.
Now that your drawing is using field data, it is CRUCIAL that you do not edit those attribute values using traditional methods. For example, if you want to change the view title, it might be tempting to double-click on the inserted view label block and enter the new title. If you do that, you've replaced the dynamic field data with static old text and the intelligence you gained from fields is gone. Unfortunately there is not currently a way to prevent users from making this mistake so it can only be avoided through education! If you see a field in a drawing (text with a grey background), never edit it! That data is being read from somewhere else and you need to edit the source, not the attribute value! In most cases that I will describe, that source data must be edited in the Sheet Set Manager.
Good luck and remember the Dos and Don’ts:
- Do verify that the block you are editing is the same version as the one being used by the Sheet Set Manager.
- Do create a new sheet each time you test updates to your attribute definitions to ensure that you are using the new block definition.
- Don’t insert fields in attribute values (block instances).
- Don’t edit field data (grey text) in a drawing.
0 comments:
Post a Comment