Jump to content

Recommended Posts

Posted (edited)

So I have this code that probably came from one of the users here and I wonder if it can be modified to set the layer filter current as part of the routine? If yes please modify or give me a hint.

 

(defun c:XREFNOT ( / xdict dict xrecname )
(vl-load-com)
   (setq xdict
       (vlax-vla-object->ename
           (vla-getextensiondictionary 
               (vla-get-layers 
                   (vla-get-activedocument (vlax-get-acad-object))
               )
           )
       )    
   )

   (setq dict
       (if (setq dict (dictsearch xdict "ACAD_LAYERFILTERS"))
           (cdr (assoc -1 dict))
           (dictadd xdict "ACAD_LAYERFILTERS"
               (entmakex
                  '(
                       (0 . "dictionary")
                       (100 . "AcDbDictionary")
                       (280 . 0)
                       (281 . 1)
                   )
               )
           )
       )
   )

   (princ
       (if (dictsearch dict (setq xrecname "No_Xref_Layers"))
           (strcat
               "Layer filter named <"
               xrecname
               "> already exists."
           )
           (if
               (dictadd dict xrecname
                   (entmakex
                       (append
                          '(
                               (0 . "xrecord")
                               (100 . "AcDbXrecord")
                               (280 . 1)
                           )    
                           (list (cons 1 xrecname))
                          '(
                               (1 . "~*|*")
                               (1 . "*")
                               (1 . "*")
                               (70 . 0)
                               (1 . "*")
                               (1 . "*")
                               (-3          
                                   (   "ACAD"
                                       (1000 . "( NAME== \"~*|*\" )")
                                   )         
                               )
                           )    
                       )
                   )
               )
               (strcat
                   "Created layer filter named <"
                   xrecname
                   ">."
               )
               "Doh! Something horrible happened. "
           )    
       )    
   )    

   (princ)

) 


 

Thanks,

rkent

Edited by SLW210
Code Tags~Not Quote Tags!!
Posted

Just use the undocumented "Filter" (or "_FI") option for the -LAYER Command:

 

(command "._-layer" "filter" "set" "[color="red"]YourCaseSensitiveLayerFilterName[/color]" "")

ct.-layer.command.filter.option.png

Posted

Great, gotta love those undocumented options.

 

Thanks.

Posted
Great, gotta love those undocumented options.

 

Thanks.

 

Happy to help, Rkent. :beer:

 

 

 

FWIW - You might also find this one to be of use:

 

(command "._vplayer" "reMoveoverrides")

Posted

BlackBox - is the code I posted yours? I don't remember where it came from and I try to add the source even if it isn't put there by the author.

 

Thanks for vplayer option.

Posted

BlackBox - is the code I posted yours? I don't remember where it came from and I try to add the source even if it isn't put there by the author.

 

Not at all; I do recall having interest in this topic, but never did anything about it (par for the course, unfortunately, given my availability).

 

I know that I had come across a post by Lee on the topic in passing, but couldn't tell you if that code is his either... I do not know him to be that big of a fan of the Simpsons though... Perhaps Kruuger? :lol:

 

Thanks for vplayer option.

 

Anytime.

Posted

Thanks for the confirmation, Lee.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...