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
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
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
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.
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?
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
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.
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.
@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.
Thanks Jeff,
Changing the expression to use ROUND instead of TRUNC did the trick!