Annoying layer filters

Discussion in 'AutoCAD' started by Allan Johanson, Apr 7, 2004.

  1. AutoCAD seems to be inserting thousands of layer filters into my drawings
     
    Allan Johanson, Apr 7, 2004
    #1
  2. Allan  Johanson

    Jeff Mishler Guest

    Layer Filters are stored in the drawing. Any time you copy an object
    from a drawing with these filters to another drawing, the object will
    bring those filters along for the ride. Ditto if you insert a drawing
    with filters into a new drawing.

    To remove ALL layer filters you can use this lisp routine by R. Robert
    Bell:

    ;;;;;;;;;BEGIN CODE
    (defun C:LayerFiltersDelete ()
    (vl-Load-Com)
    (vl-Catch-All-Apply
    '(lambda ()
    (vla-Remove (vla-GetExtensionDictionary
    (vla-Get-Layers
    (vla-Get-ActiveDocument
    (vlax-Get-Acad-Object))))
    "ACAD_LAYERFILTERS")))
    (princ "\nAll layer filters have been deleted.")
    (princ))

    (defun C:LFD () (C:LayerFiltersDelete))
    ;;;;;;;;;;;END CODE

    usage: type "LFD" at the command prompt

    OR, if you have your own filters you'd like to keep.....create them with
    a unique prefix that you can then use in this lisp:

    ;;;;;;BEGIN CODE
    ;;Original code to delete all layer filters by R. Robert Bell.
    ;;Heavily modified to delete only specific filters by
    ;;Jeff Mishler, December 2003

    (defun c:filtrdel (/ names dicts)
    (vl-Load-Com)
    (princ "\nRoutine to delete all but the specified Layer filters. When
    entering filter
    names to retain, wildcards are allowed. i.e., entering \"zz*,xx*\"
    will
    delete all filters except those beginning with zz and xx.")
    (setq names (getstring "\nEnter filter names to retain, press Enter
    for none: "))
    (vl-Catch-All-Apply
    '(lambda ()
    (setq dicts (vla-GetExtensionDictionary
    (vla-Get-Layers
    (vla-Get-ActiveDocument
    (vlax-Get-Acad-Object)
    )
    )
    )
    )
    (vlax-for dict dicts
    (if (and (= (vla-get-name dict) "ACAD_LAYERFILTERS")
    (> (vla-get-count dict) 0))
    (progn
    (vlax-for filtr dict
    (if (not (wcmatch (vla-get-name filtr) names))
    (vla-delete filtr)
    )
    )
    )
    )
    )
    )
    )
    (princ "\nSpecified layer filters have been deleted.")
    (princ)
    )
    ;;;;;;;;;END CODE

    usage: type "filtrdel" at the command prompt

    To keep them from coming back, delete them from all drawings and then
    make sure to check drawings from outside sources prior to using them in
    your drawings.

    HTH,
    Jeff
     
    Jeff Mishler, Apr 7, 2004
    #2
  3. Got anything that'll work in r14, Jeff?

     
    Michael Bulatovich, Apr 8, 2004
    #3
  4. Michael,

    You can e-mail me direct, and I'll send you a lisp routine that doesn't use
    vla vlax.

    Bret
     
    Bret Tresidder, Apr 8, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.