need lisp to CREATE layer filters

Discussion in 'AutoCAD' started by Rhots, Jan 26, 2005.

  1. Rhots

    Rhots Guest

    Hi folks,
    I am using Robert Bell's LFD to clean up my layer filters but I would like to be able to run a second lisp automatically to create a few for or office. I followed all 125 links for "layer filter" and found one by Kojacek but it would not run. It worked with a text file list.of the required filters.
    I am using acad2002/adt3.3 on win 98. I have VERY limited knowledge of lisp so it needs to be pretty much DUH proof.
    Thanks for any help.
    Rick
     
    Rhots, Jan 26, 2005
    #1
  2. Rhots

    Warren Trost Guest

    I posted a message on 10-13-04 in the autodesk.autocad.2005 discussion group
    of how to do this.

    to be able to run a second lisp automatically to create a few for or office.
    I followed all 125 links for "layer filter" and found one by Kojacek but it
    would not run. It worked with a text file list.of the required filters.
    lisp so it needs to be pretty much DUH proof.
     
    Warren Trost, Jan 27, 2005
    #2
  3. Rhots

    GaryDF Guest

    This is what I use:

    (defun Make_Layer_Filterit (/ FILTLST LFILTOBJ SAFECODE SAFEFILT)
    (vl-load-com)
    (setq FILTLST (list
    ;;name Lay col lt flags lw plot
    (list "Arch..Detail" "A-DETL*" "*" "*" 0 "*" "*")
    (list "Arch..Annotation" "*NOTE*" "*" "*" 0 "*" "*")
    (list "Arch..Dimensions" "*DIMS*" "*" "*" 0 "*" "*")
    (list "Arch..Symbols" "*SYM*" "*" "*" 0 "*" "*")
    (list "Arch..Sheet" "*WSHTT*" "*" "*" 0 "*" "*")

    (list "Eng...Civil" "C-*" "*" "*" 0 "*" "*")
    (list "Eng...Structural" "S-*" "*" "*" 0 "*" "*")
    (list "Eng...Mechanical" "M-*" "*" "*" 0 "*" "*")
    (list "Eng...Electrical" "E-*" "*" "*" 0 "*" "*")
    (list "Eng...Plumbing" "P-*" "*" "*" 0 "*" "*")
    )
    LFILTOBJ (vla-addobject
    (vla-GetExtensionDictionary
    (vla-Get-Layers
    (vla-Get-ActiveDocument
    (vlax-Get-Acad-Object)
    )
    )
    )
    "ACAD_LAYERFILTERS"
    "AcDbDictionary"
    )
    SAFECODE (vlax-make-safearray 2 '(0 . 6))
    SAFEFILT (vlax-make-safearray 12 '(0 . 6))
    )
    (vlax-safearray-fill SAFECODE (list 1 1 1 1 70 1 1))
    (foreach
    SUBLST FILTLST
    (vlax-safearray-fill
    SAFEFILT
    (mapcar '(lambda (X) (vlax-make-variant X 8)) SUBLST)
    )
    (vla-addxrecord LFILTOBJ (nth 0 SUBLST))
    (vla-setxrecorddata
    (vla-item LFILTOBJ (nth 0 SUBLST))
    SAFECODE
    SAFEFILT
    )
    )
    (prin1)
    (princ "\n* All Layer Filters have been created........... *")
    )

    Gary
    be able to run a second lisp automatically to create a few for or office. I
    followed all 125 links for "layer filter" and found one by Kojacek but it would
    not run. It worked with a text file list.of the required filters.
    it needs to be pretty much DUH proof.
     
    GaryDF, Jan 27, 2005
    #3
  4. Rhots

    Rhots Guest

    Thanks Gary, works great. I had to add a "c:" after defun to get it to work.
    Thanks again.
    Warren, the one you posted was the one I tried before that wouldn't work for me.
    Thanks for the replys guys.
    Rick
     
    Rhots, Jan 31, 2005
    #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.