Include Exclude Layer Filter

Include Exclude Layer Filter

Anonymous
Not applicable
6,481 Views
13 Replies
Message 1 of 14

Include Exclude Layer Filter

Anonymous
Not applicable

I am trying to write a layer filter that will include all of my layers that contain FIGR and exlude all layers containing DEMO

I am familiar with the ~ and ** syntax but have not been able to use them in conjuction to get the result I am looking for.

I would appreciate your help if you are able to give some.

-JT

0 Likes
Accepted solutions (1)
6,482 Views
13 Replies
Replies (13)
Message 2 of 14

rkmcswain
Mentor
Mentor
By definition, if you only want to see FIGR layers, that will exclude everything else, including DEMO layers.

Or you could have one that excludes DEMO layers, that would include FIGR (and all others).

IOW, once you do ONE of those, the other is not necessary.
Maybe I'm missing something?




R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 14

Anonymous
Not applicable

The result I am looking for is to have a list of all layers that contain FIGR but do not contain DEMO

for example I want to have V-FIGR-RETW but not V-FIGR-RETW-DEMO

 

I have discovered one solution for this.

I am now using a sub filter to accomplish this.

 

My main filter includes all layers containg FIGR - *FIGR*

And the sub filter excludes the layers containing DEMO - ~*DEMO*

 

-JT

0 Likes
Message 4 of 14

scot-65
Advisor
Advisor
Create a command inside the CUI and populate in your favorite area.

Here is the command's Macro:
^C^C-layer;t;0;s;0;f;*;t;*FIGR*,Def*;f;*DEMO;;

And another one:
^C^C-layer;t;0;s;0;f;*;t;*DEMO,Def*;;

Add any additional layers after Def* that will be comma separated.
A semicolon is equal to [Enter].
If you Off/On your layers, also incorporate/substitute in the macro.

???

And Welcome to this Forum!

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

Message 5 of 14

3wood
Advisor
Advisor
Accepted solution

You can set up a nested Layer Property Filter.

FILTER 3.PNG

Create a filter to include FIGR first, then create another filter under this filter (right-click and select from the short-cut menu) to exclude DEMO.

FILTER 1.png  FILTER 2.PNG

Message 6 of 14

Anonymous
Not applicable
3wood that is what I ended up using as my solution. It is something that Autodesk could tweak because when I saw New Properties Filter after a right click I thought 'no I want to work with this one not a new one.' My point is that something that said subFilter would be nice and intuitive. However, I am glad that the functionality is there.
Message 7 of 14

scot-65
Advisor
Advisor
I got a bad taste when layer filters were first introduced - thus avoiding whenever possible.

An engineer once sent us a 50MB file that had about 220k worth of entities and the bloating
was due to thousands upon thousands of layer filters (including Chinese characters).
He was not aware of this.

As part of our file maintenance, where the first occurrence of Qsave, layer filters are purged.

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 8 of 14

3wood
Advisor
Advisor

Subfilter is a good name! But we don't have a name of subblock?

Message 9 of 14

leilani.gnall-gregory
Advocate
Advocate

How do you write a sub properties filter into a lisp routine? 

I've got a lisp to create a layer filter.  

0 Likes
Message 10 of 14

cadffm
Consultant
Consultant


@leilani.gnall-gregory  schrieb:

How do you write a sub properties filter into a lisp routine? 

Every Layerfilter is a sub-layerfilter, except the "all" filter.

 

I've got a lisp to create a layer filter.  

Is this lisp using the api to create layerfilters, or just sends input to the commandline (Command ...)?

If you don't know, share this Lispcode




API: Share your code first, please

 

COMMAND: Type in..

-LAYER<enter>

FILTER<enter>

NEW<enter>

Property<enter>

[F2] read what AutoCAD ask for..!

If you send "" or "All", you create a sub-filter to filter "All",

if you send "INCLUDE", you create a sub-filter to filter "INCLUDE" ~ if present

 


._-layer
_filter
_new
_property

NAME=="*FIGR*"
INCLUDE


._-layer
_filter
_new
_property
INCLUDE
NAME=="~*DEMO*"
EXCLUDE


within the (command function
(command "._-layer" "_filter" "_new" "_property" "" "NAME==\"*FIGR*\"" "INCLUDE" nil)
(command "._-layer" "_filter" "_new" "_property" "INCLUDE" "NAME==\"~*DEMO*\"" "EXCLUDE" nil)

Sebastian

0 Likes
Message 11 of 14

TomBeauford
Advisor
Advisor

You can also use and & or to create filters like you want without needing a subfilter.

(command "._-layer" "filter" "new" "property" "All" "NAME==\"~DEMO\" and NAME==\"*FIGR*\"" "FIGR No DEMO" "X" nil)

 

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes
Message 12 of 14

leahs6ALC9
Contributor
Contributor

Following on from the initial question, I'm trying to exclude multiple text strings from my property filter. I created a sub-filter and added both exclusions in, but the sub-filter seems to only work with a single exclusion. When I put two exclusions in the sub-filter, neither of the strings are excluded. Image attached.

 

Property filtering is a new skill for me, so I'm hoping it's simply a case of me not doing it right.

0 Likes
Message 13 of 14

cadffm
Consultant
Consultant

Hi,

>>"When I put two exclusions in the sub-filter, neither of the strings are excluded. "

pure logic

 

~*PATH HATCH

list all layers, except the layers with 'PATH HATCH' at the end of the name (for example: ENG RD VERGE doesn't match *PATH HATCH)

 

~*RD VERGE

list all layers, except the layers with 'RD VERGE' at the end of the name (for example: ENG RD PATH HATCH doesn't match *RD VERGE)

 

Result= All layers listed

 

-

 

It is not documented, but you can create such an filter this way:

~(*PATH HATCH,*RD VERGE)

 

or for XRef layers only

~(*|*PATH HATCH,*|*RD VERGE)

Sebastian

Message 14 of 14

leahs6ALC9
Contributor
Contributor

I thought that was what was going on. Just didn't know how to get around it. Thanks so much for the workaround. It's exactly what I was looking for.

0 Likes