Hi Alls,
Now you should create an object,depend on you,a circle/rectangular or ellipse.That object set color with bylayer,and then test with my code,here that code.
My code can not change or modification color of object,any one know what wrong in that code,thanks for your help.
;(defun opts (sse col vevo xcol tcol /)
; (setq opt
; (getreal
; (strcat "\nEnter new color < "
; (itoa tcol)
; " > : ")))
; (if (= opt nil)(setq opt tcol))
; )
;(defun modi ()
; (setq new_col (cons 62 (fix opt)))
; (setq old_col (cons 62 col))
; (setq ed (subst new_col old_col sse))
; (entmod ed)
; )
(defun c:test (/ col ed new_col old_col opt ss sse tcol vevo xcol)
(if
(setq ss (car (entsel "\nSelect a object")))
(progn
(setq sse (entget ss))
(setq col (cdr (assoc 62 sse)))
(if
(= col nil)
(progn
(setq vevo (vlax-ename->vla-object ss))
;(vlax-dump-object vevo)
(setq xcol (vlax-get vevo 'TrueColor))
;(vlax-dump-object xcol)
(setq tcol (vlax-get xcol 'ColorIndex))
;(opts)
(setq opt
(getreal
(strcat "\nEnter new color < "
(itoa tcol)
" > : ")))
(if (= opt nil)(setq opt tcol))
(vlax-put vevo 'ColorIndex (itoa (fix opt))) ; >>still problem !!!
) ; progn
(progn
;(opts)
;(modi)
(setq opt
(getreal
(strcat "\nEnter new color < "
(itoa col)
" > : ")))
(if (= opt nil)(setq opt col))
(setq new_col (cons 62 (fix opt)))
(setq old_col (cons 62 col))
(setq ed (subst new_col old_col sse))
(entmod ed)
) ; progn
) ; if
) ; progn
(alert "\nInvalid selected object,please try again")
) ; if
(princ)
)