If you have been following this blog then you will have noticed that I have been absent for quite some time. This was due to a job/career change. While still passionate about AutoCAD MEP I no longer work with it from day to day. I now create plugins for AutoCAD using VB.NET and C# and more specifically create plugins for CadWorx. That being said I have decided to rebrand the blog to still contain information about AutoCAD MEP but to also zero in on customizing AutoCAD MEP by using C#. The plan is to start by expecting the reader to know nothing about programming and teach them everything that they will need to create a plugin. I will do this in a hands on approach. I will show the code and then explain everything that I can about it. I have decided to take this step as it will also be a learning experience for myself. I find that by teaching others I learn so much more about a subject. So stay tuned, there should be new articles popping up very soon!
Building on yesterday’s post, today we want to show how to remove the decimal places from a complex string result when the values of the decimal place are .00. In other words, we would like to display 3.00 as 3. Normally we could just change the data type but this will not work in this case as our result is created as a string by concatenating various other results together. So much in the same way we used the split function to break down the NominalConnectionDiameter we will do the same with our decimal number. If you remember from yesterday’s post, NDArray(0) is just the first number in the NominalConnectionDiameter string.
Breaking down what we did, we took the first number from the NominalConnectionDiameter stored as NDArray(0) and we split it at the decimal place. Then using the upper bounds function we test to see if the result of the function is 0. If it is then there was not a decimal in the original number so we can just display that number. If the upper bounds function returns a non zero number (Actually it would just be a 1) then we know that the number had a decimal place. So we check the decimal place to see if it does not equal double zero. If it does not then we just display the original number as we do not want to truncate a number that has a non zero decimal place value at this point. If the decimal place does equal 0 then we just display the number before the decimal place.
If you schedule the Automatic property NominalConnectionDiameter for pipe fittings in AutoCAD MEP you will discover that the results are not what you are probably expecting. For instance a 2″ pipe will display a 2, where a 3x3x2 tee will display as 3.00;3.00;2.00, and a 2″ elbow will display as 2.00;2.00. Basically except for pipe which will only display a single number, all other fittings display an amount of numbers equal to the number of connections that the fitting possesses. What we really want to display for the elbow is 2.00 instead of 2.00;2.00 and for a 3x3x2 tee it will display 3.00×3.00×2.00. Below is a property set formula that will do exactly that. In addition it will modify single number displays to also show a decimal point to the hundredths place. Enjoy.
In our next post we will show how to strip out the decimal places if the number is an integer so that the 3.00×3.00×2.00 will become just 3x3x2.
Recently a question was asked on the AutoCAD MEP forums about how to put the elevation of a Mass Element in a property set definition when neither the location or the elevation was available as an automatic property. You can view the original post here. Since this was very similar to a post that was covered previously on this blog it was an easy solution. First I created a new property set definition that referenced a mass element and then added the automatic property definition OBJECTID. Once that was complete I created a new formula definition and added the following code. Make sure to replace the [OBJECTID] in the code below with a reference to the automatic property!
If you are like me then you have spent alot of time setting up your AutoTag settings so that your ductwork is tagged the way that you like it. While not 100% perfect the AutoTag functionality of the EastCoast CAD/CAM addin can save you an incredible amount of time during the documentation process of your design. So what do you do if you want to move the settings to another pc or migrate the settings to a more recent version of the software?
Luckily this is as easy as copying a single file from one location to another. First you open up your My Documents folder and navigate to the EastCoast directory and then open the Fabrication For AutoCAD MEP 20XX that corresponds to the version that you are currently using. Find the tags.xml file and copy and paste it into the version of the software that you would like to use the settings in. Please note that some versions of the software use the same version of AutoCAD MEP so you will not have to take any action when upgrading the software. For instance, V6.0 and V6.1 both run inside of AutoCAD MEP 2014. So the Fabrication for AutoCAD MEP folder will be the same for both versions! This means that your settings will automatically appear. However, if you are upgrading from V5.2 to V6.0 or V6.1 then you will need to migrate your settings.
You can also use this same procedure to copy the settings from one PC to another PC. You will just have to locate the appropriate folder location in the users My Documents folder.
New in Version 6.1 of Fabrication for AutoCAD MEP in the Select a Part dialog box SELECT PART SIZE area, the visibility and order of parameters has been optimized to reduce the need to scroll to the far right to identify differences between fittings. Important information will now list on the first few columns, starting with Part Size Name, Connection Diameters, NamePerMfg, and so on. For example, for elbows, the Angle column has been moved up to the front.
This should allow you to find and select your pipe fittings much quicker and easier!
New in Fabrication for AutoCAD MEP V6.1 Eastcoast has added a new classification called status.
When a new EastCoast duct object is placed into your model this classification will automatically be set by the software to the status defined by your specification. This will allow you to create schedules that can quickly and easily select and filter your duct objects for scheduling.
I get a lot of questions on schedules and property sets and instead of reinventing the wheel I thought I would point out a set of 4 videos by Jay Ayala of Autodesk. Enjoy.
Property Set Definitions
There are two types of parts in an Autocad MEP MvPart Catalog. A block based MvPart and a Parametric MvPart. Block based parts are created from 3D solids or Mass Elements. Additional sizes that are added to the part are done by creating a new block and adding it to the catalog drawing file. Parametric parts are created using dimensions and constraints. All sizes are modeled from a single part that is ‘flexed’ by its parameters to create a almost unlimited amount of size combinations. Even though each part type is created using content builder, the interface to do so is decidedly different for a block based part than that for a parametric part. The main advantage of a parametric based part is that it is quite easy to create new custom sizes as long as the model is built correctly.
How do you tell when adding a part if it is parametric or block based? It is quite easy by looking at the icon of the part in the Add Multi-View Parts Dialog. The picture below is worth a thousand words.
In the last post we looked at how to add an undocumented property to a property set definition. This time lets try to add a formula based location property to a space object using the method from the last post.
When this property definition is created and made visible there is no information being reported. The property definition is blank. Why is this? This is because a location property is actually made up of three different values (x,y, and z) that are stored as a point object in the system. VBScript does not know how to read point objects so the point object will first need to be converted into an array before it can read. The following code gets the space location and breaks the location point up into its 3 separate values and then concatenates them together as a string so we can read them and returns the result.
The value of the property definition should look something like this 144.124;1200.375;0. This would place the space object 12′-0 1/8″ on the positive X axis, 100′- 0 3/8″ on the Y axis and at a zero elevation. If you would like to see more or less decimal places in the result then you can change the second line of code from DecimalPlaces = 3 to DecimalPlaces = X where X is the amount of decimal places you would like to see. And finally if you are only interested in the elevation of the space then you can modify the result of the script to instead say RESULT = LocationZ. There is no need to convert to a string in this case as a number would be more preferable as the units of the property definition could then be set to a length value and read as feet and inches.
If you heavily use property sets then at one time or another you have found the need to schedule a property that is not readily available via an automatic property definition. For example when creating a pipe system you can assign it a system family (commonly known as group) that will allow different systems of the same family to interconnect. Systems that are not of the same group will not interconnect. This could be a handy property to schedule but how do you do it? System group is not an automatic property of MEP objects.
First start the style manager and then open up the property set that you wish to add the system family definition to. The first thing that needs to be done is to add the automatic property definition ObjectID to the property set. This is needed to access information about the object. Then just add the following code to a formula based property definition:
Make sure to input [ObjectID] by clicking on the definition in the Insert Property Definition section in the lower left portion of the dialog window. Hit Ok and make sure to make your new property definition viewable so you can see it on the property palette’s extended tab.
In a heavily populated drawing you can accumulate alot of annotation tags and it can become quite difficult to see what they actually are attached to. You can easily display the link between the tag and the parent object by some simple Display Representation manipulation. Lets get started!
First we need to start the display manager by either typing DISPLAYMANAGER at the command line or by selecting it on the Manage tab of the ribbon. In the display manager expand the Sets node of the tree and scroll down until you come to the current active display set. This will be the text highlighted in bold. Select the active display set and in the right hand side select Anchor Tag to Entity and Anchor Extended Tag to Entity under the General Column as shown in the picture below. Press Ok to update the changes and you now have a drawing that shows the anchor relationships between tags and the objects they are attached to!
In our last post we added to the duct elevation tag by creating an option to include or not include the insulation thickness in the elevation value. This time we are going to add a manual property definition that will allow us to add a custom offset to each piece of duct. This time instead of adding an option to include or not include the offset in the elevation calculation we will instead always add the offset. By setting the value of the offset to 0′-0″ we can effectively turn off the option. So lets get started!
The first thing we need to do is add a manual property set definition called ElevationOffset to our ECCustomData property set. We should set its Type to Real and its default value to 0.0. This will effectively turn if off by default. The visibility box should be checked so we can type in the value of the offset on the property palette. Lastly we should set the order that the visible property set definitions will be displayed. By default they are always displayed in alphabetical order but by giving the property set definitions a numerical value we can change the order in which they are displayed. We are currently only displaying two property set definitions, ElevationOffset and ShowInsulationOnElevationTag. So it will be easy to find in a large list lets make sure that the ElevationOffset is at the bottom of the list. Number the BOD_Tag as 1, ShowInsulationOnElevationTag as 2, and the Offset as 3. Next we need to make sure that the format for ElevationOffset is set to Standard. Setting to anything else could possibly break our formula and the display of the elevation tag. The last thing we need to do to update our tag is to modify the calculation used to calculate the bottom of duct elevation. If you remember in part three we split the calculation into two separate parts. One with the insulation thickness and one without so we will need to subtract the offset to both of parts of the conditional statement. Yes, you did read that correctly, we need to subtract the offset from the elevation. We are subtracting the offset value because a negative offset (think of this as a negative change in floor height) will cause the duct to appear higher than its surrounding pieces. This means that we must subtract the value from the current elevation. Subtracting a negative value is the same as adding a positive value. If you remember your grade school math two negatives make a positive. The picture to the right shows the complete formula.
The hard stuff is now finished and the only thing left to do is to test our manual offset! to do this just select a piece of duct. You should now see a property set definition called ElevationOffset on the Extended Tab of the Property Palette. Inserting a numerical value will now adjust the elevation tag accordingly for the piece of duct.
Below is a video of the entire process that was described in today’s post.
In the next part of the series we will give the duct even more intelligence by giving it the ability to know where it is located in the project by using AEC Spaces. We will then be able to modify the elevation calculation to take its elevation from the bottom of the space. So if the space itself is lower than its surrounding spaces then the duct will know automatically and adjust its elevation accordingly with no input from the user.
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.
In our last post we looked at creating the calculations necessary to create a bottom of duct (BOD) elevation tag. In this post we are going to create the actual tag. We will create multiple versions of the tag that has a middle-left insertion point, middle-center insertion point, and a version with a middle-right insertion point. So lets get started.
The first thing that we need to do is create an mtext item to start our tag with. In order for the tag to display correctly with annotation scaling we need to create the text at 1″ tall and with annotation scaling turned OFF. This will insure that the tag will display correctly at all annotation scales. The tag itself will control the annotation scaling process so creating the text with annotation turn on will only compound the scaling. This is something that we do not want. Once we have added an mtext item we need to duplicate it for a total of 3 items and then set the justification for each of the three mtext items. One each for Middle-Left, Middle-Center, and Middle-Right.
Select the text with the Middle-Left justification and start the DEFINETAG command. This will bring up the Define Schedule Tag dialog box. Lets name our tag Aecb_Duct_BOD_Tag_Left. I like to create a naming scheme that is easy to follow. Looking at the tag we can see that it is a building systems tag for duct that defines the bottom of duct elevation and its insertion point is Left. A good naming scheme will allow you to select the correct tag using the property palette without referring to any additional documentation. Now that we have the Define Schedule Tag dialog up and named correctly we can create the tag. To do this select the Text in the Type column and change it to Property. This will allow our tag to read from a property definition instead of reading a static piece of text. Change the Property Set to ECDuctCustomData and choose the Property Definition to be BOD_Tag and then hit OK. We should now define the insertion point of the tag by selecting the insertion point of the text. Lets rinse and repeat for the Center tag and the Right tag making sure to change the name to reflect the justification of the tag.
Here is a video of the entire process.
In the next part of the series we will look at adding an option to show the bottom of insulation.
For my first post I thought that I would start a series of posts on how to create tags and more specifically an elevation tag for duct. The criteria for this tag will be that it needs the following abilities:
- Show bottom of duct elevation (BOD)
- Create the tag using a property set that is automatically attached to duct
- Show the bottom of duct elevation with or without insulation
- Show bottom of duct with or without an elevation offset
- Have the ability to tag a regular piece of duct or a locked piece of duct
- Have the ability to know if the bottom of duct elevation is below the ceiling elevation of an AEC Space
So now that we have a couple of criteria in place we can get started creating the tag. To find the BOD a couple of pieces of information about the duct will be required. In property set terms this information is called automatic properties and for duct the Z elevation is considered an automatic property. In other words, this property is supplied by the program automatically to any property set that wishes to use it. Unfortunately the elevation supplied is not the bottom of duct, it is instead the centerline elevation of the duct. So we will need to know the height of the duct to calculate the BOD elevation. Fortunately the height of a piece of duct is considered an automatic property and returns the depth of a rectangular piece, the minor of an oval piece, or the diameter of a round piece of duct.
So now that we have our two automatic properties we can get started creating our tag but first we need to decide in which property set to calculate our new BOD elevation tag. The ductobject property set supplied by Autodesk already contains our two automatic properties so we could just create the tag there but we want our property set to automatically be attached to each piece of duct and any property sets supplied by Autodesk out of the box do not have this functionality. We could use the ECDuctSystemData which is attached automatically when the DUCTSCHEDULEDATA command is ran or when the duct is set to be automatically broken into sections and tagged but this would not be a good idea. Any information in this property set can be changed or removed from release to release. Instead we will place our information inside of the ECDuctCustomData property set which acts exactly like ECDuctSystemData but will never be modified by EastCoast. This means that when the next release comes out we can be 100% confident that our property set will still work as intended. Since ECDuctCustomData is shipped completely empty we will need to add the automatic properties to it and once we do that we can get started creating our tag.
To add the automatic properties to ECDuctCustomData we need to start the stylemanager and navigate to the property set section. A shortcut for to get to this section is to just type the command PROPERTYSETDEFINE at the command line. This will bring up the property set manager as shown below where we can add our two automatic properties. Since this is the first time we have added anything to ECDuctCustomData it will be empty.
To add an automatic property we just need to select the automatic property button as shown in the picture to the right. This will bring up a dialog where we can select LocationZ. We then need to create another automatic property and select Height. Once we have these two automatic properties created we can start to create our formula to calculate the BOD elevation. To do this we will need to create a formula property definition. The button for this can be found immediately below the automatic property button. This will bring up a dialog similar to the one shown below. As shown in the picture I named the formula BOD_Calculation and I have already entered in the formula to calculate the bottom of duct elevation. ([LocationZ] – [Height]/2). Anywhere you see an item enclosed in brackets you should not type in the value but instead choose it from the list in the Insert Property Definitions: section. In the Enter Sample Values: section make sure that the format is set to standard for each entry.
Why did we set the format to standard? We really want the elevation to display in an architectural format so why didnt we set it here? Well the answer is that this is not the property that we are going to read with our tag. This property is just being used to calculate our elevation. We will format the elevation correctly in our next property which we will call BOD_Tag. This should also be a formula property set and in this case we will name it BOD_Tag. Enter in the formula “BOD: [BOD_Calculation]” this time typing in “BOD: ” and then selecting BOD_Calculation from the list under ECDuctCustomData. Make sure to set the format correctly this time to Unit-Distance Feet Inches – No Comma.
One last thing to do today is to look at all of the properties of ECDuctCustomData and turn off the visibility of all property definitions except for BOD_Tag. This will insure that the only property definition that will show on the property palette will be just the one we are interested in. Below is a video of the entire process.
In Part Two we will show how to create the actual tag itself and save it in the correct style drawing.
Welcome to “The Contractors Guide to Autocad MEP”, a blog dedicated to contractors working with Autocad MEP and the EastCoast Cad/Cam software plugin. I’ll be using this blog to share information about Autocad MEP and the EastCoast software. You should expect to see tutorials on how to use both pieces of software plus additional tutorials on using other pieces of EastCoast software.
A little about myself… I have worked with software my entire life and have spent time studying computer science, working as an electrician for over a decade, and more recently working with Autocad MEP and the EastCoast plugin.
If you have suggestions for interesting topics to cover in this blog, please feel free to contact me at firstname.lastname@example.org. Neither my blog nor my email account should be considered channels for receiving support, however, and I make no guarantees that I will be able to address topics that are proposed. But please do feel free to drop me a line.