숨은 레이어를 한 번에 복원
여러 명이 편집한 도면에서 어떤 레이어가 꺼지거나 동결·잠금됐는지 찾기 어려울 때 전체 편집 상태를 빠르게 초기화합니다.
외부참조는 안전하게 제외
- 일반 레이어는 On, Thaw, Unlock 상태로 바꿉니다.
- 이름에 |가 포함된 Xref 종속 레이어는 건너뜁니다.
- 현재 레이어는 변경하지 않고 전체 작업을 한 번에 UNDO할 수 있습니다.
사용 순서
- 1
APPLOAD로 layer-reset.lsp를 로드합니다.
- 2
LAYERRESET을 입력합니다.
- 3
복원된 레이어와 건너뛴 레이어 개수를 확인합니다.
코드 전문
다운로드 파일은 아래 코드와 100% 동일합니다. 붙여넣기보다 파일 다운로드 후 APPLOAD 로드를 권장합니다.
;;; ------------------------------------------------------------
;;; AutoCATS 리습 자료실
;; 명령: LAYERRESET
;; 기능: 편집 가능한 레이어를 모두 켜고 동결 및 잠금 해제
;; 출처: https://www.autocats.co.kr/lisp/layer-reset
;; 버전: 1.0 (2026-07-23)
;; 라이선스: 자유 사용·수정, 재배포 시 출처(autocats.co.kr) 표기
;; 안전: *error* 핸들러 + UNDO 그룹, Xref 종속 레이어 건너뜀
;;; ------------------------------------------------------------
(defun autocats-layerreset-xref-p (name)
(if (vl-string-search "|" name) T nil))
(defun autocats-layerreset-one (name / result)
(setq result
(vl-catch-all-apply
'(lambda ()
(command "_.-LAYER" "_On" name "")
(command "_.-LAYER" "_Thaw" name "")
(command "_.-LAYER" "_Unlock" name "")
T)))
(if (vl-catch-all-error-p result) nil result))
(defun autocats-layerreset-run (/ row name changed skipped)
(setq changed 0 skipped 0
row (tblnext "LAYER" T))
(while row
(setq name (cdr (assoc 2 row)))
(if (or (autocats-layerreset-xref-p name)
(not (autocats-layerreset-one name)))
(setq skipped (1+ skipped))
(setq changed (1+ changed)))
(setq row (tblnext "LAYER")))
(cons changed skipped))
(defun c:LAYERRESET (/ *error* undo-open result)
(defun *error* (msg)
(if undo-open
(progn (command "_.UNDO" "_End") (setq undo-open nil)))
(if (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*,*취소*")))
(princ (strcat "\n[LAYERRESET] 중단: " msg)))
(princ))
(command "_.UNDO" "_Begin")
(setq undo-open T
result (autocats-layerreset-run))
(command "_.UNDO" "_End")
(setq undo-open nil)
(princ (strcat "\n[LAYERRESET] 완료: " (itoa (car result))
"개 레이어 복원 / " (itoa (cdr result)) "개 건너뜀"))
(princ))
(princ "\n[AutoCATS] LAYERRESET 로드 완료 - 명령행에 LAYERRESET 를 입력하세요.")
(princ)
호환 CAD
위 환경에서 확인했습니다. 목록에 없는 CAD는 샘플 도면에서 먼저 결과를 대조한 뒤, CAD 종류·버전과 함께 네이버 카페에 알려주세요.
이 기능, CATS Pro에는 버튼으로 있습니다
L0 / CATS_L0CATS Pro의 신속 레이어 도구로 같은 작업을 버튼 한 번에 실행합니다.CATS Pro는 계속 무료입니다. 리습 로드 없이 버튼 클릭으로 같은 작업을 처리할 수 있습니다.
함께 쓰면 좋은 CATS 명령
자주 묻는 질문
외부참조 레이어도 바뀌나요?
Xref 종속 레이어는 원본 참조 상태를 보호하기 위해 건너뜁니다.
이전 레이어 상태로 돌아갈 수 있나요?
명령 직후 U를 한 번 실행하면 전체 변경을 되돌릴 수 있습니다.