도번 자동 기입 리습입니다.
저희 회사는 도번은 100~9000번까지 사용을 하는데
0100,0101<-= 이것 처럼 백단위 도번에는 0을표시하여 자릿수를 4자리로 맞추고 싶은데
0100, 0101이라고 도번 입력을 하면 맨앞자리 0이 삭제되고 100,101 이런식으로 0이 삭제 되어집니다
0이 사라지지 않게 수정 가능 할까요…
고수님들에 조언과 수정 부탁드려 봅니다.
(defun c:NN ()(dwgn_main nil))
(defun dwgn_main ( dwgn_sp / a b c d e ed i b1 z) ; DWGN_KEY, DWGN_KEY2
(if dwgn_sp (setq z “-“)(setq z “-“))
; (ai_sysvar ‘((“cmdecho” . 0)))
(if (= dwgn_key nil)(setq dwgn_key “EP”))
(if (= dwgn_key2 nil)(setq dwgn_key2 “01”))
(prompt “nt Drawing-Section Symbol is ?<“)
(prin1 dwgn_key)
(setq a (getstring “> :”))
(if (or (= a nil)(= a “”))
(setq dwgn_key dwgn_key)
(setq dwgn_key (strcase a))
)
(prompt “t Enter Start-Number is ?<“)
(prin1 dwgn_key2)
(setq b (getstring “> :”))
(if (or (= b nil)(= b “”))
(setq b dwgn_key2)
)
(setq n (strlen b))
(setq i 0)
(setq b (- (atoi b) 1))
(prompt “nt Select of Drawing-Number’s Text ?:”)
(while (setq c (entsel))
(setq b (1+ b))
(setq b1 (itoa b))
(if (= n 2)
(if (= 1 (strlen b1))(setq b1 (strcat “0” b1)))
(if (= n 3)
(if (= 1 (strlen b1))(setq b1 (strcat “00” b1)))
(if (= n 4)
(if (= 1 (strlen b1))(setq b1 (strcat “000” b1)))
(if (= 2 (strlen b1))(setq b1 (strcat “0000” b1)))
)
)
)
(setq d (strcat dwgn_key z b1))
(setq e (cdr (assoc 1 (setq ed (entget (car c))))))
(setq ed (subst (cons 1 d)(assoc 1 ed) ed))
(entmod ed)
(prompt “nt Next Drawing-Number’s Text ?:”)
)
(setq dwgn_key2 b1)
; (ai_sysvar nil)
)
저도 유사하게 5자리 맞추는 걸 쓰고 있긴한데…
(while (<= (strlen ans) 4)
(setq ans (strcat “0” ans))
)