Tuesday, February 28, 2006

Self Underling Tags

It sure would be cool to create a tag that will do something that was so simple in AutoCAD… underline itself no matter how long it gets. Remember “%%u”? If you prefixed an attribute with it the resulting attribute’s underline would be only as long as the number of characters that made it up. Today I’m going to create a Pump Tag that is appropriately underlined whether it’s P-1 or P-2000.

There are 3 important parts involved in making this happen.
1. The Tag
2. The Property that the tag calls
3. The Property Data Format

The Tag
My tag has 2 parts, a static part “P-“ that will never change, and it will also call a property from a property set which is constantly up for change. The underline must span both parts.

To make my tag, I will just place 2 pieces of text in a drawing (“%%uP- “ and “XXX”) as I want to see them for a tag. Notice I added a space after the dash. This is necessary for the underlining of my two parts to overlap. The result should look something like this.

P-XXX

The Property that the tag calls

So much for the first part. Now I need a property to call. I made a Property Set called Pumps in the Style manager, and added a property called “Pump_Number”. If you look at the available formats for this property, Underlined is not available.



The Property Data Format

We are going to have to make a format called Underlined ourselves. In the Style manager, drill to Property Data Formats under Documentation objects, and create a new format. Name it underlined. In the Formatting tab add “%%u” to the Prefix: box. See figure 2.



Now go back to the Pumps Property Set Definition. There we can select the newly made format of underlined.

The two underlines will slightly overlap, but are perfectly aligned so the plots will never show it. When you add or change your pump number, the “%%u” shows until you activate the field to edit it. This is great because users can not accidentally delete it.

No comments: