Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Drop trailing zeros for station offset label style.

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
dmassingale
1439 Views, 9 Replies

Drop trailing zeros for station offset label style.

I am trying to create a station-offset label style that will drop the trailing zeros in the offset section - e.g. 15' instead of 15.00', but if the offset is not at a whole number, e.g. 15.01, etc.  it will display the entire offset.

 

I created two expressions:  IF(OFFSET-TRUNC(OFFSET)=0,.1/12,.00000001/12)

and this one:  IF(OFFSET-TRUNC(OFFSET)!=0,.1/12,.00000001/12)

 

I then created two offset components, one called truncated, and one called full, and assigned the heights to match the expressions. I'm not sure what I'm doing wrong.

 

I have attached the file if anyone cares to take a look, the style is ACHD-Sta Off-Rt [copy]

 

Thanks,

 

Dave

C3D 2011, Win x64

9 REPLIES 9
Message 2 of 10
Jeff_M
in reply to: dmassingale

These expressions seem to do the trick. Note that you were seeing if the result = 0, but most points will never be an exact 15.00 offset so that test will fail (think Autocad uses 15 significant digits, and due to limitations in the computer even a seemingly exact number may be 15.0000000000000002 to the PC.

 

IF(ABS(Offset-TRUNC(Offset))<=0.005,.1/12,.00000001) - TRUNCOFF

IF(ABS(Offset-TRUNC(Offset))>0.005,.1/12,.00000001) - FULLOFF

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 10
tcorey
in reply to: dmassingale

Yes, it's strange that you can "Drop decimal for whole numbers" when you use the Station property, but Offset doesn't offer that option. I will be interested to see if someone has found a solution as this has vexed me in the past.

 

It's an extra, aggravating step, but I place all labels with precision 2, then manually change the ones that are xxx.00 to a style that is precision 0. It gets the job done, but it's a workaround for a feature that should be available.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 4 of 10
dmassingale
in reply to: Jeff_M

I tried your suggestion, and at first it seemed to work.  However, I tried offsetting the alignment an even distance, and the label displays the full offset value, even though it's clearly within the tolerance (or should be) of the truncated offset value.

 

Any ideas?

Message 5 of 10
Jeff_M
in reply to: dmassingale

Not sure why it's not working for you, it looks good in this image. I'll attach the dwg file and you can compare with your draing.

5-15-2012 6-07-18 AM.png

Jeff_M, also a frequent Swamper
EESignature
Message 6 of 10
Anonymous
in reply to: Jeff_M

Jeff,

 

Thanks for helping me with this problem.  I downloaded the file you attached, and tried out the label style.  It works great on the alignment that you made, but not mine.  I promoted my alignment and tried the style out on it.  I attached my the file you sent me.  Take a look at the East-West alignment.  It worked on the north side, but not the south - so weird.  I have sent this file on to Autodesk to see if they can give me some help as well.

 

Thanks again

 

Dave

Message 7 of 10
Jeff_M
in reply to: Anonymous

If you change the the expressions to ROUND instead of TRUNC it seems to work ok. The problem with TRUNC is as I mentioned before...if you offset an alignment by 15, due to math errors imposed by the computer, C3D may be seeing the offset as 14.999999999999999 which is truncated to 14. So 15-14 fails the test. ROUND, however, will return 15, so 15-15 does pass the test.

Jeff_M, also a frequent Swamper
EESignature
Message 8 of 10
tcorey
in reply to: Anonymous

Great solution Dave and Jeff.

 

My only question is, why don't you just set the return value for false to 0.0. What's the point of having that tiny dot of text?

 

It's too bad you can't return True or False and then assign the Visiblity of the Component to the value of the Expression.

 

 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 9 of 10
Jeff_M
in reply to: tcorey


@tcorey wrote:

Great solution Dave and Jeff.

 

My only question is, why don't you just set the return value for false to 0.0. What's the point of having that tiny dot of text?

 

It's too bad you can't return True or False and then assign the Visiblity of the Component to the value of the Expression.

 

 


I agree about the True/False wish. The small value for the text is because at one time C3D didn't like having a 0 value for the textheight, so it's just what I (and others) have always done. I just tested in 2012 and it seems to be OK with a 0 value....good to know.

Jeff_M, also a frequent Swamper
EESignature
Message 10 of 10
dmassingale
in reply to: Jeff_M

Thanks Jeff,

 

Changing the expression to use ROUND instead of TRUNC did the trick!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report