Skip to main content

Express Yourself: Using Expressions in Civil 3D


Expressions in Civil 3D have been around since the beginning of time……Civil 3D time!  However, I don’t think people utilize expressions to their full capabilities, or even at all.  I’ve heard of some pretty cool ways people are using expressions to label and analyze their models in Civil 3D and thought I’d share a few.

This article helps walk through setting up a couple expressions, starting with simple mathematical formulas to more advanced analysis expressions.

About Expressions

Expressions are stored in the Settings tree, within the label style type folders. They are not available for label style types that do not have relevant properties, such as Note label styles.  But for the most part, they are available in every type of label such as surface, alignment, profile, etc.

You insert expressions into label styles using the Text Component Editor when you are editing a label style text component.

Insert expressions in Civil 3D from Autodesk

Expressions make use of the same properties that you can add to label styles, such as Point Elevation, Northing, and Easting. By using expressions, you can set up separate mathematical formulas using the existing properties. There are two main portions to creating an expression.  You will find these in the New Expression dialog box.

Insert Property

Inserts a property into the expression. Click the icon to display a list of properties relevant to the expression type. Select a property to insert it into the expression. These are the same properties that are available for label styles.

Properties are inserted inside brackets. Do not add operators or functions within these brackets.

Insert Function

Inserts a function into the expression. Such as IF(test,true_val,false_val), ROUNDUP(x,y), etc

For example, you could subtract a value from a point elevation, and display that number alongside the actual elevation in a point label.  Let’s create that example.


Creating a Simple Expression

For this first expression, we will keep it very simple.  In this example, we will create a label for a parking lot, using a spot elevation we will label the LIP of gutter, but within the same label, have it label the TBC (Top Back of Curb) with an elevation difference of 0.33’ (or 0.17’ for shed curb).  Let’s get started:

1.       Go to your SETTING tab, expand surface, label styles and Spot Elevation.
2.       Right click on Expressions and select NEW

Creating simple expressions in Civil 3D from Autodesk


3.       Name your expression “Capture Curb - LIP / TBC”.
4.       Give your expression a description.  I like using descriptions here so that end users, other than the expression creator, can understand the intention of the expression.
5.       At the bottom of the New expression dialog box, change the Format result as to ELEVATION
6.       In the Expression Editor box, select SURFACE ELEVATION from the INSERT PROPERTY drop down.
7.        After you insert that property, type in (or select from the dialog box) +0.33. 
8.       Select OK to accept and save your expression.

Creating a new expression in Civil 3D from Autodesk


9.       Let’s now add this to a Spot Elevation label style, and label our surface.  Create a new Spot Elevation style called “Elev Label - Capture Curb + LIP”
10.    In the label style, we will have two text components, one for our main surface spot we wish to label (LIP) and the other that will reference our expression (TBC)
11.    In the Text Component Editor Properties, you will now see your expression, add that to the new component.
12.    Properly compose your label as shown in FIG05.

Text component editor in Civil 3D from Autodesk




13.    Now use the ADD LABELS dialog box to add the newly created label to a few spots.  You can now see that by labeling the one spot, the mathematical equation we setup in the expression will then add the 0.33’ we specified.

Adding labels in Civil 3D from Autodesk


Now let’s try some more advanced expressions!

Expression for Cut / Fill Text

Another useful example for expressions is to use them to aid in labeling cut vs. fill labels in a volume surface.  For example, you may want to display your CUT in red, and you FILL in blue.  To do so, we will setup a couple quick expressions.

1.       First, ensure you have a VOLUME surface created.  This goes without explain, but thought I would mention it anyway!
2.       Create two expressions, one for the Cut Text height and one for the Fill Text height.
3.       Name this first expression Cut-Text. Use this as the expression:
a.       IF({Surface Elevation}<0,0.10/12,0.00000001)
4.       Name this second expression Fill-Text. Use this as the expression:
a.       IF({Surface Elevation}<=0,0.12/12,0.00000001)

What we are doing here, is creating a super small text that will NOT show up once we place our labels.  These expressions are slightly different, we won’t use these in our label composer, but we will use these to adjust the text height and differentiate Cut v. Fill.

5.       Create a label style that has 2 components, Cut and Fill text.  These components reference the Surface Elevation, but in the text height property, you will set the corresponding expression (Cut/Fill).
6.       Change the CUT component color to RED.
7.       Change the FILL component to BLUE.

Label Style Composer in Civil 3D in Autodesk


8.       Test this out by using your new label style to label a surface!!

Use label style to labe a surface in Civil 3D!


Expression for Pipe Calculations

