(defun c:t3(/ mode txt in_point len ii tmp val xx new_text)
(setvar “cmdecho” 0)
(setq mode (getint “n 바꾸려는위치 1,2,3 <3>: “))
(setq mode (if mode mode 3))
(setq txt (getstring “n 입력:”))
(if (setq in_point(getpoint”n 기준점”))
(progn
(command “TEXT” in_point “2.5” “” txt)
(setq len (strlen txt))
(setq ii 1 tmp “” xx ‘())
(while (<= ii len)
(if (/= “-” (substr txt ii 1))
(setq tmp (strcat tmp (substr txt ii 1)))
(progn
(setq xx (append xx (list tmp)))
(setq tmp “”)
)
)
(setq ii (1+ ii))
)
(setq xx (append xx (list tmp)))
(setq val
(cond
((= mode 1) (atoi (nth 0 xx)) )
((= mode 2) (atoi (nth 1 xx)) )
((= mode 3) (atoi (nth 2 xx)) )
(t nil)
)
)
(setq txt1 (nth 0 xx))
(setq txt2 (nth 1 xx))
(setq txt3 (nth 2 xx))
(while (setq in_point(getpoint”n 기준점”))
(setq val (1+ val))
(setq new_text
(cond
( (= mode 1) (strcat (itoa val) “-” txt2 “-” txt3) )
( (= mode 2) (strcat txt1 “-” (itoa val) “-” txt3) )
( (= mode 3) (strcat txt1 “-” txt2 “-” (itoa val)) )
(t nil)
)
)
(command “TEXT” in_point “2.5” “” new_text)
)
)
)
(princ)
)
실행시키면..
Command: t3
바꾸려는위치 1,2,3 <3>:
입력:1-101-1
기준점
이케 나오면서 기준점일때 찍으면 1-101-1 이 화면에 찍히고
다음에
기준점
기준점
기준점
기준점
기준점
이렇게 마우스를 클릭할때마다 증가합니다..
여기서 그냥 기준점이라고 나오지 않고..
1-101-1을 찍고 나서 다음 기준점이라고 나오는 부분에..
1-101-2 기준점
1-101-3 기준점
.
.
.
이런 식으로 찍힐 값이 출력되게 했음 하거든요…
좀 알려주세요…..^^;