
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, Dear
I am using this program for adding large numbers it is not giving m correct sum while for smaller numbers it is ok, Please any advice.
thanks
(defun c:Stxt (/ ans flag)
(setq flag t)
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(setq ht (getint "\nEnter Universal Height"))
(while flag
(initget "1 2 3 4 5 6 7 8 9 10")
(setq ans (entsel "\nmake your selection[2/3/4/5/6/7/8/9/10]<exit>:"))
(cond ((= ans nil)
(setq flag nil)
(prompt "\nyou didn't select an object, or you did press spacebar or enter, to exit...")
)
((= 'list (type ans))
(prompt "\nyou did select an object...")
)
((= "2" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget (car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq addd (+ 1st 2nd))
(command "text" Pause ht "0" addd "")
)
((= "3" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq 3rd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Third Text")))))))
(setq addd (+ 1st 2nd 3rd))
(command "text" Pause ht "0" addd "")
)
((= "4" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq 3rd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Third Text")))))))
(setq 4th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fourth Text")))))))
(setq addd (+ 1st 2nd 3rd 4th))
(command "text" Pause ht "0" addd "")
)
((= "5" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq 3rd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Third Text")))))))
(setq 4th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fourth Text")))))))
(setq 5th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fifth Text")))))))
(setq addd (+ 1st 2nd 3rd 4th 5th))
(command "text" Pause ht "0" addd "")
)
((= "6" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq 3rd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Third Text")))))))
(setq 4th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fourth Text")))))))
(setq 5th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fifth Text")))))))
(setq 6th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the sixth Text")))))))
(setq addd (+ 1st 2nd 3rd 4th 5th 6th))
(command "text" Pause ht "0" addd "")
)
((= "7" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq 3rd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Third Text")))))))
(setq 4th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fourth Text")))))))
(setq 5th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fifth Text")))))))
(setq 6th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the sixth Text")))))))
(setq 7th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the seventh Text")))))))
(setq addd (+ 1st 2nd 3rd 4th 5th 6th 7th))
(command "text" Pause ht "0" addd "")
)
((= "8" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq 3rd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Third Text")))))))
(setq 4th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fourth Text")))))))
(setq 5th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fifth Text")))))))
(setq 6th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the sixth Text")))))))
(setq 7th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the seventh Text")))))))
(setq 8th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Eighth Text")))))))
(setq addd (+ 1st 2nd 3rd 4th 5th 6th 7th 8th))
(command "text" Pause ht "0" addd "")
)
((= "9" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq 3rd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Third Text")))))))
(setq 4th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fourth Text")))))))
(setq 5th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fifth Text")))))))
(setq 6th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the sixth Text")))))))
(setq 7th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the seventh Text")))))))
(setq 8th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Eighth Text")))))))
(setq 9th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Ninth Text")))))))
(setq addd (+ 1st 2nd 3rd 4th 5th 6th 7th 8th 9th))
(command "text" Pause ht "0" addd "")
)
((= "10" ans)
;(prompt "\nyou did enter Beta...")
(setq 1st (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the First Text")))))))
(setq 2nd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Second Text")))))))
(setq 3rd (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Third Text")))))))
(setq 4th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fourth Text")))))))
(setq 5th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Fifth Text")))))))
(setq 6th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the sixth Text")))))))
(setq 7th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the seventh Text")))))))
(setq 8th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Eighth Text")))))))
(setq 9th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the Ninth Text")))))))
(setq 10th (atoi (cdr (assoc 1 (entget(car (entsel "\nSelect the tenth Text")))))))
(setq addd (+ 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th))
(command "text" Pause ht "0" addd "")
)
);; cond
);; while
(princ)
)
Solved! Go to Solution.