Jump to content

Upredictable Dimension rounding of 0.5 dims


MartinSomerville

Recommended Posts

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

Link to comment
Share on other sites

...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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

I can understand your problem.

 

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

 

(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. :(

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.. :geek:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...