Want to have dynamic flow rates or velocities for your gravity networks?  One way to do so is to create an expression utilizing the Manning’s equation to get the flow rate (Q) and the flow velocity (V)

The expression for Q for feet drawings is:

1.486*pi*((({Start Crown Elevation}-{Start Invert Elevation})/2)^2)*(1/{Manning Coefficient})*((({Start Crown Elevation}-{Start Invert Elevation})/4)^(2/3))*(SQRT({Pipe Slope}))

Once we have completed the expression for Q, we can create the expression for V (or other calcs):

Q/(pi*({Inner Pipe Diameter}/2)^2)

Time in Pipe could be another necessary calculation:

{2D Length - To Inside Edges}/Velocity/60

Misc. Expressions

Here are a few others I’ve used in Civil 3D.

Truncate your elevations.  An example of this is displaying an elevation of 132.67 as 32.67:
·         {Surface Elevation}-100*TRUNC({Surface Elevation}/100)

2 Point Slope Arrow – Arrow always pointing downhill
·         IF({Surface Slope} <= 0, 0, pi)
·         This expression gets applied to the Rotation Angle of the direction arrow component.

Truncate your elevations in Civil 3D expressions from Autodesk


Pipe True Slope
·         ({Start Invert Elevation}-{End Invert Elevation})/{2D Length - To Inside Edges}

Length in Meter – Display both (any object)
·         {Segment Length} *.3084

Slope Distance AND Horizontal Distance in a label (Use on lines, polylines, figures and feature lines)
·         SQRT({General Segment Length}^2-(ABS({General Segment Start Z}-{General Segment End Z})^2))

Conclusion

There are many…MANY expressions you can create within Civil 3D. Hopefully this helps get the brain going and thinking about how you can further increase your productivity by testing the limits of label styles and expression composition.

As always, I am interested to hear what you think and see how we can improve upon this topic.  If you have some crazy cool expressions, I’d love to see them in action, shoot me an email or connect with me on LinkedIn.

Good luck and EXPRESS YOURSELF!!

- Shawn Herring

Comments

Popular posts from this blog

Door & Window Schedules/Type Elevations - Revit 2014

Creating Door & Window Type Elevations - Revit 2014
This blog post is intended to provide a short workflow detailing how to create "Door Type Elevations" which are typical on a sheet with corresponding schedules.  They typically provide the contractor quick information as to the look and type of door.
I've commonly seen architects and BIM modelers creating elevation views of a door. These elevation views not only show the door, but also the surrounding walls and other elements. After creating this view, it is required to then adjust the boundary to only show the door.  The problem with this approach is that it is not only tedious, but if the door happens to move or get deleted all together, then the view must be updated. Let's look at a more efficient way of doing this and the process involved.
Creating the Door & Window Type Elevation:
Use Legends to create these elevations. This process makes use of the Legend Tools under the View Menu-->Create Tab.  Click …

Uninstall Multiple Autodesk Products Quickly and Easily

If you have ever tried to uninstall an Autodesk Suite, you have probably noticed there are dozens of different products, all installed separately, they all installed together but where is the button to uninstall them all together? Unfortunately, there is not one! If you have ever sat at your desk, uninstalling each program one by one, keep reading this will save you alot of time!
I have put together a simple script using the windows utility WMIC to easily remove all Autodesk applications! Running this script will remove any and ALL Autodesk applications!  To run this script you need to first open a cmd shell, in order for this to run properly, it must be run with elevated permissions. To do this click start -> all programs -> accessories -> Right click on 'command prompt' and choose 'Run as Administrator'.  In the CMD window that will open type 'wmic', then hit enter. This will enter the wmic utility. Your command window should now look like this:
Next…

Revit Schedules with Graphic Yes/ No Parameters

You've probably seen what happens to your Yes/ No parameters when you place your schedule on a sheet. Revit automatically replaces the check mark with text.

Have you ever wanted to maintain a graphic representation in that Yes/ No column?  Well, you can with a little workaround.  You just need to create a new "Calculated Value" parameter in your schedule and fill out the formula with a simple IF() statement.  

The syntax should read:
if(*test*, *YES*, *No*)
Where *test* is the name of your actual Yes/ No parameter (choose this through the ellipses button)
and *YES* is the symbol you want to show if yes
and *NO* is the symbol you want so show if no

The symbols can be copied from the Windows Character Map.  Take care to use the same font that your schedule body uses or it will not show you the character you thought it would.

Use the "Copy" button inside the character map and inside the "Calculated Value" dialog box, use the keyboard shortcut "Ctl+V&q…