+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Posts
    44

    Default 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. #2
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Posts
    44

    Default

    ...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. #3
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,835

    Default

    Could you not just set dimrnd to 0 in the LISP?
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  4. #4
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Posts
    44

    Default

    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. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,835

    Default

    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.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  6. #6
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Posts
    44

    Default

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

  7. #7
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,835

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by MartinSomerville View Post
    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..
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Dimension rounding off
    By chrisdarmanin in forum AutoCAD General
    Replies: 4
    Last Post: 20th Jun 2008, 07:48 am
  2. rounding up only...
    By swazi.71 in forum AutoCAD General
    Replies: 1
    Last Post: 29th May 2008, 04:54 am
  3. Dimension standards question (annotative dims)
    By RingSteel in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 1
    Last Post: 8th Apr 2008, 04:45 pm
  4. Replies: 7
    Last Post: 5th Feb 2008, 08:37 am
  5. Rounding edges
    By marinebro0306 in forum AutoCAD 3D Modelling & Rendering
    Replies: 6
    Last Post: 18th Aug 2006, 05:48 pm

Bookmarks

Posting Permissions

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