Jump to content

Recommended Posts

Posted (edited)

Hello all you CAD Guru's out there! I am currently having trouble creating a lisp and am in desperate need of experienced guidance. I am trying to make a command such as

 

(defun C:lo ()
 (command "layer" "on" "*" "t" "*" ""))

 

which turns all layers on, however i need the layers Circuit-1 through Circuit-12 to be untouched. For example if i have circuits 5 through 12 turned off, frozen, whatever state they may be in needs to not be affected by the command to turn all layers on.

 

Basically I would like to make a command that turns all layers on with the exception of layers Circuit-1 through Circuit-12

 

I started to write a code based on layer groups which I though may be the way to accomplish this task. I.E. make a layer group of all layers EXCLUDING or removing Circuit 1-12 and thaw or turn on all of that layer group. I am unsuccessful in thawing the "new layer filter" using code. (I can however right click on the group and change its visibility to thawed and that works.)

 

(defun c:TESTER (/)

(COMMAND "-LAYER" "FILTER" "NEW" "GROUP" "" "*" "NEW LAYER FILTER" "")
(COMMAND "-LAYER" "FILTER" "EDIT" "NEW LAYER FILTER" "DELETE" "CIRCUIT-1" "DELETE" "CIRCUIT-2" "DELETE" "CIRCUIT-3" "DELETE" "CIRCUIT-4" "DELETE" "CIRCUIT-5" "DELETE" "CIRCUIT-6" "DELETE" "CIRCUIT-7" "DELETE" "CIRCUIT-8" "DELETE" "CIRCUIT-9" "DELETE" "CIRCUIT-10" "DELETE" "CIRCUIT-11" "DELETE" "CIRCUIT-12" "")
(command "-layer" "t" "new layer filter" ""))

Where have I gone wrong?

Edited by SLW210
Add Code Tags!
Posted

(command "layer" "on" "!*circuit")

 

Does this work. Don't know if you can use it ! Like this.

 

Sent from my SM-G920T using Tapatalk

Posted

no not quite but thank you iconeo for quickly responding! It tells me that no matching layer names are found. :(

Posted

I took out the ! in the code

(command "layer" "thaw" "*circuit*" "")

and it seems to be working now however it is doing the opposite of what I need it to do. It is only turning on the circuit layers instead of leaving them untouched and turning on all other layers.

Posted

So sorry, the operator is ~ not !...

 

(command "layer" "thaw" "~*circuit*" "")

 

I think all of these operators apply.

 

AutoCAD 2017 Help: To Work with the Layer List in the Layer Properties Manager

 

# (pound) Matches any numeric digit

@ (at) Matches any alphabetic character

. (period) Matches any non-alphanumeric character

* (asterisk) Matches any string and can be used anywhere in the search string

? (question mark) Matches any single character; for example, ?BC matches ABC, 3BC, and so on

~ (tilde) Matches anything but the pattern; for example, ~*AB*matches all strings that don't contain AB

[ ] Matches any one of the characters enclosed; for example, [AB]C matches AC and BC

[~] Matches any character not enclosed; for example, [~AB]C matches XC but not AC

[-] Specifies a range for a single character; for example, [A-G]C matches AC, BC to GC, but not HC

` (reverse quote) Reads the next character literally; for example, `~AB matches ~AB

Posted

Yes!!! Thank you soooo much!!! That is exactly what I was looking for! You just saved the day!

Posted

Glad to be able to help and welcome to the forum.

 

Sent from my SM-G920T using Tapatalk

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...