Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Layer Filter Properties Toggle

13 REPLIES 13
Reply
Message 1 of 14
btautodesk
1127 Views, 13 Replies

Layer Filter Properties Toggle

How do I create a macro for switch between two filter names within the layer properties manager? I want to switch between filter "A" and filter "B"

 

For example, $M=$(if,$(and,$(>,$(getvar,opmstate),0)),^C^C_propertiesclose,^C^C_properties) but I want it for named filters in the layer manager.

13 REPLIES 13
Message 2 of 14

On the command line you can use the command "-layer" then "_filter" to get the current layer filter and set a new layer filter.

 

This will give you a start.



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 10 Enterprise 64bit
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2021
Message 3 of 14
Pointdump
in reply to: btautodesk

BT,

 

Just curious, why would you want to do this? It's only two clicks to choose a Layer Filter.

 

Filters.png

 

Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2024
Message 4 of 14
btautodesk
in reply to: Pointdump

It's not necessarily only two clicks because you need to open and close the layer property manager constantly and then find the filter, close the layer property manager, reopen it to change to a different filter, close it BUT if you had different toggle button on the ribbon for quick access where you could click on for difference filter, then you dont need to constantly be accessing the layer property manager.

 

This is what I am trying to achieve.

Button 1: First click would filter (for example) all Interior Walls. Second click would filter all exterior walls.

Button 2: First click would filter (for example) all water pipes. Second click would filter all gas pipes.

 

And so forth...

 

 

Message 5 of 14
wfberry
in reply to: btautodesk

For what it is worth, it doesn't appear to me you are using Civil 3D.

 

Bill

 

 

Message 6 of 14
btautodesk
in reply to: wfberry

For what it's worth, yes, I am using 2015 Civil 3D and I'm not sure what that has to do with my question.

Message 7 of 14
Pointdump
in reply to: btautodesk

BT,

 

OK, Autohide reduces it to one click.  SmileyWink.gif

 

Filters.png

 

Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2024
Message 8 of 14
rkmcswain
in reply to: btautodesk

I'm fairly certain what you are asking for is not possible without programming.
R.K. McSwain     | CADpanacea | on twitter
Message 9 of 14
AllenJessup
in reply to: Pointdump

Dave. The OP is closing the Layer Properties Manager after each operation instead of leaving it floating and Hidden. There was a time when leaving it open would slow down the program and that might still apply to less powerful systems. I've never had the problem myself. But I remember discussions about it.

 

Allen

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 10 of 14
AllenJessup
in reply to: btautodesk

andrewpuller3811 gave you a clue. You can accomplish this with a simple lisp. Copy the code below in to Notepad and save as a lisp file. This will set a Layer Filter named A current. Copy the code again and change C:LSA to C:LSB. In each file substitute your layer name for "A" in the command. Load the files using Appload. To load them automatically either add them to the Startup Suite in the Appload dialog box or add them to your acaddoc.lsp file.

 

 

;Type LSA to set a layer filter named A.
;You can substitute any filter name for "A"

(defun C:LSA ()
	(COMMAND "-layer" "_filter" "_set" "A" "")
)
!

 

 Allen Jessup

 

I made a little change to the lisp. I have the Layer & -Layer commands reversed on my system. So the original woldn't have worked on most machines.

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 11 of 14
rkmcswain
in reply to: AllenJessup

AllenJessup wrote:

You can accomplish this with a simple lisp.

Crud. I tried that many times in the past and it never worked reliably. A few times it would work and more of the time it failed.


I realize why now, the layer filter name you pass it is case sensitive.


Thanks.

R.K. McSwain     | CADpanacea | on twitter
Message 12 of 14
rkmcswain
in reply to: rkmcswain

rkmcswain wrote:
I'm fairly certain what you are asking for is not possible without programming.

My bad.
See posts 10 and 11

R.K. McSwain     | CADpanacea | on twitter
Message 13 of 14
AllenJessup
in reply to: rkmcswain

You technically weren't wrong. Although primitive, the lisp does count as programming. Smiley Wink

 

I didn't even think of the case of the filter name. I just naturally entered it exactly as it appeared. That may be an old habit because back when I started with lisp it was much more case sensitive that it is now. I barely touch it anymore. The program does most everything I want and what it doesn't do would require the deep level programming you were thinking of.

 

Allen

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 14 of 14
btautodesk
in reply to: AllenJessup

Well, not exactly what I was trying to do as I have made it that far. I only want a single button that can toggle between "A" and "B"

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report