antistar Posted September 21, 2010 Posted September 21, 2010 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. Quote
alanjt Posted September 21, 2010 Posted September 21, 2010 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" "") ) Quote
BlackBox Posted September 21, 2010 Posted September 21, 2010 There is another way to change the color of a layer via LISP? Yes. Try this: [color=#000]vla-put-color [i]<vla-object> [/i]<color>[/color] Or this: [color=#000]vlax-put-property [i]<vla-object>[/i] 'color[/color] ...but does not change the color of existing layers with same name. This requires additional steps. Quote
antistar Posted September 21, 2010 Author Posted September 21, 2010 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" "") ) Alan, thanks for reply. I've tried this and also not work if I already have layers with the same names. I use CAD2002. Quote
BlackBox Posted September 21, 2010 Posted September 21, 2010 ...but does not change the color of existing layers with same name. You have to specify the layer name... (defun make_layer () (command "_.layer" "t" "LAYER_01[color=red]*[/color]" "c" "50" "LAYER_01[color=#ff0000]*[/color]" "") (command "_.layer" "t" "LAYER_02[color=#ff0000]*[/color]" "c" "191" "LAYER_02[color=#ff0000]*[/color]" "") (command "_.layer" "t" "LAYER_03[color=#ff0000]*[/color]" "c" "70" "LAYER_03[color=#ff0000]*[/color]" "") ) Slight revision to accomplish this with existing layers as well, perhaps? Note- the asterisk will effect all layer with this prefix. Quote
alanjt Posted September 21, 2010 Posted September 21, 2010 Alan, thanks for reply.I've tried this and also not work if I already have layers with the same names. I use CAD2002. Well, all you are doing is thawing and setting the color. Are you trying to use this to create the layer? Quote
antistar Posted September 21, 2010 Author Posted September 21, 2010 Well, all you are doing is thawing and setting the color.Are you trying to use this to create the layer? I want to change the color properties of existing layers. Quote
alanjt Posted September 21, 2010 Posted September 21, 2010 I want to change the color properties of existing layers. 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" "") ) Quote
Lee Mac Posted September 21, 2010 Posted September 21, 2010 Else look at entmod'ing the tblobjname... Quote
alanjt Posted September 21, 2010 Posted September 21, 2010 Else look at entmod'ing the tblobjname... baby steps :wink: Quote
antistar Posted September 21, 2010 Author Posted September 21, 2010 Slight revision to accomplish this with existing layers as well, perhaps? Note- the asterisk will effect all layer with this prefix. RenderMan, Now it worked perfectly. Thank you for your help. Quote
BlackBox Posted September 21, 2010 Posted September 21, 2010 Aww, shucks... I just added [a tiny bit] to what Alanjt already provided you. :wink: Quote
StevJ Posted September 22, 2010 Posted September 22, 2010 Perhaps his layers are still locked. (command "_.layer" "t" "LAYER_01" "u" "LAYER_01" "c" "50" "LAYER_01" "") SteveJ EDIT: Oops. Nevermind Quote
alanjt Posted September 22, 2010 Posted September 22, 2010 Perhaps his layers are still locked. (command "_.layer" "t" "LAYER_01" "u" "LAYER_01" "c" "50" "LAYER_01" "") SteveJ Locking a layer only limits the user from editing objects on the layer; the layer itself can still be altered. Quote
StevJ Posted September 22, 2010 Posted September 22, 2010 Yeah. I was thinking from the Layer Properties Manager it would be easy, but using LISP might require that extra little step. Turns out that wasn't the problem, anyway. SteveJ Quote
antistar Posted September 22, 2010 Author Posted September 22, 2010 Still abusing the patience of colleagues, does anybody know how to write a subroutine to change the color of multiple layers? I would like to activate this subroutine as follows: (Subroutine "NewColor" "layername1, layername2, layername3,...") Thanks in advance. Quote
StevJ Posted September 22, 2010 Posted September 22, 2010 Separate layer names with commas (no spaces before or after the comma) "layername1,layername2,layername3" Also, wildcard character (*) is permitted "layername*" would modify all the above SteveJ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.