; ADDNUM.LSP - 12 Feb 1987 - Stan H. Bimson - CompuServe 73507,3475 ; ; as printed in CADLINES, the newsletter of ; the Nashville AutoCAD Users' Group (NAUG) ; April 1988, Vol. 2, No. 7 ; ; CAD/Engineering Services (615)824-4938 ; 1038 Forest Harbor Drive ; Hendersonville, TN 37075-9646 ; ; This program does not work on dimension that have been ; placed in a drawing with ADIM. (defun fixstr(str) (while (member (substr str 1 1) '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")) (setq str (substr str 2)))) (defun c:add() (princ "\nAdding machine") (setq fun + pmpt "\nPick screen +num >() " tot 0.0) (while (not (null fun)) (while (setq e (entsel (strcat (substr pmpt 1 20) (rtos tot) (substr pmpt 21)))) (setq str (cdr (assoc 1 (entget (car e)))) tot (fun tot (progn (setq num (float (atoi str)) str (fixstr str)) (if (= (substr str 1 2) "'-") (setq num (* num 12.0) str (substr str 3) num (+ num (float (atoi str))) str (fixstr str))) (if (/= (setq f (float (atoi str))) 0) (+ (/ f (atoi (substr (fixstr (substr str 2)) 2))) num) num)))) ); end while get input (setq f T) (while f (setq st (getstring "\nEnter + or - (k)eyboard, uit : ")) (cond ( (member st '("q" "Q" "")) (setq f nil fun nil)) ( (= st "+") (setq fun + pmpt "\npick screen +num >() " f nil)) ( (= st "-") (setq fun - pmpt "\npick screen -num >() " f nil)) ( (member st '("k" "K")) (while (/= "" (setq str (getstring (strcat "\nEnter keyboard num (" (rtos tot) ") : ")))) (setq num (atof str) sign (if (minusp num) -1 1) num (* num sign) ft (fix num) num (* (- num ft) 100.0) in (fix (+ num 1.0e-12)) num (- num in)) (if (< num 1.0e-12) (setq num 0.0)) (setq num (+ (* ft 12.0) in (* num 6.25)) tot (+ tot (* sign num)))))))) (princ (setq strdef (rtos tot))) (princ) )