# Thread: Using block's x-coordinate to get station

1. ## Using block's x-coordinate to get station

I currently have my elevation view set up so that the x-coordinates correspond to the stationing along my structure and the y-coordinate corresponds to the elevations. I have a block that will insert the y-coordinate as it should. However, the x-coordinate requires some formatting so that it is shown properly (e.g. "10+00").

I have an attribute equal to a the x-coordinate divided by 100 with the precision changed to 0. So, if my point is 1016.123, the formula converts that to 10. This field is followed by a plus sign and then another field. This last field is equal to the x-coordinate minus the x-coordinate converted as before, then times 100. The purpose being that if my x-coordinate is 1016.123, I would get 16.123 and my block attribute would reflect 10+16.123. The problem is that AutoCAD retains all of the x-coordinate's precision when subtracting and I end up with a result of 0. See attached for clarity - I know this last bit is hard to understand if you can actually see what's going on.

I understand that I could subtract out 1000, but when my stationing is beyond 20+00, I will only be subtracting 1000 and my result will not be correct.

Do any of you have another solution?

Thanks!

2. ## Re: Using block's x-coordinate to get station

Sorry, it seems this is one of those "problems" with fields. They always use the floating point value (even if only displaying the integer). And unfortunately they don't have the mod operator (like Excel has), so you can't get a formula like this:
Code:
`mod(<Field Value 1>, 100)`
Which would return 23.456 from 123785684234786324723.456 ... no matter how many digits to the left.

Edit: Just found out that there is something like the round / trunc functions though. See attached.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•