Ahankhah Posted October 11, 2012 Posted October 11, 2012 Hi all, I want to activate a desired layer filter when beginning a new dwg or openning an existing dwg file, but calling +LAYER or -LAYER (and Filter->Set options of it) has no effects or causes Fatal Error. Who knows any alternative to set an existing layer filter as active? Note: 1- The code which causes Fatal Error is as following: (command "_.+LAYER" %filter-name% "" "") 2- This code has no effect: (command "_.-LAYER" "_Filter" "_Set" %filter-name% "") Any help or clue is greatly appreciated Quote
BlackBox Posted October 11, 2012 Posted October 11, 2012 I recall a thread that discussed Layer Filters; if memory serves Lee was able to identify that Layer Filters are contained within a specific Dictionary within the drawing document. HTH Quote
Ahankhah Posted October 11, 2012 Author Posted October 11, 2012 RenderMan, I have no difficulty defining a new layer filter. Of course I learned this from Lee, so many thanks to him. My problem is just activating an existing layer filter via VLISP code. Quote
Lee Mac Posted October 11, 2012 Posted October 11, 2012 My problem is just activating an existing layer filter via VLISP code. To my knowledge, I don't believe this functionality was ever exposed to the AutoLISP / Visual LISP API - one can define a new layer filter by creating the necessary Dictionary and XRecord entries, however, I see no way to set a layer filter to be current through AutoLISP or certainly Visual LISP, without a call to the command line. Quote
Ahankhah Posted October 19, 2012 Author Posted October 19, 2012 Lee, I solved the problem. Calling "LAYER" command and entering its "Filter" option (a hidden option) then entering "Set" option and finally entering the name of desired existing layer filter, you can get the goal. Of course to ensure the command takes effect, you must rename the "layer filter" temporarily, then again return it to its original name, as in the following code: ;;;MT:Set:Active:LayerFilter - Mehdad Ahnkhah - Mehre Taban (defun MT:Set:Active:LayerFilter (%filter-name%) ;; here ensure that %filter-name% exists (setvar 'Cmdecho 0) (command "_.-LAYER" "_Filter" "_Set" %filter-name% "_eXit" "" "_.-LAYER" "_Filter" "_Rename" %filter-name% "temp" "_eXit" "" "_.-LAYER" "_Filter" "_Rename" "temp" %filter-name% "_Set" %filter-name% "_eXit" "" ) (setvar 'Cmdecho 1) ) Quote
Lee Mac Posted October 19, 2012 Posted October 19, 2012 I'm glad you were able to solve it Mehrdad - well done. Quote
Ahankhah Posted October 20, 2012 Author Posted October 20, 2012 I'm glad you were able to solve it Mehrdad - well done. Thank you very much Lee. To success: there are some ways to locate, if not, there are some ways to create. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.