Exercise 1: Creating an Expression

In this exercise, you will create an expression that calculates the magnetic compass direction of an alignment at each geometry point.

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. For example, you could subtract a value from a point elevation, and display that number along side the actual elevation in a point label.

Create an expression

    Note:

    This exercise uses Labels-5c.dwg with the modifications you made in the previous exercise, or you can open Labels-6a.dwg from the tutorials drawings folder.

  1. Zoom and pan to the area between stations 0+000 and 0+100 of the Main Street alignment.
  2. Click the PC: 0+035.99 label to select all geometry point labels. Right-click. Click Properties.
  3. On the Properties palette, in the Geometry Point Label Style list, select Additional Details.

    This label style displays geometry points, design speed, and true compass direction at the geometry point. In the next few steps, you will create an expression to calculate the magnetic direction. You will add this expression to the geometry point label in Exercise 2: Inserting an Expression Into a Label Style.

  4. In Toolspace, on the Settings tab, expand AlignmentLabel StylesStationGeometry Point. Right-click the Expressions node. Click New.
  5. In the New Expression dialog box, specify the following parameters:
    • Name: Magnetic Direction
    • Description: Converts true to magnetic for declination -15.5 degrees.
  6. Click Insert Property. Click Instantaneous Direction.

    This property will be used as the basis for computing the magnetic direction.

  7. In the New Expression dialog box, in the Expression field, use the keypad to enter -(15.5*(2*pi/360)) .
    Note:

    Use the button to enter pi.

    The completed equation looks like this:

    {Instantaneous Direction}-(15.5*(2*pi/360))

    The expression includes a conversion from degrees to radians because Autodesk Civil 3D uses radians for all internal angle calculations. The value used for declination of magnetic North (-15.5 degrees) is just an example. To be accurate, this must match the current value, subject to geographical location and gradual changes over time.

  8. In the Format Result As list, select Direction.
  9. Click OK.

    In Toolspace, on the Settings tab, appears next to the Expressions node, and the new expression appears in the list view.

To continue this tutorial, go to Exercise 2: Inserting an Expression Into a Label Style.