AutoCAD Civil 3D General Discussion

Reply
New Member
mzaman29
Posts: 2
Registered: ‎09-27-2013
Message 1 of 8 (172 Views)

Roundup Pipe lengths in Labels to nearest 6 inch intervals in Civil 3D

172 Views, 7 Replies
09-27-2013 08:31 AM

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,

 

*Expert Elite*
TRogers
Posts: 1,247
Registered: ‎09-05-2007
Message 2 of 8 (170 Views)

Re: Roundup Pipe lengths in Labels to nearest 6 inch intervals in Civil 3D

09-27-2013 08:50 AM in reply to: mzaman29

In the label style, I think if you truncate it, it will round it.

If the issue was resolved by this method, please click on "Accept As Solution"
*Civil 3DJ*
Todd Rogers

Visit my blog here.

     
New Member
mzaman29
Posts: 2
Registered: ‎09-27-2013
Message 3 of 8 (153 Views)

Re: Roundup Pipe lengths in Labels to nearest 6 inch intervals in Civil 3D

09-27-2013 10:24 AM in reply to: TRogers
I already tried truncate but it's not working.
*Expert Elite*
troma
Posts: 2,519
Registered: ‎05-21-2008
Message 4 of 8 (149 Views)

Re: Roundup Pipe lengths in Labels to nearest 6 inch intervals in Civil 3D

09-27-2013 10:26 AM in reply to: mzaman29
Might have to use an expression.

What does truncate do, exactly?


Credit where credit is due! Give kudos or accept as solution whenever you can.

*Expert Elite*
TRogers
Posts: 1,247
Registered: ‎09-05-2007
Message 5 of 8 (142 Views)

Re: Roundup Pipe lengths in Labels to nearest 6 inch intervals in Civil 3D

09-27-2013 10:48 AM in reply to: troma

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

If the issue was resolved by this method, please click on "Accept As Solution"
*Civil 3DJ*
Todd Rogers

Visit my blog here.

     
*Expert Elite*
BrianHailey
Posts: 2,749
Registered: ‎04-27-2005
Message 6 of 8 (124 Views)

Re: Roundup Pipe lengths in Labels to nearest 6 inch intervals in Civil 3D

09-27-2013 03:32 PM in reply to: mzaman29

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

 

*Expert Elite*
TRogers
Posts: 1,247
Registered: ‎09-05-2007
Message 7 of 8 (120 Views)

Re: Roundup Pipe lengths in Labels to nearest 6 inch intervals in Civil 3D

09-27-2013 03:42 PM in reply to: mzaman29
Well that's not confusing. Thanks for the clarification in the truncating though.
If the issue was resolved by this method, please click on "Accept As Solution"
*Civil 3DJ*
Todd Rogers

Visit my blog here.

     
*Expert Elite*
BrianHailey
Posts: 2,749
Registered: ‎04-27-2005
Message 8 of 8 (115 Views)

Re: Roundup Pipe lengths in Labels to nearest 6 inch intervals in Civil 3D

09-27-2013 03:46 PM in reply to: BrianHailey

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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Civil 3D Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for AutoCAD Civil 3D helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Civil 3D

Twitter

Facebook

Blogs