filters layer with name control

Discussion in 'AutoCAD' started by mf, Feb 27, 2004.

  1. mf

    mf Guest

    For courtesy who knows as they control themselves
    through "autolisp" the filters layer with name?
    thanks
     
    mf, Feb 27, 2004
    #1
  2. mf

    ECCAD Guest

    mf,
    To set a layer name into a filter, do:
    (setq lname "name_of_layer")
    or
    (setq lname (getstring "\nLayer Name ?"))
    ...
    To get a selection set of all items on layer..lname

    (setq ss (ssget "X" (list (cons 8 lname))))

    Hope this helps.

    Bob
     
    ECCAD, Feb 27, 2004
    #2
  3. mf

    mf Guest

    Thousand Bob thanks, but my problem is cleaning up the list of "filter layer
    with name"
    (the dialogue layer) being used autolisp.

    Marco
     
    mf, Mar 1, 2004
    #3
  4. mf

    ECCAD Guest

    Marco,
    Use Layers Dialog. Select "Show All Layers", and make sure to 'uncheck' the (box) "Invert filter".

    If you want to 'reprogram' the standard Layer Dialog with Lisp, I don't think you can. You can set, or modify a given Layers properties, but that will not affect the Layer Dialog.

    Bob
     
    ECCAD, Mar 1, 2004
    #4
  5. mf

    Jeff Mishler Guest

    Here are two routines. The first will remove ALL named layer filters,
    written by R. Robert Bell. The second is a derivative of the first which
    allows you to input names of filters you'd like to keep, then deletes
    the rest.

    Good Luck,
    Jeff

    ;downloaded from AcadX.com, author: R. Robert Bell

    (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))


    ;;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)
    )
     
    Jeff Mishler, Mar 3, 2004
    #5
  6. mf

    mf Guest

    I try immediately, thanks for the aid
    Marco
     
    mf, Mar 4, 2004
    #6
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.