TheSwamp
CAD Forums => CAD General => Topic started by: Dave M on July 31, 2018, 06:08:37 PM
-
Hey there,
I was wondering if someone could help me with this script. I am changing the color of several layers and I was thinking that I could list all the layers that will be changed on one line, but I can't get it to work. The script that is attached works, but I was hoping to be able to condense it.
Would someone be willing to look at this and possibly tell me what i am doing wrong?
Thanks
-
You can have lisp in a script so you could make a list of color and layername then just loop trough them. just easier to call the lisp direct
(setq lst (list
"0,0,255" "318038_TOPO_001|EX-P IRR"
"0,0,255" "318038_TOPO_001|EX-SPRINKLER"
"0,0,255" "318038_TOPO_001|EX-WATER"
"0,0,255" "318038_TOPO_001|EX-WELL"
"0,255,0" "318038_TOPO_001|EX-SD"
"0,255,0" "318038_TOPO_001|EX-SEWER"
"127,0,255" "318038_TOPO_001|EX-IRR"
"204,204,0" "318038_TOPO_001|EX-GAS"
"204,204,0" "318038_TOPO_001|EX-GAS LOC PAINT"
"255,0,0" "318038_TOPO_001|EX-POWER"
"255,0,0" "318038_TOPO_001|EX-POWER LOC PAINT"
"255,127,0" "318038_TOPO_001|EX-FIBER OPTIC"
"255,127,0" "318038_TOPO_001|EX-SIGNAL"
"255,127,0" "318038_TOPO_001|EX-SIGNAL LOC PAINT"
"255,127,0" "318038_TOPO_001|EX-TELE"
"255,127,0" "318038_TOPO_001|EX-TELE LOC PAINT"
))
(setq x 0)
(repeat (/ (length lst) 2)
(command "vplayer" "C" "T" (nth x lst) (nth (+ x 1) lst) "Current" "")
(setq x (+ x 2))
)
-
Thanks BIGAL,
I don't have to do this very often, so I am okay with just writing a script. I was really just hoping to be able to simplify the script by having the layers grouped together on one line, e.g. layer1,layer2, etc. I tried it in AutoCAD at the command line and it seemed to work. I must be doing something wrong. Some of the layer names have spaces in them so I put quotes around the names, but that didn't seem to matter.
Thanks again!