In our last post we looked at creating the actual tag based on property set definitions that we created in the first post of the series. In this post we will be adding the ability for our bottom of duct (BOD) elevation tag to include or not include the insulation thickness in the elevation display. Not only will we modify the elevation but we will also modify BOD to read instead BOI to indicate that the elevation is from the bottom of insulation and not the bottom of duct. So lets get started!
The first thing we need to do is add an automatic property definition to our ECDuctCustomData property set. You can refer to the first part of the series if you do not remember how to do this. The property we are looking to add is called Insulation Thickness and we should turn its visible property off. There is no need to show it on the property palette as it is already available on the design tab. We will also need a manual property definition called ShowInsulationOnElevationTag. We should set its type to True/False, change its default value to False and leave its visible property on. We will want to see this on the property palette so we can choose to see the insulation thickness elevation if we desire.
Lastly we will need to add some additional items to the BOD_Calculation formula. The formula needs to be modified to show the elevation plus the insulation thickness if the value of ShowInsulationOnElevationTag is equal to TRUE and if the value is false then we can just display the elevation without the insulation thickness added. To achieve this functionality we will have to use what is called VBScript. According to Wikipedia “VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic.” What this basically means is that it is a small programming language that we can use to inside of the formula editor of Autocad MEP. In this particular formula we will be using three different VBScript components to determine our desired result. First we will use a UCASE() formula to convert the value of ShowInsulationOnElevationTag. I prefer to convert all text to upper case before use in a conditional statement. This way there can be no errors due to upper or lower case letters. Forcing everything to uppercase makes it easy to compare different values. Second we will be using the constant RESULT. RESULT is used to return the result of a formula. And finally we will be using an if/then/else statement to determine which result we should return. The final formula can be seen in the picture to the right. Since we are in the calculation formula and not in the actual tag formula we should make sure that the format of each input value should be set to standard. We have already taken care of the final formatting in the BOD_Tag formula that was created in part one of this series.
Once we have closed out of the formula editor and of the style manager our existing tags should be updated to reflect the changes we made automatically. Since we only made a change to the BOD_Calculation and not the BOD_Tag we do not need to do anything to our existing tags. To verify this we can select the piece of duct we added in part two add two inches of insulation to the duct. The elevation tag will not reflect this change immediately. This is because we set the default value of your true/false toggle to false! If we keep the piece of duct selected and then select the Extended Data tab of the property palette we can change the toggle from false to true. Once we change this flag we can immediately see the elevation tag update with the new elevation. It should now be two inches lower than it was before.
You can view a video of the entire process here:
In Part Four we will look at adding an elevation offset to each piece of duct allowing for an elevation change in certain parts of your drawing.