# Thread: Upredictable Dimension rounding of 0.5 dims

1. ## Upredictable Dimension rounding of 0.5 dims

Registered forum members do not see this ad.

Hello.

two lines dimensioned
- one 8.5 and the other 7.5.
- both returning 8 on the drawing if dimrnd set to 1 and 8.5 and 7.5 if dimrnd set to 0.5.

This is screwing up a lisp I have tried to write as I can't predict which side of the 0.5 will be shown on a drawing.

Any thoughts would be appreciated.

Thanks.
Martin

2. ...still uncertain about which side to predict or why so would appreciate any insight but I may have found an answer for the lisp in the vla-get-PrimaryUnitsPrecision (= 8 ) . haa - no I haven't - it was coincidence that it equalled 8. so still at a loss

cheers
martin

3. Could you not just set dimrnd to 0 in the LISP?

4. hi lee. thanks for responding. I am home now so hard to check what dimrnd 0 will give me (if it is zero rounding - ie what is extracted from (42 . xxx) then nah that won't work.

I guess I should explain what I am trying to achieve.

So there is an item to be dimensioned with holes in it say.

The overall dimension is drawn with dimlinear (say) and so are all the sub dimensions.

Sometimes, due to rounding of each individual sub dimension, these do not add up as they should. Eg if you add 4.4 and 4.4, the overall dim would be 9 but the sub dims would be 4 and 4.

The lisp goes through and extracts the 42 entity values of all the sub dims and adds them together. This will give the exact answer (and the rounding of this will equal the overall) but also the routine provides a second solution where it rounds the sub dims before it adds them up. Routine is just a checking tool.

I thought that this would be all good because the rounded value is consistent with what is seen on the sub dim, but in the case where the dim is exactly mid integer, eg 4.5 or 10.5 etc, there is no way to predict which side acad will choose to display - hence my problem.

Sorry for the extended explanation but hopefully that gives an idea of the application.

cheers
martin

5. I can understand your problem.

I would initially consider emulating the ACAD rounding using a function similar to this:

Code:
```(defun round (num)
(if (<= 0.5 (rem num 1))
(fix (1+ num))
(fix num)))```
But, if you say the ACAD rounding is "random" then I am not sure what you are going to do.

6. yeah, I have used basically exactly the same function as you posted above. thanks again though - will just have to use the calculator.

7. Registered forum members do not see this ad.

Originally Posted by MartinSomerville
yeah, I have used basically exactly the same function as you posted above. thanks again though - will just have to use the calculator.
Sorry I can't help more - I don't fully understand why AutoCAD would act in this way..

#### Posting Permissions

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