I too have greatly benefited from this routine also...however, I'd like to go a step further if possible.
Can this routine be expanded in retaining the original linetype as well as the color?
Regards
Brendon
@brendon_butler wrote:... I'd like to go a step further if possible.
Can this routine be expanded in retaining the original linetype as well as the color?
....
If you mean you want to assign to every selected object the Linetype of its Layer as an override Linetype instead of Bylayer [untested]:
(defun C:SECLL (/ ss obj)
;; = Selected Entity Colors/Linetypes to those of their Layer
(vl-load-com)
(prompt "\nTo change their colors/linetypes to those of their Layer,")
(setq ss (ssget))
(repeat (sslength ss)
(setq obj (vlax-ename->vla-object (ssname ss 0)))
(vla-put-Color
obj
(cdr (assoc 62 (tblsearch "layer" (vla-get-Layer obj))))
)
(vla-put-Linetype
obj
(cdr (assoc 6 (tblsearch "layer" (vla-get-Layer obj))))
)
(ssdel (ssname ss 0) ss)
); end repeat
); end defun
@Anonymous wrote:
Sorry, to resurrect an old question. I'm assuming it's also possible to do the same for lineweights?
....
Welcome to these Forums!
Yes, it is, though you need to "dig a little deeper," because (tblsearch) doesn't reveal the lineweight assigned to a Layer, the way it does the linetype. You need to pull up the "entity data" for the Layer as an "object" rather than just an entry in the table of Layers, and get the value associated with 370 there:
(vla-put-Lineweight
obj
(cdr (assoc 370 (entget (tblobjname "layer" (vla-get-Layer obj)))))
)