When labeling pipes in a pipe network; is there a way or expression to roundup the label to 6 inch interval. For example, if I have a pipe length of 2.6 feet, I want to roundup this to 3.0 feet and if I have a pipe length of 2.4 feet, I want to roundup this to 2.5 feet.
If anyone can help me with, I would really appreciate.
Thanks,
In the label style, I think if you truncate it, it will round it.
Truncate is supposed to round the numbers.
However, here is a blog about creating an expression to round the numbers...
http://ontariocivil3d.blogspot.com/2011/02/civil-3d-label-styles-using-expressions.html
Truncate will drop the decimal, not round it.
trunc(1.1)=1.0
trunc(1.9)=1.0
trunc(-1.9)=-1.0
Ceiling returns the next highest integer.
ceil(1.1)=2.0
ceil(1.9)=2.0
ceil(-1.9)=-1.0
Floor returns the next lowest integer.
floor(1.1)=1.0
floor(1.9)=1.0
floor(-1.9)=-2.0
In your case, you want the next largest half number so your expression will look like this:
CEIL({2D Length - Center to Center}*2)/2
1.4 becomes 2.8 becomes 3.0 becomes 1.5
1.6 becomes 3.2 becomes 4.0 becomes 2.0
You have to be careful. If you have two labels for the same length, you might end up with some odd results. If the length is 110.04 and you label it out to the tens place with and without the expressions, you'll see:
110.0 without the expression
110.5 with the expression
If this is important, you can do more in the epxression to account for this.