(defun c:nu( / dcl_id start_lisp start_dcl lbox_inint total_inint un_to_kht to_kht ;–main
num_chk do_t ebox_t_nil bt_un_1_0 bt_tt_1_0 a_ex a_app dim_zin)
(defun start_lisp( / n )
(setq n 0 a_ex (ssget ‘((0 . “text”))) a (ssadd) )
(if a_ex
(repeat (sslength a_ex)
(setq str (cdr (assoc 1 (entget (ssname a_ex n)))) )
(if (num_chk str) (ssadd (ssname a_ex n) a) )
(setq n (1+ n))
)
(progn (alert “선택된 텍스트가 없습니다.”) (exit) )
)
(if (= (sslength a) 0) (progn (alert “숫자로된 택스트가 없습니다.”)(exit)) )
)
(defun start_dcl ()
(if (not bt_un_1_0) (setq bt_un_1_0 “button+”) )
(if (not bt_tt_1_0) (setq bt_tt_1_0 “button1”) )
(set_tile bt_un_1_0 “1”)
(set_tile bt_tt_1_0 “1”)
(set_tile “ebox” “1”)
(total_inint)
(setq a_app (list) n 0)
(repeat (sslength a)
(setq a_app (append a_app (list (cdr (assoc 1 (entget (ssname a n)))))) n (1+ n) )
)
(lbox_inint “lbox1” a_app)
(un_to_kht)
(set_tile “lbox1” “0”)
(set_tile “lbox2” “0”)
)
(defun lbox_inint (a b)
(start_list a) (mapcar ‘add_list b) (end_list)
)
(defun total_inint ()
(cond
((= bt_un_1_0 “button+”) (setq to_ex “+”))
((= bt_un_1_0 “button-“) (setq to_ex “–“))
((= bt_un_1_0 “button/”) (setq to_ex “/”))
((= bt_un_1_0 “button*”) (setq to_ex “X”))
)
(set_tile “total” to_ex)
)
(defun un_to_kht ()
(setq end_app (list) n 0)
(repeat (length a_app)
(setq end_app (append end_app (list (to_kht (nth n a_app)) )))
(setq n (1+ n))
)
(lbox_inint “lbox2” end_app)
(set_tile “lbox2” (get_tile “lbox1”))
)
(defun to_kht (a)
(setq ex a)
(cond
((= bt_un_1_0 “button+”) (setq b ‘+))
((= bt_un_1_0 “button-“) (setq b ‘-))
((= bt_un_1_0 “button/”) (setq b ‘/))
((= bt_un_1_0 “button*”) (setq b ‘*))
)
(cond
((= bt_tt_1_0 “button0”) (setq c ‘0))
((= bt_tt_1_0 “button1”) (setq c ‘1))
((= bt_tt_1_0 “button2”) (setq c ‘2))
((= bt_tt_1_0 “button3”) (setq c ‘3))
((= bt_tt_1_0 “button4”) (setq c ‘4))
((= bt_tt_1_0 “button5”) (setq c ‘5))
)
(eval ‘(rtos ((eval b) (atof a) (atof (get_tile “ebox”))) 2 c) )
)
(defun ebox_t_nil ()
(if (not (num_chk (get_tile “ebox”)) ) (alert (strcat “””(get_tile “ebox”)””” ” 은 올바른 숫자가 아님니다.nn 다시 입력하세요.”)) )
(num_chk (get_tile “ebox”))
)
(defun num_chk(a / t_nil na b)
(setq t_nil t na 1)
(repeat (strlen a)
(setq b (substr a na 1) na (1+ na) )
(if (not (or (= b “1”)(= b “2”)(= b “3”)(= b “4”)(= b “5”)(= b “6”)(= b “7”)(= b “8”)(= b “9”)
(= b “0”)(= b “.”)(= b “-“)) )
(setq t_nil nil)
)
)
t_nil
)
(defun do_t( / n)
(setq n 0)
(repeat (sslength a)
(entmod (subst (cons 1 (nth n end_app)) (assoc 1 (entget (ssname a n))) (entget (ssname a n)) ))
(setq n (1+ n))
)
)
;(bgnerr)
(start_lisp)
(setq dcl_id (load_dialog “k_tnum”))
(new_dialog “union” dcl_id)
(start_dcl)
(setq dim_zin (getvar “dimzin”))
(setvar “dimzin” 1)
(action_tile “accept” “(if (ebox_t_nil) (progn (un_to_kht)(done_dialog 2)) )”) ;lbox3제거
(action_tile “cancel” “(done_dialog 1)”)
(action_tile “button+” “(if (ebox_t_nil) (progn (setq bt_un_1_0 ”button+”) (un_to_kht)(total_inint)) (set_tile bt_un_1_0 ”1”) )”)
(action_tile “button-” “(if (ebox_t_nil) (progn (setq bt_un_1_0 ”button-”) (un_to_kht)(total_inint)) (set_tile bt_un_1_0 ”1”) )”)
(action_tile “button/” “(if (ebox_t_nil) (progn (setq bt_un_1_0 ”button/”) (un_to_kht)(total_inint)) (set_tile bt_un_1_0 ”1”) )”)
(action_tile “button*” “(if (ebox_t_nil) (progn (setq bt_un_1_0 ”button*”) (un_to_kht)(total_inint)) (set_tile bt_un_1_0 ”1”) )”)
(action_tile “button0” “(if (ebox_t_nil) (progn (setq bt_tt_1_0 ”button0”) (un_to_kht)) (set_tile bt_tt_1_0 ”1”) )”)
(action_tile “button1” “(if (ebox_t_nil) (progn (setq bt_tt_1_0 ”button1”) (un_to_kht)) (set_tile bt_tt_1_0 ”1”) )”)
(action_tile “button2” “(if (ebox_t_nil) (progn (setq bt_tt_1_0 ”button2”) (un_to_kht)) (set_tile bt_tt_1_0 ”1”) )”)
(action_tile “button3” “(if (ebox_t_nil) (progn (setq bt_tt_1_0 ”button3”) (un_to_kht)) (set_tile bt_tt_1_0 ”1”) )”)
(action_tile “button4” “(if (ebox_t_nil) (progn (setq bt_tt_1_0 ”button4”) (un_to_kht)) (set_tile bt_tt_1_0 ”1”) )”)
(action_tile “button5” “(if (ebox_t_nil) (progn (setq bt_tt_1_0 ”button5”) (un_to_kht)) (set_tile bt_tt_1_0 ”1”) )”)
(action_tile “bt1” “(if (ebox_t_nil) (un_to_kht))”)
(action_tile “lbox1” “(set_tile ”lbox2” (get_tile ”lbox1”))”)
(action_tile “lbox2” “(set_tile ”lbox1” (get_tile ”lbox2”))”)
(setq ok (start_dialog))
(unload_dialog dcl_id)
(if (= ok 2) (do_t))
(setvar “dimzin” dim_zin)
;(enderr)
(princ)
)
(princ “n tnum 이 로드됬습니다.n일률적으로 주어진 값에 +,-,/,x 하는 리습입니다. “)
(princ)
어디가 잘 못된건가요??
제가 만든건 아니지만 09버전에서 자꾸 오류가 나네요.