Automatic removal of Layer Filters

Discussion in 'AutoCAD' started by Kheinz, Mar 30, 2005.

  1. Kheinz

    Kheinz Guest

    I know there are a ton of posts about removal of layer filters, but I want to have AutoCAD 2002 automatically delete all layer filters as the designers go into their drawings. I tried to modify a script file I found for this but it gives a visual basic error if there aren't any layers to remove.

    Any ideas?
    KHeinz
     
    Kheinz, Mar 30, 2005
    #1
  2. Kheinz

    ECCAD Guest

    Well known routine by Robert Bell.
    Add to your acaddoc.lsp.
    (or make a file called that, and place in \support folder)

    ;;
    ;; By R. ROBERT BELL
    ;;
    (defun C:DLF ()
    (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)
    )
    ...........
    If you want it to fire-up automatically, on each drawing open..
    add this line also, right after the function.

    (C:DLF)

    Bob
     
    ECCAD, Mar 30, 2005
    #2
  3. Kheinz

    Jeff Mishler Guest

    Paste the following code to a new text file and saveas layerfilyerdelete.lsp
    Code:
    (defun c:lfd (/ dicts dict filtr)
    (vl-Load-Com)
    (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
    (vla-delete filtr)
    )
    )
    )
    )
    )
    )
    (princ)
    )
    
    Then, in your acaddoc.lsp file (create it if it doesn't exist, it should be
    in the /Support/ folder) add the following:

    (load "layerfilterdelete")
    (c:lfd)


    That should do it!
     
    Jeff Mishler, Mar 30, 2005
    #3
  4. Kheinz

    cadman_meg Guest

    Hey Jeff,

    Could you automatically create something similar and simple to send hatches and raster images to the back. Maybe something that can detect (like a reactor in VLisp) when it is newly created in a dwg?
     
    cadman_meg, Mar 30, 2005
    #4
  5. Kheinz

    Kheinz Guest

    This works great! Although it has me concerned of what it actually is removing. Does it only remove layer filters or does it remove other data as well. I have noticed that I have had drawing sizes go from 1.8mb to 123kb.

    Just wondering,
    Kheinz
     
    Kheinz, Mar 31, 2005
    #5
  6. Kheinz

    Shane-W Guest

    Only layer filters. Thats what makes this routine so great. Most of the drawings I work with have over 30,000 layer filters from drawings being reused over and over agian.
    I too would start from a file size 2-4 megs and end up with a 50-100k file size. I have mine set to run on drawing open.
     
    Shane-W, Mar 31, 2005
    #6
  7. Kheinz

    Kheinz Guest

    Cool that's what I wanted to hear. This is going to save a ton of space on my server over time.

    Thanks again,
    KHeinz
     
    Kheinz, Mar 31, 2005
    #7
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.