View Full Version : Script for selecting a specific layer
c_space
23rd Feb 2012, 08:31 pm
I am trying to make a script that starts by selecting a specific layer.
The problem I am facing is that when I enter "-layer" "M" "layername", it then takes me back to all of the options whithin the layer setting.
When doing it manually, I just hit escape and it takes me out of the command, however Escape doesn't translate too well in my notepad (where I writing my script).
Advice?
Sorry for the elementary question, I'm brand new to script writing.
c_space
23rd Feb 2012, 08:35 pm
wow.... how rookie am I?
Just hit enter again and the command ceases.
alanjt
23rd Feb 2012, 08:59 pm
FYI: avoid the use of Escape within commands whenever possible.
c_space
23rd Feb 2012, 09:04 pm
ok.... new problem. I'm trying to use the script to select all objects on a specific layer. I'm using the layiso command, but it's asking for user input to "select objects on the layer to isolate". this terminates my script.
Any adivce on that?
alanjt
23rd Feb 2012, 09:07 pm
Feed it a selection set.
(setq ss (ssget "_X" '((8 . "LAYERNAME"))))
alanjt
23rd Feb 2012, 09:08 pm
Of course, if you're just wanting to turn off or isolate a certain layer, just use the -Layer command on/off.
c_space
23rd Feb 2012, 09:11 pm
yeah. me=rookie
I'm not sure what to do with that?
c_space
23rd Feb 2012, 09:14 pm
Of course, if you're just wanting to turn off or isolate a certain layer, just use the -Layer command on/off.
I do indeed want to just Isolate 1 layer, so that I can select all of the objects on that layer and delete them. However I haven't figured out how to do that completly through the command line.
alanjt
23rd Feb 2012, 09:17 pm
If you are wanting to delete the layer and it's contents, I suggest just using LAYDEL, if you want to keep the layer, you'll have to select all objects on that layer and delete.
Here's bit of sample code to erase everything on a specified layer - no need for isolating.
(if (setq ss (ssget "_X" '((8 . "LAYER")))) (command "_.erase" ss ""))
BIGAL
24th Feb 2012, 02:35 am
-layer examples
-la off sew* enter enter
-la off * enter enter
-la s sewer off * on sew* enter enter
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.