여러 객체의 색상을 같은 값으로
검토 표시, 출력 색상 정리, ByLayer 복원처럼 선택 객체의 색상을 빠르게 통일합니다.
ACI 색상 기준
- ByLayer는 256, ByBlock은 0으로 적용합니다.
- 직접 색상은 ACI 1~255 범위만 허용합니다.
- True Color를 쓰던 객체도 선택한 ACI 색상으로 변경되며 잠긴 레이어는 건너뜁니다.
사용 순서
- 1
APPLOAD로 color-set.lsp를 로드합니다.
- 2
COLORSET을 입력합니다.
- 3
ByLayer, ByBlock 또는 1~255를 입력합니다.
- 4
색상을 변경할 객체를 선택합니다.
코드 전문
다운로드 파일은 아래 코드와 100% 동일합니다. 붙여넣기보다 파일 다운로드 후 APPLOAD 로드를 권장합니다.
;;; ------------------------------------------------------------
;;; AutoCATS 리습 자료실
;; 명령: COLORSET
;; 기능: 선택 객체의 ACI 색상을 ByLayer, ByBlock 또는 1~255로 일괄 변경
;; 출처: https://www.autocats.co.kr/lisp/color-set
;; 버전: 1.0 (2026-07-23)
;; 라이선스: 자유 사용·수정, 재배포 시 출처(autocats.co.kr) 표기
;; 안전: *error* 핸들러 + UNDO 그룹, 잠긴 레이어 건너뜀
;;; ------------------------------------------------------------
(vl-load-com)
(defun autocats-colorset-digits-p (value / idx valid)
(setq idx 1 valid (/= value ""))
(while (and valid (<= idx (strlen value)))
(if (not (wcmatch (substr value idx 1) "#"))
(setq valid nil))
(setq idx (1+ idx)))
valid)
(defun autocats-colorset-parse (value / upper number)
(setq upper (strcase value))
(cond
((or (= upper "") (= upper "BYLAYER")) 256)
((= upper "BYBLOCK") 0)
((autocats-colorset-digits-p value)
(setq number (atoi value))
(if (and (>= number 1) (<= number 255)) number nil))
(T nil)))
(defun autocats-colorset-locked-p (ent / row)
(setq row (tblsearch "LAYER" (cdr (assoc 8 (entget ent)))))
(and row (= 4 (logand 4 (cdr (assoc 70 row))))))
(defun autocats-colorset-apply (ent color / data cleaned updated)
(setq data (entget ent)
cleaned
(vl-remove-if
'(lambda (pair) (member (car pair) '(62 420 430)))
data))
(if (= color 256)
(setq updated (entmod cleaned))
(setq updated (entmod (append cleaned (list (cons 62 color))))))
(if updated (progn (entupd ent) T) nil))
(defun c:COLORSET (/ *error* doc undo-open raw color ss idx ent changed skipped)
(defun *error* (msg)
(if undo-open
(progn (vla-EndUndoMark doc) (setq undo-open nil)))
(if (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*,*취소*")))
(princ (strcat "\n[COLORSET] 중단: " msg)))
(princ))
(setq raw (getstring T "\n[COLORSET] 색상 [ByLayer/ByBlock/1~255] <ByLayer>: ")
color (autocats-colorset-parse raw))
(if (null color)
(princ "\n[COLORSET] 올바른 ACI 색상을 입력해야 합니다.")
(progn
(princ "\n[COLORSET] 색상을 변경할 객체를 선택하세요.")
(setq ss (ssget))
(if ss
(progn
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object))
idx 0 changed 0 skipped 0)
(vla-StartUndoMark doc)
(setq undo-open T)
(while (< idx (sslength ss))
(setq ent (ssname ss idx))
(if (or (autocats-colorset-locked-p ent)
(not (autocats-colorset-apply ent color)))
(setq skipped (1+ skipped))
(setq changed (1+ changed)))
(setq idx (1+ idx)))
(vla-EndUndoMark doc)
(setq undo-open nil)
(princ (strcat "\n[COLORSET] 완료: " (itoa changed)
"개 변경 / " (itoa skipped) "개 건너뜀")))
(princ "\n[COLORSET] 선택된 객체가 없습니다."))))
(princ))
(princ "\n[AutoCATS] COLORSET 로드 완료 - 명령행에 COLORSET 를 입력하세요.")
(princ)
호환 CAD
위 환경에서 확인했습니다. 목록에 없는 CAD는 샘플 도면에서 먼저 결과를 대조한 뒤, CAD 종류·버전과 함께 네이버 카페에 알려주세요.
이 기능, CATS Pro에는 버튼으로 있습니다
D0 / CATS_D0CATS Pro에서는 자주 쓰는 색상을 개별 단축 명령으로 더 빠르게 적용합니다.CATS Pro는 계속 무료입니다. 리습 로드 없이 버튼 클릭으로 같은 작업을 처리할 수 있습니다.
함께 쓰면 좋은 CATS 명령
자주 묻는 질문
True Color도 지원하나요?
이 가벼운 버전은 ACI 색상만 입력하며 기존 True Color는 선택한 ACI 값으로 대체됩니다.
ByLayer로 되돌리려면 무엇을 입력하나요?
아무것도 입력하지 않고 Enter를 누르거나 ByLayer를 입력하세요.