제가 운영체제를 XP 에서 Win7으로 바꾼지 얼마 안됐습니다.
리습을 똑같이 가지고 왔는데 이 리습이 안되네요
이 리습은 선택한 문자중에 제가 입력하는 문자를 찾아서 다시 입력하는 문자로 변경해주는
리습이었는데… 지금은 안되네요…
왜 그러는지 확인좀 해주세요
; CHGTEXT command – rudimentary text editor
(defun C:CV (/ p l n e os as ns st s nsl osl sl si chf chm cont)
(setq chm 0 p (ssget)) ; Select objects
(if p (progn ; If any objects selected
(setq cont t)
(while cont
(setq osl (strlen (setq os (getstring “nOld string: ” t))))
(if (= osl 0)
(princ “Null input invalid”)
(setq cont nil)
)
)
(setq nsl (strlen (setq ns (getstring “nNew string: ” t))))
(setq l 0 n (sslength p))
(while (< l n) ; For each selected object…
(if (= “TEXT” ; Look for TEXT entity type (group 0)
(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) ; Found old string
(setq si (+ si nsl))
)
(setq si (1+ si))
)
)
(if chf (progn ; Substitute new string for old
(setq e (subst (cons 1 s) as e))
(entmod e) ; Modify the TEXT entity
(setq chm (1+ chm))
))
)
)
(setq l (1+ l))
)
))
(princ “Changed “) ; Print total lines changed
(princ chm)
(princ ” text lines.”)
(terpri)
)
단일행문자에서만 사용할 수 있네여.
단일행 문자라면 혹시 문자가 하나로 되어있어야한다는 말씀이신가요??
실행은 되는데… 객체석택도 안되고 바꿀문자를 입력하라고도 안나오고
실행하면 마지막에 모두 돋음으로 변경됐다는 말만 나오네요
감사합니다. 한번 다 검토해봐야겠네요^^
올려주신 LISP에서 명령어만 바꾸어서 사용하니 잘 됩니다.