Have a layer filter chosen on startup of a drawing

Have a layer filter chosen on startup of a drawing

claimed4all
Advocate Advocate
548 Views
2 Replies
Message 1 of 3

Have a layer filter chosen on startup of a drawing

claimed4all
Advocate
Advocate

Running Autocad Civil3D 2016.

 

What I want to happen is when any drawing is opened I want the layer filter, if available, to switch to "All non-Xref Layers" (autocad automatically adds this filter if an xref is present).  The reason I want this to run this is every drawing we use has xrefs, and when the filter is not selected on larger drawings it can have a very large performance impact.

 

I know how to run it through the command line

 

-LA (enter) Filter (enter) Set (enter) All non-Xref Layers (enter) (esc) (esc)

 

If I run the command is written, it does not matter if that layer filter is availble or not, and the will be back at the command promt when its done.

 

The +Layer command will not work here, as it does not contain the autocad created All non-Xref-Layers

 

I currently use an acaddoc.lsp and everything in that is written as such

 

(setvar "osnapz" 1)

(setvar "spaceswitch" 0)

(setvar "SAVETIME" 20)

(setvar "PICKSTYLE" 1)

(setvar "PICKFIRST" 1)

(setvar "FILEDIA" 1)

(setvar "CMDDIA" 1)

(setvar "NAVBARDISPLAY" 0)

 

How can I add the layer filter selection to my acad doc?

 

 

0 Likes
Accepted solutions (1)
549 Views
2 Replies
Replies (2)
Message 2 of 3

dbroad
Mentor
Mentor

If you are just asking how to code that command, then:

(command "-layer"  "Filter" "Set" "All non-Xref Layers" "")

should work assuming your command list is correct.  This may not speed the opening of drawings however since it may run after the drawing itself is loaded. 

Architect, Registered NC, VA, SC, & GA.
Message 3 of 3

claimed4all
Advocate
Advocate
Accepted solution

That works! Although I did modify it slightly.  They way it was written if the layer filter did not exist, then when the drawing was opened, it would be asking you to enter a valid layer filter name.

 

I added a couple \\ at the end and it appears to work perfectly.  Thank You.

 

(command "-layer"  "Filter" "Set" "All non-Xref Layers" ""\\)

0 Likes