예를 들어
LA 라는 레이어로 되어 있는 선이 있으면
명령어 실행 -> 선 클릭 (엔터)
P- 라는 글씨 커멘트창에 쓰고 (엔터)
하면
LA라는 레이어로 되어 있는 선이
P-LA라는 레이어를 같는 선으로 변경되는것입니다.
기존의 정보는 그대로 가져가도 레이어만 앞에 입력한것을 넣어서 새로운 레이어로 변경되는것입니다.
이때 LA라는 레이어로 되어 있는 클릭하지 않은 다른 선들도 모두 함께
P-LA 라는 레이어를 같는 선으로 변경되는 것입니다.
아무리 노력해도 답이 안보여서 글올려 봅니다 ^^
————————————————————————————————
1번 방법
(defun c:1111 ( / hsame1 hname ent)
(setq hsame1 “MP-“)
(princ “레이어명에 추가할 레이어명은? (prefix) <“)(princ hsame1)(princ “> :”)
(setq hsame1 (getstring))
(if (= hsame1 “”) (setq hsame1 “MP-“))
(vl-load-com)
(and
(setq ss (ssget))
(setq hname (strcat hsame1 (itoa ss)))
;(setq hlayer “point”) point 레이어 생성
(if (= (tblsearch “layer” hname) nil) (command “‘_layer” “n” hname hname “”))
;(princ hsame1)
;(princ ss)
;(princ hsame)
(foreach ob (mapcar ‘vlax-ename->vla-object (vl-remove-if ‘listp (mapcar ‘cadr (ssnamex hname))))
(vlax-put ob ‘layer hname)))
;(command “change” ent “” “p” “la” hname “c” “bylayer” “”)
(princ “### Complete !!! ###”)(princ)
————————————————————————————————
2번 방법
(defun c:1111 ( / hsame1 hname ss)
(setq hsame1 “MP-“)
(princ “레이어명에 추가할 레이어명은? (prefix) <“)(princ hsame1)(princ “> :”)
(setq hsame1 (getstring))
(if (= hsame1 “”) (setq hsame1 “MP-“))
(vl-load-com)
(and
(setq ss (ssget))
(setq hname (strcat hsame1 (itoa ss))))
(command “-rename” “LA” ss hname)
(princ “### Complete !!! ###”)(princ)
)
2번이 조금 더 가까운거 같은데 오류가 나네요 ㅠㅠ