Tag, You're It! (Productivity Corner MicroStation Tutorial)1 Jan, 2007 By: Samir Haque
How to handle nongraphical information in MicroStation.
As useful as geometrical representations are -- that's what CAD is all about, after all -- there's a lot of information about components in a design that can't usefully be displayed graphically. This nongraphical information includes material lists, specifications, source, cost, maintenance schedules and so on. With MicroStation, you can attach this kind of nongraphical information to elements or cells in a DGN file as tags.
Tags are organized by tag sets, a powerful feature that lets you run or export reports as well as create links to other software. Tag sets specify the name, display properties, data type and default value for each tag in the set. You can think of a tag set as something like an Excel spreadsheet or an internal database, where each row is a tag and the columns to the right of the tag name contain the information in each tag.
You can create tag sets from scratch, get them from component manufacturers or store them in libraries for use in multiple DGN files.
In this illustration, all the information in the tag definition is displayed.
Create a Tag Set
To create a tag set in MicroStation, go to the Element pull-down menu, select Tags / Define and the Tag Set dialog box opens.
The Tag Set dialog box.
Click Add under the Sets window in this dialog box. The Tag Set Name dialog box opens.
Now enter the name of the first tag set to be added, such as parcel. Click OK and the new tag set name appears in the Sets window.
To create a tag for the lots, select parcel in the Sets window of the Tag Sets dialog box, then click the Add button below the Tags window. The Define Tag dialog box opens.
The Define Tag dialog box.
In the Tag Name window, enter the name of the tag.
Other settings available in the Tag Sets dialog box include:
- Tag type
MicroStation lets you use character, integer or real numbers for the tag type. Character type is text data with a maximum limit of 1,024 characters. Integer type is a four-byte numerical value. Real type is an eight-byte floating point value. AutoCAD supports only character-type tags. Real- or integer-type tags in a DGN file automatically convert to character-type tags when you save the file as a DWG.
- Variable toggle
If the Variable toggle is on, the Attach Tags dialog box opens when you use the Attach Tags tool and you can enter the tag value. If the toggle is off, the default value for the tag is used when you attach the tag. Essentially, this forces you to enter the critical tag data during the attach tag process, ensuring all of the tagged elements contain valid data (as opposed to null values).
- Default toggle
If the Default toggle is on, the tag attaches automatically with the default value. If the Default value is not set, the value for character type tags will be NULL and 0 for the numeric types.
- Confirm toggle
If the Confirm toggle is on, a dialog box opens when the Attach Tags tool is used. The tag value can then be entered into this dialog box. If a default tag value is to be used, it should be entered in the Default Tag Value window.
- Display Tag toggle
The Display Tag toggle is on by default. The tag displays when you place it. If it's off, the tag isn't displayed. You should turn the display off when associating the tag with non-visual elements or for fast display.
Once you've defined the tag set and its data fields, it's time to place the tag in the file. To do so, use the Attach Tags tool. The Attach Tags dialog box opens, letting you select the tag set containing the tag(s) to be placed.
From the Attach Tags dialog box, select the tag set that includes tags you need to place.
If the Association toggle in this dialog box is on, you must attach the tag to an element in the file. If it is off, the tag is placed without an association to any element in the file. When placed, the tag name is displayed, not the tag value. You should use this method most often when creating cells with tags. You create the cell and place the tag without an association, so the tag value displays instead of the tag name.
Compatibility with AutoCAD Attributes AutoCAD provides a way to associate nongraphical information to a block (the equivalent of a MicroStation cell). The information attached to a block is called attributes.
Aside from the limitation to blocks for AutoCAD attributes, there are other differences to consider when you're working in a DGN file that will be converted to DWG format, or when you are working directly in a DWG file in MicroStation.
MicroStation tag sets are not supported in AutoCAD. When a DGN file containing tags is saved to DWG, the information in the tags is preserved and the tags are translated into AutoCAD attributes, but the reporting power of tag sets is lost. Conversely, when a DWG file containing attributes is opened in MicroStation or saved to DGN, a tag set is created for each attribute in each shared cell definition.
Because an AutoCAD block, like a MicroStation cell, is nothing more than a drawing file, a common mistake made with tags in DWG files is to attach the file intended to be a block as a reference file. When this happens, the tag name, not the value, is displayed. These files, or blocks, must be placed as blocks in order to display the tag value.
Link to Data
This month's article discusses manipulating tags in their rawest form. In practice, tags serve a very important role in the design process by providing an important link from the graphical environment to the outside world of data management. In fact, MicroStation's own Engineering Links uses this same tag technology to store and act on Internet links associated with elements of a DGN file. You could say that MicroStation's tag feature is what allows a MicroStation DGN file to communicate with the outside world. Then again, that's a subject for a future article.
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD video tips. Subscribe to the free Cadalyst Video Picks newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!