antistar 发表于 2022-7-6 10:26:29

Help to change Layer's Co

I have a doubt and I ask for help from the masters.
There is another way to change the color of a layer via LISP?
I tried this method:
 
(defun make_layer ()
(command "_.layer" "t" "LAYER_01" "c" "50" "" "")
(command "_.layer" "t" "LAYER_02" "c" "191" "" "")
(command "_.layer" "t" "LAYER_03" "c" "70" "" "")
)
 
...but does not change the color of existing layers with same name.

alanjt 发表于 2022-7-6 10:31:49

You have to specify the layer name...
 

(defun make_layer () (command "_.layer" "t" "LAYER_01" "c" "50" "LAYER_01" "") (command "_.layer" "t" "LAYER_02" "c" "191" "LAYER_02" "") (command "_.layer" "t" "LAYER_03" "c" "70" "LAYER_03" ""))

BlackBox 发表于 2022-7-6 10:36:01

 
 
Yes. Try this:
 

vla-put-color
 
 
Or this:
 

vlax-put-property 'color
 
 
 
 
This requires additional steps.

antistar 发表于 2022-7-6 10:40:14

 
 
Alan, thanks for reply.
I've tried this and also not work if I already have layers with the same names.
I use CAD2002.

BlackBox 发表于 2022-7-6 10:42:27

 
 
Slight revision to accomplish this with existing layers as well, perhaps?
 
Note- the asterisk will effect all layer with this prefix.

alanjt 发表于 2022-7-6 10:47:16

Well, all you are doing is thawing and setting the color.
Are you trying to use this to create the layer?

antistar 发表于 2022-7-6 10:49:06

 
I want to change the color properties of existing layers.

alanjt 发表于 2022-7-6 10:55:16

 
And what you have will. Perhaps you need to account for language.

(defun make_layer () (command "_.layer" "_t" "LAYER_01" "_c" "50" "LAYER_01" "") (command "_.layer" "_t" "LAYER_02" "_c" "191" "LAYER_02" "") (command "_.layer" "_t" "LAYER_03" "_c" "70" "LAYER_03" ""))

Lee Mac 发表于 2022-7-6 10:59:07

Else look at entmod'ing the tblobjname...

alanjt 发表于 2022-7-6 11:02:18

baby steps :wink:
页: [1] 2
查看完整版本: Help to change Layer's Co