Back

Civil 3D Labels: Express Yourself with Expressions!

One of my favorite things about Civil 3D are the dynamic labels.  Once upon a time, you had to manually label every contour, every pipe, every road, every structure in plan view and profile view.  Even scarier, you had to remember to revise those labels in plan view AND profile view if something changed.  Fortunately, things don’t change very often in our industry. Right?

Wrong! Design is fluid and changing constantly. Civil 3D label styles allow the labels to change with the design dynamically.

Creating expressions to use in your C3D label styles is a fun way to customize your labels. I will demonstrate how to use expressions to change the size of text depending on the viewport scale, to only show certain labels based on the viewport scale, and to label pressure part inverts.

Where are Expressions created and stored?

Expressions for each label style are located in the Settings tab of the Toolspace under each Label Style that allows expressions. Figure #1 below shows the Expressions location for Surface Contour Labels.

Figure 1

What makes up an Expression?

Figure #2 shows the New Expression dialog box.

Figure 2: New Expression Dialog Box

A Civil 3D label expression is created using some or all of the following components:

  • Feature Property (added using the Insert Property button outlined in blue). These are the properties associated with the feature type such as Surface Elevation for surfaces or Alignment Name for alignments.
  • Function (added using the Insert Function button outlined in red). There is a comprehensive selection of mathematical, logical, and other types of functions.
  • Operators (outlined in green).

Expression Example #1

Let’s create an expression to change the size of text depending on the scale of the viewport and then use the expression in a label style.

One example where this may come in handy is for surface contour labels.  At 50 scale, a standard text height of 0.10 might be fine, but at 100 scale, that standard text height might create overwrites.

Figure 3: Surface contour labels at 1”=50’

Figure 4: Surface contour labels at 1”=100’

Step 1: Define the Expression’s Purpose

Expression purpose: If the viewport scale is 1” = 100’ or greater, the text height should be 0.08.  If the viewport scale is less than 1” = 100’, the text height should be 0.10.

Step 2: Create the Expression

1. Open the New Expression dialog box.

  • Right click on the Expressions setting for Surface Label Contours. (See Figures #5 & #6 below).

Figure 5

Figure 6

  • Click “New” to bring up the New Expression dialog box.

Figure 7

2. Assign a name and fill out the description (optional) of the expression as shown in Figure #7.

3. Create expression.

  • Click on the Insert Function button  to reveal the list of functions and choose the IF function.

Figure 8

  • The Expression Editor populates with the function.

Figure 9

  • Click on the Insert Property button  to reveal the list of properties for this feature. Choose “Drawing Scale Conversion”.

Figure 10

  • Drawing Scale Conversion = Viewport Scale*12
  • Create the expression shown in Figure #11.

Figure 11

Hit OK on the New Expression dialog box to finalize the expression and to add it to Toolspace.

Figure 12

  • The expression has been added and appears at the bottom of Toolspace.

Figure 13

Step 3: Understanding the Expression

Remember our original expression purpose?

If the viewport scale is 1” = 100’ or greater, the text height should be 0.08.  If the viewport scale is less than 1” = 100’, the text height should be 0.10.

  • Here is our expression:

IF ({Drawing Scale Conversion}>1100,0.08/12,0.10/12)

Translation:  If the viewport scale is 1” = 100’ or greater, then the label text height will be 0.08. If the viewport scale is NOT 1” = 100’ or greater, then the label text height will be 0.10.

Figure 14

Step 4: Use the Expression in a Label Style

1. Create a new Surface Contour label style or copy an existing Surface Contour label style in the Settings tab of the Workspace.

Figure 15

2. On the layout tab, click the value for Text Height. There is now a drop-down menu since we have added the expression. On the drop-down menu, select the expression name you just created.

Figure 16

Figure 17

3. Hit OK on the Label Style Composer.

4. Apply the new Surface Contour Label Style to your surface contour labels.

Figures #18 and #19 show the same area at 1” = 100’.  Figure #18 uses the original text height of 0.10. Figure #19 uses the new expression to change the text height for 1” = 100’ to 0.08.

Figure 18: Text height of 0.10.

Figure 19: Text height of 0.08 from expression.

Other Expression Ideas

Here are a few other ideas for expressions to get you started.

1. Create an expression that shows only major contour labels (for 1’ & 5’ or 2’ & 10’ minor and major intervals).

a. Expression purpose:

Only major contour labels appear.

b. Expression:

IF (FMOD ({Surface Elevation},5) = 0,0.10/12,0)

c. Understanding the expression:

If the Surface Elevation divided by 5 yields a remainder of 0, then the text height should be 0.10. If the Surface Elevation divided by 5 yields a remainder other than 0, then the text height should be 0.

Therefore, 5’ and 10’ contour labels will have a text height of 0.10 while 1’ and 2’ contour labels will have a text height of 0 so they will not show.

You might wonder why bother? You can set it in the properties to not show the minor contour labels. But what if you wanted to see the minor contour labels in 50 scale but not 100 scale?

See if you can combine the two expressions we have covered to create an expression that shows only major contour labels for drawings with a viewport scale of 1” = 100’ or greater.

2. Create an expression to label the invert of pressure network fittings.

a. Expression purpose:

Label pressure network fitting invert. An expression is necessary because Civil 3D only gives the insertion point elevation which is the vertical center of the fitting.

b. Expression: Must create a separate expression for each pipe diameter.

Expression Name:  INV-12”

{Insertion Point Elevation}-0.5

Expression Name: INV-6”

{Insertion Point Elevation}-0.25

Conclusion

The power of Civil 3D is not just in its design, but also its ability to help us create the documentation of that design which is where Civil 3D labels come into play. There are many tools available in Civil 3D to enable you to leverage your labels to be more knowledgeable, more efficient, and more informative. The use of expressions is just one of those tools.

Can you think of other expressions you could create? I would ask yourself first, “What information do I want in my label?” Then explore expressions to see if you find an answer there. If you don’t, move onto the next tool in your labeling arsenal.

Have fun expressing yourself!

Appears in these Categories

Back