A while back a client requested a line bearing and distance label that would automatically adjust to the length of the line. Below are some examples of a double component (bearing and distance) labels:
- TOP: Centered, with inside bottom right and bottom left as attachment points.
- MIDDLE: Dynamically spaced, with inside bottom right and bottom left as attachment points
- BOTTOM: On endpoints, with outside bottom left and bottom right as attachment points.
There are many ways of achieving the look of the middle label (#2 shown), as is the case with most AutoCAD tasks. Here two (2) expressions were created to shift positive (right) and negative (left). They are then used to slide the Bearing and Distance annotations.
The Expressions:
Simple mathematical expression with a spin. The Overall Length value of line is divided by a user-dictated value, in this case 1/6th of the total line length was used. There is a special trick, because Civil 3D will want to scale the distance up by the drawing scale, the initial calculation will have to be divided by the Drawing Scale Conversion factor.
Positive Offset:
The created Expression is the “length/6” then shrunk by the scale factor
Negative Offset:
The created Expression is the “length/6” then shrunk by the scale factor, and multiplied by -1
The Labels
The created expressions are then applied to the label components to cause the dynamic sliding of the annotations:
BEARING: the connection point is the default middle of the line, then attached by the Bottom right, with an X Offset shift that used the Spacer Neg value (shift left).
DISTANCE: the connection point is the default middle of the line, then attached by the Bottom left, with an X Offset shift that used the Spacer value (shift right).
The simple goal of a line label that automatically spaces itself to 1/6 of the total line length is achieved.
About the Author
More Content by Leo Lavayen