Script with IF statements stopping once it gets a positive result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
hopefully someone can help me - I am trying to script automate the turning on of layers I am interested in in multiple drawings, but the layers don't always exist, so traditional -layer commands would stall when the script comes across a layer it doesn't see.
to prevent this, i am using IF statements as below, but the issue is i have the opposite problem now...the script is a long list of layers as below, the script breezes through layers it doesn't know but stops once it gets to a recognised layer in the drawing. It DOES turn the later on but then it just stops, printing 'nil' next to 'Command:' in the command line
does anyone know how to stop it tripping up please?
(command (if (tblsearch "layer" "EO-Pr6070-M-LightingFeederPillar") (command "-LAYER" "_on" "EO-Pr6070-M-LightingFeederPillar" "" "_y")))
(command (if (tblsearch "layer" "EO-Pr6070-M-LightingFeederPillar2DView") (command "-LAYER" "_on" "EO-Pr6070-M-LightingFeederPillar2DView" "" "_y")))
(command (if (tblsearch "layer" "EO-Pr6070-M-LightingFeederPillar3DView") (command "-LAYER" "_on" "EO-Pr6070-M-LightingFeederPillar3DView" "" "_y")))
Thansk,
Mark