A question came up today from our Pittsburg branch:

*“How can I make Civil 3D round spot elevations to the nearest five-hundredths of a foot (0.05’)?”*

I knew creating an **EXPRESSION** was the answer but I just didn’t know how to accomplish this task. So after putting my *noodle* on the solution over the afternoon – from time-to-time when I needed a break from real work – I came up with the final expression around dinner.

Learn more after the jump…

To understand what I’m talking about look at the below image. The spots in CYAN are everyday Civil 3D spot elevations with the precision out to the nearest ten-thousandths of a foot. The spots in MAGENTA use the below expression to round the elevations to the nearest **five-hundredths** of a foot (0.05’)!

The expression:

IF(({Surface Elevation}*10-TRUNC({Surface Elevation}*10))>=0.75,(ROUND({Surface Elevation}*10))/10,(TRUNC({Surface Elevation}*10))/10)+((IF({Surface Elevation}*10-TRUNC({Surface Elevation}*10)<0.5,IF({Surface Elevation}*10-TRUNC({Surface Elevation}*10)<0.25,0.0,0.5),IF({Surface Elevation}*10-TRUNC({Surface Elevation}*10)>=0.75,0.0,0.5)))/10)

OR

**ROUND(({Surface Elevation}/0.05))*0.05**

for a more **elegant** solution *(learned after this post. Don’t I feel silly, takes the wind right out of your sail ya know. ;) )*

Anyways, with this little beauty you can avoid spot elevations that read **100.99**, **100.51, 100.01**, and **100.74**. Using the expression they will round to **101.00**, **100.50**, **100.00**, and **100.75**, respectively. 🙂

A label style using this expression can be found HERE to drag into your company template. Yes, the style uses the more elegant solution.

Thanks, and I hope this helps!

Absolutely Phenomenal! Brilliant I say Brilliant!!!

Great solution.

Any ideas on how this could be incorporated in a structure label expression to fix rounding errors between the pipe network station and alignment station?

I have never noticed rounding errors. Could you email an example?

The great Dave Garrigues everyone!

Dave can I have your autograph. I loved Caffeinated Grading; all of them.

Ha! As long as the proceeds goto a charity. You know that is how I roll.

Nice solution. Elegant and useful, too!