Jump to content

Script for selecting a specific layer


c_space

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ""))

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...