Results 1 to 8 of 8

Thread: Engineering Notation in DXF Codes

  1. #1
    Member
    Join Date
    2009-12
    Posts
    6
    Login to Give a bone
    0

    Question Engineering Notation in DXF Codes

    Hi Everybody,

    I know I this is a dumb question, but please help me anyway..... :^)

    I am trying write a lisp to get the distance betweem two AECC_points by picking the point number entity (they used to be attributes, don't know what they are now, as I'm new to LDD).

    When I extract the dxf codes for the AECC_points I get, for example:

    for assoc 11:
    (429707.0 2.09055e+006 -1.0e+020)

    when I check the distance (distance a b) between two entities I get:
    1.0e+020

    I checked DDunits, and everything's A-ok. (Linear units set to decimal, not engineering)

    How can I get results that are in regular-ol' distances? i.e. 196.12'

    Thanks, Steve (LDD Companion C3D 2009)
    Last edited by jsteveadams; 2010-01-05 at 11:29 PM. Reason: spelling

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Engineering Notation in DXF Codes

    If you are just reporting what is the distance value and are happy with a string, you can use: (rtos (distance a b) 2 2)
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  3. #3
    Member
    Join Date
    2009-12
    Posts
    6
    Login to Give a bone
    0

    Default Re: Engineering Notation in DXF Codes

    Thanks Mr. Bell,

    But when I try:

    (setq a 1.0e+020)
    (rtos a 2 2)

    I still get : "1.00E+20"

    Any ideas?

    Thanks,

    Steve

  4. #4
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: Engineering Notation in DXF Codes

    I know it isnt any help, but I was never able to figure it out when I had the problem last year. Instead, I just decided to modify my methods. I was attempting to select points with large coordinates, so I modified my code to move all points closer to 0,0, run the program, then move everything back (via undo)

  5. #5
    Member
    Join Date
    2009-04
    Posts
    10
    Login to Give a bone
    0

    Default Re: Engineering Notation in DXF Codes

    1e+20 is a very very big number. Bigger than the 15 significant digits than acad can handle in a real number. -David

  6. #6
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Engineering Notation in DXF Codes

    Try this
    Code:
    (defun rtos1 (n p / i f s s1)
      (setq i (fix (abs n)) ;Get the integer portion
            f (- (abs n) i) ;Get the fraction portion
      ) ;_ end of setq
    
      ;; Do the integer portion
      (if (= i 0) ;If integer is zero
        (setq s "0") ;Then set string to reflect
        (progn ;Else
          (setq s "") ;Initialize string to empty
          (while (> i (- (expt 10 8) 1)) ;While i has more than 8 digits
            (setq s1 (itoa (fix (rem i (expt 10 8))))) ;Get the last 8 digits from i
            (while (< (strlen s1) 8) (setq s1 (strcat "0" s1))) ;Padd with zeros
            (setq s (strcat s1 s) ;Add last 8 digits to string
                  i (fix (/ i (expt 10 8))) ;Remove last 8 digits from i
            ) ;_ end of setq
          ) ;_ end of while
          (if (> i 0) ;If digits still left in i
            (setq s (strcat (itoa (fix i)) s)) ;Add to string
          ) ;_ end of if
        ) ;_ end of progn
      ) ;_ end of if
    
      ;; Do the fraction part
      (if (and (> p 0) (> f 0)) ;If there is a fraction part
        (progn
          (setq s (strcat s ".")) ;Add the decimal point
          (while (and (> p 0) (not (equal f 0.0 (expt 0.09999999 p)))) ;While f has digits below the decimal
            (setq i (fix (* f 10)) ;Get the 1st digit after the decimal
                  s (strcat s (itoa i)) ;Add it to the string
                  f (- (* f 10) i) ;Move f's digits & remove the integer portion
                  p (1- p) ;Remove the prcision just added
            ) ;_ end of setq
          ) ;_ end of while
          ;; Pad left over precision with zeros
          (while (> p 0)
            (setq s (strcat s "0")
                  p (1- p)
            ) ;_ end of setq
          ) ;_ end of while
        ) ;_ end of progn
      ) ;_ end of if
    
      ;; Check if negative
      (if (< n 0)
        (setq s (strcat "-" s))
      ) ;_ end of if
      s ;Return the string
    ) ;_ end of defun
    It only handles decimal though, and you have to add the precision. E.g. (rtos1 1.0e+20 0) gives "100000000000000000000", and (rtos1 1.0e-20 20) gives "0.00000000000000000001". But (rtos1 1.0e-20 19) gives "0.0000000000000000000"

  7. #7
    Member
    Join Date
    2009-12
    Posts
    6
    Login to Give a bone
    0

    Default Re: Engineering Notation in DXF Codes

    Thanks irneb, I really appreciate your time and the code.

    I run into a lot of these notations nowadays, and this will let me be able to use those numbers.

    Thank you,

    Steve

  8. #8
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Engineering Notation in DXF Codes

    You're welcome.

    BTW, from the name of this thread I was at first of the opinion you were requesting something different. I.e. Engineering Notation works on exponents of 10 in multiples of 3 (e.g. 30000 = 30.0E+03). I mention this since I ran into a similar problem with OpenOffice Calc (the Excel alternative).

    See my 2 attachments in this thread: http://qa.openoffice.org/issues/show_bug.cgi?id=5930

    It can do the true Engineering Notation as well as SI (i.e. mili, kilo, giga, etc.). Unfortunately it's only written to work in OOoCalc, not Excel.

Similar Threads

  1. Diffuser tag w/ user notation
    By gvluisi in forum Revit MEP - General
    Replies: 7
    Last Post: 2009-11-06, 07:48 PM
  2. Tagging Groups or Notation Family ???
    By david.wales in forum Revit Architecture - General
    Replies: 1
    Last Post: 2009-10-08, 01:27 AM
  3. SIM notation on view tags
    By csmith.123459 in forum Revit Architecture - General
    Replies: 4
    Last Post: 2007-04-07, 08:23 AM
  4. Printing Half Size Notation
    By ChristinaB in forum Revit - Plotting/Printing/Exporting
    Replies: 2
    Last Post: 2007-03-18, 04:09 PM
  5. Framing Notation
    By carolinadesign in forum ACA General
    Replies: 2
    Last Post: 2006-05-11, 02:32 PM

Posting Permissions

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