CHANGING LAYER PROPERTIES, IGNORING MISSING LAYERS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am workingona script routine to batch run on a large number of files. I want it to rename a couple layers, Change layer colours and add a new layer. I can get it to do all these things, except if a layer is missing. The files that i am importing may not have layer 'c' but i am changing properties for layers 'a,b,c,d,e' Because the script cannot find layer 'c', it crashes the script. How do i tell the script to ignore a layer if it is missing? below is a sample of the script.
z
e
(if (tblsearch "LAYER" (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 4)))
(command "_rename" "_layer" (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 4)) "cut"))
-rename
La
Scribe-text
Etch
-rename
La
NO KERF _ CUT _ NO LEAD-IN
Cut2
-la
n
bom
-la
s
bom
-la
lc
rgb
0,0,255
-la
s
cut
-la
lc
rgb
0,255,255
-la
s
etch
-la
lc
rgb
255,0,255
-la
s
display
-la
lc
rgb
255,0,0
-la
s
cut2
-la
lc
rgb
0,200,200