(defun c:chColor (/ col ss n) (if (and (setq ss (ssget)) (progn (setq col (acad_colordlg 7)) (while (not col) (if (setq col (getint "\n指定颜色索引号(0~256): ")) (if (<= 0 col 256) T (progn (setq col nil) (princ "\n需要 0~256 的整数。")) ) ) ) col ) ) (repeat (setq n (sslength ss)) (vla-put-color (vlax-ename->vla-object (ssname ss (setq n (1- n)))) col ) ) ) (princ) )