텍스트 “~을 ~ 로” 바꾸는 리습인데요.
이게 dim 에서는 안되서요. dim에서도 되게 할 수 없을까요?
dim 에서도 만약 ABDA 88,000 을 BBDB 88,000 으로 바꾸고 싶다 하면
A 를 B 로 쳐서 바뀌게 하고 싶어요.
;;***************** CHANGE TEXT ***************************************
(defun chgterr (s)
(if (/= s “Function cancelled”)
(princ (strcat “nError: ” s))
)
(setq p nil)
(setq *error* olderr)
(princ)
)
(defun c:00()
(setq olderr *error*
*error* chgterr
chm 0)
(setq p (ssget))
(if p (progn
(while (= 0 (setq osl (strlen (setq os (getstring t “nOld string: “)))))
(princ “Null input invalid”)
)
(setq nsl (strlen (setq ns (getstring t “nNew string: “))))
(setq l 0 n (sslength p))
(while (< l n)
(if (= “TEXT”
(cdr (assoc 0 (setq e (entget (ssname p l))))))
(progn
(setq chf nil si 1)
(setq s (cdr (setq as (assoc 1 e))))
(while (= osl (setq sl (strlen
(setq st (substr s si osl)))))
(if (= st os)
(progn
(setq s (strcat (substr s 1 (1- si)) ns
(substr s (+ si osl))))
(setq chf t)
(setq si (+ si nsl))
)
(setq si (1+ si))
)
)
(if chf (progn
(setq e (subst (cons 1 s) as e))
(entmod e)
(setq chm (1+ chm))
))
)
)
(setq l (1+ l))
)
))
(princ “Changed “)
(princ chm)
(princ ” text lines.”)
(terpri)
(setq *error* olderr)
(princ)
)