Originally Posted by
methost
This should be pretty simple for many of you, but it's got me scratching my head. here is what I want to do:
Create a layer, set this layers properties, make the layer active, and until this command ends, I want every line I poke to be placed on this newly created layer and it's properties changed to the default layer properties.
I can get through the layer creation part, that's easy enough, and I can of course get through changing the layer of the lines I select, but Im fuzzy on changing the objects properties to default to the layers properties.
I want to make a series of these for the different layers that I use, and I want to add them to a new drop down menu.
Can anyone offer some guidance?
Thanks in advance.
John
Try this:
Code:
;;CHANGES PICKED ENTITIES TO "YOUR_LAYER" LAYER
(defun c:lyr (/ ce ln ss)
(setq ce (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq ln (getvar "clayer"))
(setq ss (ssget))
(if (= (tblsearch "layer" "YOURLAYER") nil)
(command "layer" "make" "YOURLAYER" "color" "5" "" "lt" "hidden" """"))
(command "chprop" ss "" "la" "YOURLAYER" "ltype" "bylayer" "color" "bylayer""")
(setvar "clayer" ln)
(setvar "cmdecho" ce)
(princ)
)
You will want to put in your layer name ("YOURLAYER"), linetype and layer color as you need.