See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Can I create frequently used layer filters in LISP?

  1. #1
    Active Member
    Join Date
    2002-01
    Posts
    99
    Login to Give a bone
    0

    Default Can I create frequently used layer filters in LISP?

    Greetings, I have a set of layer filters I frequently use. For example, All ON, All OFF, All non-referenced (~*|*), All FAA (*FAA*), etc.

    Is there a way I can use LISP to create my favorite layer filters?

    Thanks for any help.

  2. #2
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233
    Login to Give a bone
    0

    Default Re: Can I create frequently used layer filters in LISP?

    It seems there is a solution to your problem on the autodesk website. The lin is posted below.
    http://discussion.autodesk.com/forum...hreadID=456426

  3. #3
    I could stop if I wanted to
    Join Date
    2007-08
    Posts
    201
    Login to Give a bone
    1

    Default Re: Can I create frequently used layer filters in LISP?

    Hi,

    Here's an Import/Export layer filter LISP.
    It works with propety layer filters.

    EXPFLTR exports a layer filter from the current drawing to a text file (extention: .flt)
    IMPFLTR imports a layer filter from a flt file or a drawing.
    Attached Files Attached Files

  4. #4
    Active Member
    Join Date
    2007-11
    Posts
    68
    Login to Give a bone
    0

    Talking Re: Can I create frequently used layer filters in LISP?

    It would be nice if you could create a block with all your layers, lines types, & Layer filters in it. So far you can't import filters via a block. Maybe next autocad it will be released.

  5. #5
    Active Member
    Join Date
    2002-01
    Posts
    99
    Login to Give a bone
    0

    Default Re: Can I create frequently used layer filters in LISP?

    The LayerFilter.LSP does work, nice job. It only seems to do one at a time. I'd like to do several in one shot.

    I have not been able to get the AutoDesk forum post solution to work yet.

    I doubt you'll be able to import filters thru a block. This was enabled when layer filters first came out but it created drawings with thousands of filters so they disabled it.

  6. #6
    Woo! Hoo! my 1st post
    Join Date
    2021-08
    Posts
    1
    Login to Give a bone
    0

    Default Re: Can I create frequently used layer filters in LISP?

    Thank you for your sharing, which is very helpful to me!

  7. #7
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,655
    Login to Give a bone
    0

    Default Re: Can I create frequently used layer filters in LISP?

    This is what I use the most:
    Code:
    ; (load "LayFilterAdd.lsp")
    ; ^C^C^P(or LayFilterAdd (load "LayFilterAdd.lsp"));(LayFilterAdd)
    ; Newer versions automatically display Xref Layer Filters **Adding Xref Layer Filter names the same as them can cause serious issues**
    ; Save, close and reopen the DWT or DWG for the Filters to be put into alphabetical order.
    (defun LayFilterAdd (/ collection names)
    ;  (load "LFD.lsp")
    ;  (command "C:LFD" "All*") *Layers
      (setq names (list ""))
      (if (not (vl-catch-all-error-p (setq collection (vl-catch-all-apply
        (function (lambda () (vla-item (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) "ACAD_LAYERFILTERS")))
      ))))
    ;  (vlax-for item collection (setq names (cons (strcase (vla-get-name item)) names))))
      (vlax-for item collection (setq names (cons (vla-get-name item) names))))
      names 
      (or(member "CALC Points" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"V-NODE-CALC\" or NAME== \"Layer*\"" "CALC Points" "X" nil))
      (or(member "HATCH No xrefs" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"*HATCH\"" "HATCH No xrefs" "X" nil))
      (or(member "Linetype" names)(command "._-layer" "filter" "new" "property" "All" "LINETYPE==\"~Continuous\"" "Linetype" "X" nil))
      (or(member "Lineweight" names)(command "._-layer" "filter" "new" "property" "All" "LINEWEIGHT==\"~Default\"" "Lineweight" "X" nil))
      (or(member "NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"[A,C,E,L,V]-*\" or NAME== \"Layer*\"" "NCS" "X" nil))
      (or(member "NCS No xrefs" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"[A,C,E,L,V]-*\" or NAME== \"Layer*\"" "NCS No xrefs" "X" nil))
      (or(member "No NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~[A,C,E,L,V]-*\"" "No NCS" "X" nil))
      (or(member "No NCS or xrefs" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"~[A,C,E,L,V]-*\"" "No NCS or xrefs" "X" nil))
      (or(member "No NODE" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"[A,C,E,L,V]-*\" and NAME==\"~*-NODE*\" or NAME== \"Layer*\"" "No NODE" "X" nil))
      (or(member "NODE" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"[A,C,E,L,V]-*\" and NAME==\"*-NODE*\" or NAME== \"Layer*\"" "NODE" "X" nil))
      (or(member "Profile" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-ROAD-PROF*\" or NAME== \"Layer*\"" "Profile" "X" nil))
      (or(member "Sections" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-ROAD-SEC*\" or NAME== \"Layer*\"" "Sections" "X" nil))
      (or(member "Topo" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-TOPO*\" or NAME== \"Layer*\"" "Topo" "X" nil))
      (princ "Layer Filter Names » ")(princ names)
    ;  (princ "\nSave, close and reopen the DWT or DWG for the Filters to be put into alphabetical order.")
      (princ)
    ); function
    (LayFilterAdd)
    You would have to modify it for your layers.

Similar Threads

  1. LISP to create layer, hatch and set layer back to original.
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 1
    Last Post: 2013-12-11, 07:22 PM
  2. 2010: Can I use layer group filters for layer translation (LAYTRANS)?
    By Besni in forum AutoCAD General
    Replies: 4
    Last Post: 2013-10-04, 06:52 AM
  3. Create layer lisp problem in R2012
    By marc.verdaasdonk697335 in forum AutoLISP
    Replies: 15
    Last Post: 2012-12-04, 12:34 PM
  4. Ability to create legends from Filters
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2012-06-13, 02:32 AM
  5. Replies: 2
    Last Post: 2006-05-18, 01:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •