・ オブジェクトの色を変更する

選択したオブジェクトの色を赤に変更するサンプルです

;選択したオブジェクトの色を変更 (command)利用 ;
(defun Jo_chg_col_com ( / ent en)
  (if (and
	(setq ent (entsel "\nオブジェクト選択"))
	(setq en (car ent))
	)
    (command "._CHANGE" en "" "P" "C" 1 "")
    )
  )

;選択したオブジェクトの色を変更 (entmod)利用 ;
(defun Jo_chg_col_emod ( / ent ed)
  (if (and
	(setq ent (entsel "\nオブジェクト選択"))
	(setq ed (entget (car ent)))
	)
    (entmod (if (assoc 62 ed)
	      (subst (cons 62 1) (assoc 62 ed) ed)
	      (reverse (cons (cons 62 1) (reverse ed)))
	      ))	     
    )
  )

;選択したオブジェクトの色を変更 ActiveX 利用 ;
(defun Jo_chg_col_ax ( / ent en)
  (vl-load-com)
  (if (and
	(setq ent (entsel "\nオブジェクト選択"))
	(setq en (vlax-ename->vla-object (car ent)))
	)
    (vla-Put-Color en acred)
    )
  )