@john.uhden wrote:
Correct. I was just pointing out that a rem of zero does not necessarily
mean an integer.
Correct
,
Guess i'm more into using math for evaluation since i switch from one program language to another.
Hoepfully the OP would not include the trailing zeros on the source file. 20.00
But you right about zero.
Taking John's advice.
(defun c:RoundUpFromRange ( / _L2S RealorInt range rangeSource opf a i s ent v)
;; pBe May 2020 ;;
(defun _L2S (s a)
((lambda (v)
(setq s (vl-string-right-trim v s)
s (vl-string-Left-trim v s)))
(strcat "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" a))
)
(setq RealorInt (lambda (n)
(if (Eq (type n) 'INT) 0 2)
)
)
(if (and
(setq range nil
rs (getfiled "Select Source file"
(if rs (vl-filename-directory rs)
(getvar 'dwgprefix)) "txt" 16)
)
(setq range
(progn
(setq opf (open rs "r"))
(while (setq a (read-line opf))
(if (numberp (setq a (Read a)))
(setq range (cons a range)))
)
(close opf)
(reverse range))
)
(princ "\nActual values, ")
(setq s (ssget "_:L" '((0 . "TEXT"))))
)
(repeat (setq i (sslength s))
(if
(setq e (ssname s (setq i (1- i)))
v (atof (_L2S (getpropertyvalue e "TextString") ""))
v (Vl-some '(lambda (n m)
(cond
((<= v n) n)
((<= n v m) m)
)
) range (Cdr range)
)
)
(setpropertyvalue e "TextString" (rtos v 2 (RealorInt v))))
)
)
(princ)
)