Author Topic: Set layer filter current - tips  (Read 5481 times)

0 Members and 1 Guest are viewing this topic.

jaydee

  • Guest
Set layer filter current - tips
« 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=36745.msg417411#msg417411

Dont know why it works the way it did on acad2011

« Last Edit: August 17, 2011, 11:16:58 PM by jaydee »

autocart

  • Guest
Re: Set layer filter current - tips
« Reply #1 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

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.
« Last Edit: October 20, 2011, 03:44:18 AM by autocart »

jaydee

  • Guest
Re: Set layer filter current - tips
« Reply #2 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