Results 1 to 3 of 3

Thread: Addition with decimals

  1. #1
    100 Club CADNate's Avatar
    Join Date
    2015-12
    Location
    Lovejoy, GA.
    Posts
    125
    Login to Give a bone
    0

    Default Addition with decimals

    Hi,

    I need some assistance with the attached LISP. It works fine until you have numbers that have decimals. The way it is now is that it ignores them. I would like for it to include the decimals and not round the numbers in the selections and in the total. Can anyone assist me with this?

    Thanks,
    CADNate
    Attached Files Attached Files

  2. #2
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Addition with decimals

    change atoi to atof

    in these lines

    (setq value1 (atoi value1))

    (setq addnext (atoi addnext))


    change

    (setq total (itoa total))

    to

    (setq total (vl-princ-to-string total)) ;< will follow auprec number of decimal places.

    Also

    (vl-load-com) at the bottom (outside you function)
    AutomateCAD

  3. #3
    100 Club CADNate's Avatar
    Join Date
    2015-12
    Location
    Lovejoy, GA.
    Posts
    125
    Login to Give a bone
    0

    Default Re: Addition with decimals

    Awesome! Thanks a bunch. That worked perfectly.

Similar Threads

  1. Need Lisp For Feets to Meters with 2 decimals only
    By prasadcivil in forum AutoLISP
    Replies: 14
    Last Post: 2016-09-16, 02:26 PM
  2. 2015: Extra decimals in dimensions
    By dfi in forum Revit Architecture - General
    Replies: 2
    Last Post: 2015-10-27, 04:15 PM
  3. Converting to decimals of a foot
    By jmctamney in forum AutoCAD Fields
    Replies: 3
    Last Post: 2007-03-27, 06:18 AM
  4. Does anybody have a menu that shows fractions & decimals
    By papaj1232001 in forum AutoCAD Customization
    Replies: 4
    Last Post: 2006-09-09, 10:45 PM
  5. Rounding Decimals...
    By droak in forum AutoCAD General
    Replies: 1
    Last Post: 2004-08-06, 10:25 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
  •