TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jaydee on August 17, 2011, 10:38:07 PM

Title: Set layer filter current - tips
Post by: jaydee on August 17, 2011, 10:38:07 PM
Hi
Links below demonstrate how to make/create layer filters (No_Xref_Layers)
The issue is how to make it current.

This command is not working
(command "-layer" "filter" "set" "No_Xref_Layers" "")

But after a few testing, i figure out how to trick it into setting the filter current by making a dummy layer filter name ie. "tempNoXrefLayers" and then rename it as
(command "-layer" "filter" "rename" "tempNoXrefLayers" "No_Xref-Layers" "set" "No_Xref-Layers" "")
This will set the layer filter cuurent in the layer dialog.

I have a feeling that entmakex xrecord not geeting updated in the layer table?

http://www.theswamp.org/index.php?topic=12640.msg155019#msg155019 (http://www.theswamp.org/index.php?topic=12640.msg155019#msg155019)
http://www.theswamp.org/index.php?topic=36745.msg417411#msg417411 (http://www.theswamp.org/index.php?topic=36745.msg417411#msg417411)

Dont know why it works the way it did on acad2011

Title: Re: Set layer filter current - tips
Post by: autocart on October 20, 2011, 02:33:09 AM
It has something to do with the layermanager.
If you first invoke the layerpalette then you don't need a dummy (but its probably slower).
I did it like this:
Code: [Select]
(command "_.LAYERPALETTE")
(command "_.LAYERCLOSE")
(command "_.-layer" "_filter" "_set" filterName "_x" "")

BTW, here is another lisp to create a layerfilter:
http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Named-layer-filter/td-p/843332 (http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Named-layer-filter/td-p/843332)

EDIT: After I adapted the way of how I create the layer filter (was running into problems before) all of a sudden my way of setting it current by itself did not work anymore. Your trick, jaydee, now works for me in connection with opening and closing the layerpalette after setting it. Btw, thx for the trick.
Title: Re: Set layer filter current - tips
Post by: jaydee on October 20, 2011, 03:58:24 AM
Glad it works for you autocart.

Theres alot of good examples of how to create layer filter by smart coders at the swamp, CT & augi. But i personally have not found a solution how to set the layer filter current in the past. you expect this (command "-layer" "filter" "set" "No_Xref_Layers" "")
to work, but its not.

Cheers