Why not use the SETBYLAYER command?
- - - Updated - - -
Old lisp by one of our more prominent AUGI members:
Code:
; Written By: Peter Jamtgaard 2002; This program will prompt the user to ceate a selection set.
; All objects in the selection set will have their color
; and linetype properties set to bylayer.
(defun C:ByLayer (/ CNT EOBJ SSET)
(princ "Select Entities to change")
(setq SSET (ssget)
CNT 0
)
(repeat (sslength SSET)
(setq ENAM (ssname SSET CNT)
CNT (1+ CNT)
EOBJ (vlax-ename->vla-object ENAM)
)
(vl-catch-all-apply
'vla-put-color
(list EOBJ 256)
)
(vl-catch-all-apply
'vla-put-linetype
(list EOBJ "Bylayer")
)
(vl-catch-all-apply
'vla-put-Lineweight
(list EOBJ -1)
)
(vl-catch-all-apply
'vla-put-PlotStyleName
(list EOBJ "Bylayer")
)
)
)