캐드 분류
레이어 on/lock 관련 문의 드립니다.
컨텐츠 정보
- 308 조회
- 2 댓글
- 0 추천
- 0 비추천
-
목록
본문
레이어 on/lock 관련 문의 드립니다.
리습 실행시 레이어 이름 앞에 특수기호 (#$^*)가 있으면
먹히지 않는 부분이 있는데요
어떤 부분을 수정할지 몰라서
선배님들 후배님들한테 문의 드립니다.
부탁드립니다.
<레이어ON>
(defun c:lo()
(setvar "CMDECHO" 0)
(prompt "n To leave the Layer select Object. ")
(setq b1 (ssget)
b1len (sslength b1)
i 0
laylist (list)
laytext ""
)
(repeat b1len
(setq b1n(cdr(assoc 8 (entget(ssname b1 i)))))
(if (= nil (member b1n laylist))
(setq laylist(append laylist (list b1n)) )
)
(setq i(1+ i))
);_repeatEnd
(setq laylen(length laylist) i2 0 )
(repeat laylen
(setq layT(nth i2 laylist)
laytext(strcat laytext layT ",")
i2(1+ i2)
)
)
(command "layer" "off" "*" "y" "")
(command "layer" "on" laytext "")
)
(setvar "CMDECHO" 0)
(prompt "n To leave the Layer select Object. ")
(setq b1 (ssget)
b1len (sslength b1)
i 0
laylist (list)
laytext ""
)
(repeat b1len
(setq b1n(cdr(assoc 8 (entget(ssname b1 i)))))
(if (= nil (member b1n laylist))
(setq laylist(append laylist (list b1n)) )
)
(setq i(1+ i))
);_repeatEnd
(setq laylen(length laylist) i2 0 )
(repeat laylen
(setq layT(nth i2 laylist)
laytext(strcat laytext layT ",")
i2(1+ i2)
)
)
(command "layer" "off" "*" "y" "")
(command "layer" "on" laytext "")
)
<레이어 LOCK/UNLOCK>
(defun c:ll ()
(setq LOCK "" lnames ' ())
(princ "npick entities on layers to be lock…n")
(setq ss (ssget))
(while (and ss (setq ent (ssname ss 0)))
(cond
((member (setq lname (cdr (assoc 8 (entget ent))))
lnames))
(t (setq lock (strcat lock lname ",")
lnames (cons lname lnames)
)
)
)
(setq ss (ssdel ent ss))
)
(setq lock (if (> (strlen lock) 1)
(substr lock 1 (1- (strlen lock)))
lock
)
)
(if (/= lock "") (command "layer" "lo" lock ""))
(princ)
(prin1)
)
(setq LOCK "" lnames ' ())
(princ "npick entities on layers to be lock…n")
(setq ss (ssget))
(while (and ss (setq ent (ssname ss 0)))
(cond
((member (setq lname (cdr (assoc 8 (entget ent))))
lnames))
(t (setq lock (strcat lock lname ",")
lnames (cons lname lnames)
)
)
)
(setq ss (ssdel ent ss))
)
(setq lock (if (> (strlen lock) 1)
(substr lock 1 (1- (strlen lock)))
lock
)
)
(if (/= lock "") (command "layer" "lo" lock ""))
(princ)
(prin1)
)
(defun c:ko ()
(setq unLOCK "" lnames ' ())
(princ "npick entities on layers to be unlock…n")
(setq ss (ssget))
(while (and ss (setq ent (ssname ss 0)))
(cond
((member (setq lname (cdr (assoc 8 (entget ent))))
lnames))
(t (setq unlock (strcat unlock lname ",")
lnames (cons lname lnames)
)
)
)
(setq ss (ssdel ent ss))
)
(setq unlock (if (> (strlen unlock) 1)
(substr unlock 1 (1- (strlen unlock)))
lock
)
)
(if (/= unlock "") (command "layer" "u" unlock ""))
(princ)
(prin1)
)
(setq unLOCK "" lnames ' ())
(princ "npick entities on layers to be unlock…n")
(setq ss (ssget))
(while (and ss (setq ent (ssname ss 0)))
(cond
((member (setq lname (cdr (assoc 8 (entget ent))))
lnames))
(t (setq unlock (strcat unlock lname ",")
lnames (cons lname lnames)
)
)
)
(setq ss (ssdel ent ss))
)
(setq unlock (if (> (strlen unlock) 1)
(substr unlock 1 (1- (strlen unlock)))
lock
)
)
(if (/= unlock "") (command "layer" "u" unlock ""))
(princ)
(prin1)
)